def next(self, host, pid, success_id):
        'return next ID from iterator to the XMLRPC caller'
        if (host, pid) not in self.clients:
            print >>sys.stderr, 'next: unknown client %s:%d' % (host, pid)
            return False # HAND BACK "NO MORE FOR YOU TO DO" SIGNAL
        try: # INITIALIZATION DONE, SO REMOVE FROM INITIALIZATION LIST
            del self.clients_initializing[(host, pid)]
        except __HOLE__:
            pass
        if success_id is not False:
            self.report_success(host, pid, success_id)
        if self.done: # EXHAUSTED OUR ITERATOR, SO SHUT DOWN THIS CLIENT
            return False # HAND BACK "NO MORE FOR YOU TO DO" SIGNAL
        try:  # CHECK LIST FOR COMMAND TO SHUT DOWN THIS CLIENT
            del self.stop_clients[(host, pid)] # IS IT IN stop_clients?
            return False # IF SO, HAND BACK "NO MORE FOR YOU TO DO" SIGNAL
        except KeyError: # DO ONE MORE CHECK: ARE WE OVER OUR MAX ALLOWED LOAD?
            if len(self.clients) > self.max_clients:
                # Yes, better throttle down.
                print >>sys.stderr, 'next: halting %s:too many processors \
                        (%d>%d)' % (host, len(self.clients), self.max_clients)
                return False # HAND BACK "NO MORE FOR YOU TO DO" SIGNAL
        for id in self.it: # GET AN ID WE CAN USE
            if str(id) not in self.already_done:
                self.n += 1 # GREAT, WE CAN USE THIS ID
                self.lastID = id
                self.pending[id] = (host, pid, time.time())
                print >>sys.stderr, 'giving id %s to %s:%d' % (str(id),
                                                               host, pid)
                return id
        print >>sys.stderr, 'exhausted all items from iterator!'
        self.done = True # EXHAUSTED OUR ITERATOR
        # Release our claims on any further processor allication
        # and inform the resource controller about it.
        self.priority = 0.0
        self.register()
        return False # False IS CONFORMABLE BY XMLRPC...
dataset/ETHPy150Open cjlee112/pygr/pygr/coordinator.py/Coordinator.next