def __init_monitoring(self): """Create the monitoring variables for this workspace.""" get_report = self.agent_tracker.get_report self.create_var(simple_metavariable('agentStatus', get_report)) get_score = self.scoreboard.report self.create_var(simple_metavariable('scoreboard', get_score))
def __init_join_phase(self): """Initialize all variables related to the join phase.""" # Create 'waitForWorkers' var = MetaVariable('waitForWorkers', constant_return(None), cb_handler=self.__wait_for_workers_cb) var.set_handler = self.__status_store self.create_var(var, hidden=True) # Create 'status' var = MetaVariable('status', constant_return(None), cb_handler=self.__status_cb) var.set_handler = self.__status_store self.create_var(var, hidden=True) # Create 'join_status' var = simple_metavariable('join_status', self.__join_phase.get_status) self.create_var(var) # Create 'rankCount' var = simple_metavariable('rankCount', self.__get_num_actual_workers) self.create_var(var) # Create 'workerCount' get_worker_count = self.__worker_count_fetch var = simple_metavariable('workerCount', get_worker_count) var.set_handler = self.__worker_count_store self.create_var(var) # Attach callbacks for the end of the join phase cb0 = lambda n_workers: self.call_hook('group_close_pre', n_workers) cb1 = self.__disarm_status_var cb2 = self.__mark_deadbeat_workers cb3 = self.__clear_saved_broadcast_tasks cb4 = lambda n_workers: self.call_hook('group_close_post', n_workers) self.__join_phase.add_group_close_callback(cb0) self.__join_phase.add_group_close_callback(cb1) self.__join_phase.add_group_close_callback(cb2) self.__join_phase.add_group_close_callback(cb3) self.__join_phase.add_group_close_callback(cb4)