ensure we start only on one host (if multiple slaves)
763730
private synchronized static boolean isWorkingHost(String host) {
        if (workerHost == null) {
            workerHost = host;
            return true;
        } else {
            return host.equals(workerHost);
        }
    }
709045
def set_canonical_host(self, canonical_host):
        
        parts = canonical_host.lower().split(":")
        self.host = parts[0]
        if len(parts) > 1 and parts[1]:
            self.port = int(parts[1])
        else:
            self.port = None
778520
def _work(self):
        """"""
        server = wsgi.Server(
            name=self._AGENT_BINARY,
            num_threads=CONF.AGENT.worker_count)
        server.start(
            application=_MetadataProxyHandler(),
            port=CONF.bind_port,
            host=CONF.bind_host)
        server.wait()
567303
def setWorkerInfo(self, hostname, workerAmount, origin):
        """"""

        scoop.logger.debug('Initialising {0}{1} worker {2} [{3}].'.format(
            "local" if hostname in utils.localHostnames else "remote",
            " origin" if origin else "",
            self.workersLeft,
            hostname,
            )
        )

        add_args, add_kwargs = self._setWorker_args(origin)
        self.workers[-1].setWorker(*add_args, **add_kwargs)
        self.workers[-1].setWorkerAmount(workerAmount)
198012
def cli(env, identifier):
    """"""

    mgr = SoftLayer.DedicatedHostManager(env.client)

    host_id = helpers.resolve_id(mgr.resolve_ids, identifier, 'dedicated host')

    if not (env.skip_confirmations or formatting.no_going_back(host_id)):
        raise exceptions.CLIAbort('Aborted')

    mgr.cancel_host(host_id)

    click.secho('Dedicated Host %s was cancelled' % host_id, fg='green')
480617
def set_host(self, host):
        
        if host[-1] == '/':
            host = host[:-1]

        self.host = host
        return self
249955
def spawn_managed_host(config_file, manager, connect_on_start=True):
    

    data = manager.request_host_status(config_file)

    is_running = data['started']

    # Managed hosts run as persistent processes, so it may already be running
    if is_running:
        host_status = json.loads(data['host']['output'])
        logfile = data['host']['logfile']
    else:
        data = manager.start_host(config_file)
        host_status = json.loads(data['output'])
        logfile = data['logfile']

    host = JSHost(
        status=host_status,
        logfile=logfile,
        config_file=config_file,
        manager=manager
    )

    if not is_running and settings.VERBOSITY >= verbosity.PROCESS_START:
        print('Started {}'.format(host.get_name()))

    if connect_on_start:
        host.connect()

    return host
890821
def prepare_on_all_hosts(self, query, excluded_host, keyspace=None):
        
        futures = []
        for host in tuple(self._pools.keys()):
            if host != excluded_host and host.is_up:
                future = ResponseFuture(self, PrepareMessage(query=query, keyspace=keyspace),
                                            None, self.default_timeout)

                # we don't care about errors preparing against specific hosts,
                # since we can always prepare them as needed when the prepared
                # statement is used.  Just log errors and continue on.
                try:
                    request_id = future._query(host)
                except Exception:
                    log.exception("Error preparing query for host %s:", host)
                    continue

                if request_id is None:
                    # the error has already been logged by ResponsFuture
                    log.debug("Failed to prepare query for host %s: %r",
                              host, future._errors.get(host))
                    continue

                futures.append((host, future))

        for host, future in futures:
            try:
                future.result()
            except Exception:
                log.exception("Error preparing query for host %s:", host)
213176
def start(self):
        '''
        
        '''
        super(Minion, self).start()
        while True:
            try:
                self._real_start()
            except SaltClientError as exc:
                # Restart for multi_master failover when daemonized
                if self.options.daemon:
                    continue
            break
1289742
def unique_hosts(spans)
      hosts = []
      each_endpoint(spans) do |endpoint|
        hosts.push(endpoint)
      end
      hosts.uniq
    end
1024216
void ensurePrestart() {
        int wc = workerCountOf(ctl.get());
        if (wc < corePoolSize)
            addWorker(null, true);
        else if (wc == 0)
            addWorker(null, false);
    }
354113
def disable_host_check(self, host):
        
        if host.active_checks_enabled:
            host.modified_attributes |= DICT_MODATTR["MODATTR_ACTIVE_CHECKS_ENABLED"].value
            host.disable_active_checks(self.daemon.checks)
            self.send_an_element(host.get_update_status_brok())
705739
async def slaveof(self, host=None, port=None):
        
        if host is None and port is None:
            return await self.execute_command('SLAVEOF', b('NO'), b('ONE'))
        return await self.execute_command('SLAVEOF', host, port)
991905
def start(self, hostname=None, port=None):
        
        if hostname is None:
            hostname = settings.settings['mx_host']
        if port is None:
            port = settings.settings['mx_port']

        reloader = False        # use_reloader: the default setting for the reloader.
        debugger = False        #
        evalex = True           # should the exception evaluation feature be enabled?
        threaded = False        # True if each request is handled in a separate thread
        processes = 1           # if greater than 1 then handle each request in a new process
        reloader_interval = 1   # the interval for the reloader in seconds.
        static_files = None     # static_files: optional dict of static files.
        extra_files = None      # extra_files: optional list of extra files to track for reloading.
        ssl_context = None      # ssl_context: optional SSL context for running server in HTTPS mode.

        self.mx_thread = Thread(target=run_simple(hostname=hostname,
                                                  port=port,
                                                  application=self,
                                                  use_debugger=debugger,
                                                  use_evalex=evalex,
                                                  extra_files=extra_files,
                                                  use_reloader=reloader,
                                                  reloader_interval=reloader_interval,
                                                  threaded=threaded,
                                                  processes=processes,
                                                  static_files=static_files,
                                                  ssl_context=ssl_context))
        self.mx_thread.daemon = True
        self.mx_thread.start()
351336
def need(host1, *more)
      sum = more << host1
      # Array doesn't have an 'exists' method, so behold - map reduce wankery!
      unless sum.map { |x| Hosties::HostDefinitions.include? x }.reduce(true) { |xs, x| x & xs }
        raise ArgumentError, "Unrecognized host type"
      end
      @hosts += sum
    end
1030177
private String chooseHost(String[] dbHosts) {
        String host = null;
        synchronized (m_lastHostLock) {
            if (dbHosts.length == 1) {
                host = dbHosts[0];
            } else if (!Utils.isEmpty(m_lastHost)) {
                for (int index = 0; host == null && index < dbHosts.length; index++) {
                    if (dbHosts[index].equals(m_lastHost)) {
                        host = dbHosts[(++index) % dbHosts.length];
                    }
                }
            }
            if (host == null) {
                host = dbHosts[new Random().nextInt(dbHosts.length)];
            }
            m_lastHost = host;
        }
        return host;
    }
118406
def redirect_slaves_to(node)
      @slaves.dup.each do |slave|
        begin
          slave.make_slave!(node)
        rescue NodeUnavailableError
          logger.info("Failed to redirect unreachable slave #{slave} to #{node}")
          force_unavailable_slave(slave)
        end
      end
    end