Sets the hostdef param which will get passed to the Host Agent which
        the agency starts if it becomes the master.
768551
def set_host_def(self, hostdef):
        '''
        
        '''
        if self._hostdef is not None:
            self.info("Overwriting previous hostdef, which was %r",
                      self._hostdef)
        self._hostdef = hostdef
603910
def set_owner_params(self, uid=None, gid=None):
        
        self._set_aliased('uid', uid)
        self._set_aliased('gid', gid)

        return self
440487
public static void applyUserAgent(String agent) {
    LOGGER.info("Applying agent: " + agent);
    System.setProperty("http.agent", agent);
    System.setProperty("https.agent", agent);
  }
1342975
async def set_agent_neighbors(self):
        '''
        '''
        for i in range(len(self.grid)):
            for j in range(len(self.grid[0])):
                agent = self.grid[i][j]
                xy = (self.origin[0] + i, self.origin[1] + j)
                nxy = _get_neighbor_xy('N', xy)
                exy = _get_neighbor_xy('E', xy)
                sxy = _get_neighbor_xy('S', xy)
                wxy = _get_neighbor_xy('W', xy)
                if j == 0:
                    naddr = await self._get_xy_address_from_neighbor('N', nxy)
                else:
                    naddr = self.get_xy(nxy, addr=True)
                if i == 0:
                    waddr = await self._get_xy_address_from_neighbor('W', wxy)
                else:
                    waddr = self.get_xy(wxy, addr=True)
                if j == len(self.grid[0]) - 1:
                    saddr = await self._get_xy_address_from_neighbor('S', sxy)
                else:
                    saddr = self.get_xy(sxy, addr=True)
                if i == len(self.grid) - 1:
                    eaddr = await self._get_xy_address_from_neighbor('E', exy)
                else:
                    eaddr = self.get_xy(exy, addr=True)
                agent.neighbors['N'] = naddr
                agent.neighbors['E'] = eaddr
                agent.neighbors['S'] = saddr
                agent.neighbors['W'] = waddr
801475
def become_slave(self, broker):
        '''
        
        '''
        self._set_state(BrokerRole.slave)
        self._master = broker
        d = defer.succeed(None)
        if callable(self.on_slave_cb):
            d.addCallback(defer.drop_param, self.on_slave_cb)

        d.addCallback(defer.drop_param, self._master.callRemote,
                      'handshake', self, self.agency, self.agency.agency_id,
                      self.is_standalone())
        d.addCallback(defer.inject_param, 1, self.update_state,
                      'reset_locally')

        for medium in self.agency.iter_agents():
            d.addCallback(defer.drop_param, self.register_agent, medium)

        return d
1371081
public void setAgentProtocols(Set<String> protocols) {
        Set<String> disabled = new TreeSet<>();
        Set<String> enabled = new TreeSet<>();
        for (AgentProtocol p : AgentProtocol.all()) {
            String name = p.getName();
            if (name != null && !p.isRequired()) {
                // we want to record the protocols where the admin has made a conscious decision
                // thus, if a protocol is opt-in, we record the admin enabling it
                // if a protocol is opt-out, we record the admin disabling it
                // We should not transition rapidly from opt-in -> opt-out -> opt-in
                // the scenario we want to have work is:
                // 1. We introduce a new protocol, it starts off as opt-in. Some admins decide to test and opt-in
                // 2. We decide that the protocol is ready for general use. It gets marked as opt-out. Any admins
                //    that took part in early testing now have their config switched to not mention the new protocol
                //    at all when they save their config as the protocol is now opt-out. Any admins that want to
                //    disable it can do so and will have their preference recorded.
                // 3. We decide that the protocol needs to be retired. It gets switched back to opt-in. At this point
                //    the initial opt-in admins, assuming they visited an upgrade to a master with step 2, will
                //    have the protocol disabled for them. This is what we want. If they didn't upgrade to a master
                //    with step 2, well there is not much we can do to differentiate them from somebody who is upgrading
                //    from a previous step 3 master and had needed to keep the protocol turned on.
                //
                // What we should never do is flip-flop: opt-in -> opt-out -> opt-in -> opt-out as that will basically
                // clear any preference that an admin has set, but this should be ok as we only ever will be
                // adding new protocols and retiring old ones.
                if (p.isOptIn()) {
                    if (protocols.contains(name)) {
                        enabled.add(name);
                    }
                } else {
                    if (!protocols.contains(name)) {
                        disabled.add(name);
                    }
                }
            }
        }
        disabledAgentProtocols = disabled.isEmpty() ? null : new ArrayList<>(disabled);
        enabledAgentProtocols = enabled.isEmpty() ? null : new ArrayList<>(enabled);
        agentProtocols = null;
    }
