def state_start(self, execution_history, backward_execution=False, generate_run_id=True): self.execution_history = execution_history if generate_run_id: self._run_id = run_id_generator() self.backward_execution = copy.copy(backward_execution) self.thread = threading.Thread(target=self.run) # !!!!!!!!!!!!! patched line !!!!!!!!!!!!! state_threads.append(self.thread) self.thread.start()
def _patched_run_active_state_machine(self): """Store running state machine and observe its status """ import queue # Create new concurrency queue for root state to be able to synchronize with the execution self._ExecutionEngine__running_state_machine = self.state_machine_manager.get_active_state_machine() self._ExecutionEngine__running_state_machine.root_state.concurrency_queue = queue.Queue(maxsize=0) if self._ExecutionEngine__running_state_machine: self._ExecutionEngine__running_state_machine.start() self._ExecutionEngine__wait_for_finishing_thread = threading.Thread(target=self._wait_for_finishing) # !!!!!!!!!!!!! patched line !!!!!!!!!!!!! state_threads.append(self._ExecutionEngine__wait_for_finishing_thread) self._ExecutionEngine__wait_for_finishing_thread.start() else: logger.warning("Currently no active state machine! Please create a new state machine.") self.set_execution_mode(StateMachineExecutionStatus.STOPPED)