def run_all(self, resultGenerator, **kwargs):
        "run until all task IDs completed, trap & report all errors"
        errors_in_a_row = 0
        it = resultGenerator(self, **kwargs) # GET ITERATOR FROM GENERATOR
        report_time = time.time()
        self.register() # REGISTER WITH RESOURCE CONTROLLER & COORDINATOR
        initializationError = None
        try: # TRAP ERRORS BOTH IN USER CODE AND coordinator CODE
            while 1:
                try: # TRAP AND REPORT ALL ERRORS IN USER CODE
                    id = it.next() # THIS RUNS USER CODE FOR ONE ITERATION
                    self.success_id = id  # MARK THIS AS A SUCCESS...
                    errors_in_a_row = 0
                    initializationError = False
                except StopIteration: # NO MORE TASKS FOR US...
                    if not hasattr(self, 'serverStopIteration'): # Weird!
                        # USER CODE RAISED StopIteration?!?
                        self.report_error(self.pending_id) # REPORT THE PROBLEM
                        self.exit_message = 'user StopIteration error'
                    elif initializationError:
                        self.exit_message = 'initialization error'
                    else:
                        self.exit_message = 'done'
                    break
                except SystemExit: # sys.exit() CALLED
                    raise  # WE REALLY DO WANT TO EXIT.
                except: # MUST HAVE BEEN AN ERROR IN THE USER CODE
                    if initializationError is None: # STILL IN INITIALIZATION
                        initializationError=True
                    self.report_error(self.pending_id) # REPORT THE PROBLEM
                    errors_in_a_row +=1
                    if errors_in_a_row>=self.max_errors_in_a_row:
                        self.exit_message='too many errors'
                        break
                if time.time()-report_time>self.report_frequency:
                    self.report_load() # SEND A ROUTINE LOAD REPORT
                    report_time=time.time()
        except __HOLE__: # sys.exit() CALLED
            pass  # WE REALLY DO WANT TO EXIT.
        except: # IMPORTANT TO TRAP ALL ERRORS SO THAT WE UNREGISTER!!
            traceback.print_exc(self.max_tb, sys.stderr) #REPORT TB TO OUR LOG
            self.exit_message='error trap'
        self.unregister('run_all '+self.exit_message) # MUST UNREGISTER!!
dataset/ETHPy150Open cjlee112/pygr/pygr/coordinator.py/Processor.run_all