def start_client(self, host):
        "start a processor on a client node"
        import tempfile
        if len(self.clients) >= self.ncpu_limit:
            print >>sys.stderr, 'start_client: blocked, CPU limit', \
                  len(self.clients), self.ncpu_limit
            return # DON'T START ANOTHER PROCESS, TOO MANY ALREADY
        if len(self.clients) >= self.max_clients:
            print >>sys.stderr, 'start_client: blocked, too many already', \
                  len(self.clients), self.max_clients
            return # DON'T START ANOTHER PROCESS, TOO MANY ALREADY
        try:
            if len(self.clients_starting[host]) >= self.max_ssh_errors:
                print >>sys.stderr, \
                      'start_client: blocked, too many unstarted jobs:', \
                      host, self.clients_starting[host]
                return # DON'T START ANOTHER PROCESS, host MAY BE DEAD...
        except KeyError: # NO clients_starting ON host, GOOD!
            pass
        try:
            if len(self.initialization_errors[host]) >= \
               self.max_initialization_errors:
                print >>sys.stderr, 'start_client: blocked, too many \
                        initialization errors:', host, \
                        self.initialization_errors[host]
                return # DON'T START ANOTHER PROCESS, host HAS A PROBLEM
        except KeyError: # NO initialization_errors ON host, GOOD!
            pass
        try:
            sshopts = self.hosts[host].sshopts # GET sshopts VIA XMLRPC
        except __HOLE__:
            sshopts = ''
        logfile = os.path.join(tempfile.gettempdir(), '%s_%d.log' \
                               % (self.name, self.iclient))
        # PASS OUR KWARGS ON TO THE CLIENT PROCESSOR
        kwargs = ' '.join(['--%s=%s' % (k, v) for k, v in self.kwargs.items()])
        cmd = 'cd %s;%s %s --url=http://%s:%d --rc_url=%s --logfile=%s %s %s' \
             % (self.dir, self.python, self.script, self.host, self.port,
                self.rc_url, logfile, self.name, kwargs)
        # UGH, HAVE TO MIX CSH REDIRECTION (REMOTE) WITH SH REDIRECTION (LOCAL)
        ssh_cmd = "ssh %s %s '(%s) </dev/null >&%s &' </dev/null >>%s 2>&1 &" \
                 % (sshopts, host, cmd, logfile, self.errlog)
        print >>sys.stderr, 'SSH: ' + ssh_cmd
        self.logfile[logfile] = [host, False, self.iclient] # NO PID YET
        try: # RECORD THIS CLIENT AS STARTING UP
            self.clients_starting[host][self.iclient] = time.time()
        except KeyError: # CREATE A NEW HOST ENTRY
            self.clients_starting[host] = {self.iclient: time.time()}
        # RUN SSH IN BACKGROUND TO AVOID WAITING FOR IT TO TIMEOUT!!!
        os.system(ssh_cmd) # LAUNCH THE SSH PROCESS, SHOULD RETURN IMMEDIATELY
        self.iclient += 1 # ADVANCE OUR CLIENT COUNTER
dataset/ETHPy150Open cjlee112/pygr/pygr/coordinator.py/Coordinator.start_client