def expand_node(self, node, gstate, action): logging.debug("--------- Expanding node %s %s ------------", node.uid, gstate) if self.debug_compare_states is not None and node.uid in self.debug_compare_states: if self.debug_captured_states is None: self.debug_captured_states = [] self.debug_captured_states.append(gstate.copy()) gcontext = GlobalContext(self, node, gstate) if action: action.apply_action(gcontext) self.fast_expand_node(gcontext) if not gcontext.make_node(): gstate.dispose() return if not self.slow_expand(gcontext): node = gcontext.node if any(state.status != State.StatusFinished for state in gstate.states): active_pids = [state.pid for state in gstate.states if state.status != State.StatusFinished] gcontext = GlobalContext(self, node, gstate) message = errormsg.Deadlock(None, gcontext=gcontext, active_pids=active_pids) gcontext.add_error_and_throw(message) else: gstate.mpi_leak_check(self, node) node.allocations = sum((state.allocations for state in gstate.states), []) gstate.dispose()
def continue_in_execution(self): if self.fast_expand(): return True gcontext = self.gcontext gstate = gcontext.gstate # We will plan some computation but leaving this function, # current gcontext is finished self.gcontext = None if not gcontext.make_node(): gcontext.gstate.dispose() # Node already explored return False if not self.slow_expand(gcontext): node = gcontext.node if any(state.status != State.StatusFinished for state in gstate.states): active_pids = [state.pid for state in gstate.states if state.status != State.StatusFinished] gcontext = GlobalContext(self, node, gstate) message = errormsg.Deadlock(None, gcontext=gcontext, active_pids=active_pids) gcontext.add_error_and_throw(message) else: gstate.mpi_leak_check(self, node) node.allocations = sum((state.allocations for state in gstate.states), []) gstate.dispose() return False """