480299
def hosting_devices_assigned_to_cfg_agent(self, context, ids, host):
        
        self._host_notification(context,
                                'hosting_devices_assigned_to_cfg_agent',
                                {'hosting_device_ids': ids}, host)
630430
def hosting_devices_assigned_to_cfg_agent(self, context, payload):
        """"""
        LOG.debug("Got hosting device assigned, payload: %s" % payload)
        try:
            if payload['hosting_device_ids']:
                #TODO(hareeshp): implement assignment of hosting devices
                self.routing_service_helper.fullsync = True
        except KeyError as e:
            LOG.error("Invalid payload format for received RPC message "
                      "`hosting_devices_assigned_to_cfg_agent`. Error is "
                      "%(error)s. Payload is %(payload)s",
                      {'error': e, 'payload': payload})
45864
public static void setTheManager() {
    if ("true".equalsIgnoreCase(System.getProperty(ACTIVATE_FLAG))) {
      if (!(System.getSecurityManager() instanceof DnsMonitorSecurityManager)) {
        System.setSecurityManager(theManager);
      }
    }
  }
643782
def add_host(self, name: str, **kwargs) -> None:
        
        host = {
            name: deserializer.inventory.InventoryElement.deserialize_host(
                name=name, defaults=self.defaults, **kwargs
            )
        }
        self.hosts.update(host)
480617
def set_host(self, host):
        
        if host[-1] == '/':
            host = host[:-1]

        self.host = host
        return self
88429
def init(host='0.0.0.0', port=1338):
    
    CONTROLLER.host = host
    CONTROLLER.port = port
    CONTROLLER.setDaemon(True)  # because it's a deamon it will exit together with the main thread
    CONTROLLER.start()
1216783
private void setAliveDeadMetrics() {
    clusterManager.getMetrics().setAliveNodes(nameToNode.size());
    int totalHosts = hostsReader.getHosts().size();
    if (totalHosts > 0) {
      clusterManager.getMetrics().setDeadNodes(
          totalHosts - nameToNode.size());
    }
  }
1361289
public void setup(String host, String path, Map<String, Object> params) {
        this.host = host;
        this.path = path;
        this.params = params;
        if (Integer.valueOf(3).equals(params.get("objectEncoding"))) {
            if (log.isDebugEnabled()) {
                log.debug("Setting object encoding to AMF3");
            }
            state.setEncoding(Encoding.AMF3);
        }
    }
1056011
def restart_agent(self, agent_id, **kwargs):
        ''''''
        host_medium = self.get_medium('host_agent')
        agent = host_medium.get_agent()
        d = host_medium.get_document(agent_id)
        # This is done like this on purpose, we want to ensure that document
        # exists before passing it to the agent (even though he would handle
        # this himself).
        d.addCallback(
            lambda desc: agent.start_agent(desc.doc_id, **kwargs))
        return d
1013346
protected void fireAgentSpawnedInAgent(UUID spawningAgent, AgentContext context, Agent agent, Object... initializationParameters) {
		// Notify the listeners on the lifecycle events inside
		// the just spawned agent.
		// Usually, only BICs and the AgentLifeCycleSupport in
		// io.janusproject.kernel.bic.StandardBuiltinCapacitiesProvider
		// is invoked.
		final ListenerCollection<SpawnServiceListener> list;
		synchronized (this.agentLifecycleListeners) {
			list = this.agentLifecycleListeners.get(agent.getID());
		}
		if (list != null) {
			final List<Agent> singleton = Collections.singletonList(agent);
			for (final SpawnServiceListener l : list.getListeners(SpawnServiceListener.class)) {
				l.agentSpawned(spawningAgent, context, singleton, initializationParameters);
			}
		}
	}
497335
def _require_host_parameter(args, to):
    
    if not args.host:
        sys.stderr.write("--host is required parameter to --%s\n" % to)
        sys.exit(1)