def __init__(self, name, script, it, resources, port=8888, priority=1.0,
                 rc_url=None, errlog=False, immediate=False,
                 ncpu_limit=999999, demand_ncpu=0, max_initialization_errors=3,
                 **kwargs):
        self.name = name
        self.script = script
        self.it = iter(it) # Make sure self.it is an iterator.
        self.resources = resources
        self.priority = priority
        self.errlog = errlog
        self.immediate = immediate
        self.ncpu_limit = ncpu_limit
        self.demand_ncpu = demand_ncpu
        self.max_initialization_errors = max_initialization_errors
        self.kwargs = kwargs
        self.host = get_hostname()
        self.user = os.environ['USER']
        try:
            # Make sure ssh-agent is available before we launch
            # a lot of processes.
            a = os.environ['SSH_AGENT_PID']
        except KeyError:
            raise OSError(1, 'SSH_AGENT_PID not found. No ssh-agent running?')
        self.dir = os.getcwd()
        self.n = 0
        self.nsuccess = 0
        self.nerrors = 0
        self.nssh_errors = 0
        self.iclient = 0
        self.max_clients = 40
        if rc_url is None:
            # Try the default resource-controller address on the same host.
            rc_url = 'http://%s:5000' % self.host
        self.rc_url = rc_url
        # Connect to the resource controller...
        self.rc_server = xmlrpclib.ServerProxy(rc_url)
        # ...create an XMLRPC server.
        self.server, self.port = get_server(self.host, port)
        # ...and provide it with all the methods.
        self.server.register_instance(self)
        self.clients = {}
        self.pending = {}
        self.already_done = {}
        self.stop_clients = {}
        self.logfile = {}
        self.clients_starting = {}
        self.clients_initializing = {}
        self.initialization_errors = {}
        try: # LOAD LIST OF IDs ALREADY SUCCESSFULLY PROCESSED, IF ANY
            f = file(name + '.success', 'rU') # text file
            for line in f:
                self.already_done[line.strip()] = None
            f.close()
        except __HOLE__: # OK IF NO SUCCESS FILE YET, WE'LL CREATE ONE.
            pass
        # Success file is to be cumulative but overwrite the error file.
        self.successfile = file(name + '.success', 'a')
        self.errorfile = file(name + '.error', 'w')
        self.done = False
        self.hosts = DictAttrProxy(self.rc_server.get_hostinfo)
        self.register()
dataset/ETHPy150Open cjlee112/pygr/pygr/coordinator.py/Coordinator.__init__