def wait_for_kb_interrupt(self): try: interruptible_join(self._web_server_thread) except KeyboardInterrupt: self._web_server_thread.stop() finally: self._web_server_thread = None self._report_url = None
def _stop_thread_pool(self): """Stop the thread pool after finish executing testcases.""" self._thread_pool_available = False self._thread_pool_active = False for thread in self._thread_pool: interruptible_join(thread) self._thread_pool = [] self._thread_pool_size = 0 self._interruptible_testcase_queue_join()
def run(self): """ Executes the defined steps and populates the result object. """ try: if self.cfg.interactive_port is not None: if self._ihandler is not None: raise RuntimeError( f"{self} already has an active {self._ihandler}" ) self.logger.test_info("Starting %s in interactive mode", self) self._ihandler = self.cfg.interactive_handler( target=self, http_port=self.cfg.interactive_port ) thread = threading.Thread(target=self._ihandler) # Testplan should exit even if interactive handler thread stuck thread.daemon = True thread.start() # Check if we are on interactive session. if self.cfg.interactive_block: while self._ihandler.active: time.sleep(self.cfg.active_loop_sleep) else: interruptible_join( thread, timeout=self.cfg.abort_wait_timeout ) self.abort() return self._ihandler else: self._run_batch_steps() except Exception as exc: self._result.run = exc self.logger.error(traceback.format_exc()) else: # TODO fix swallow exceptions in self._result.step_results.values() self._result.run = ( self.status == RunnableStatus.FINISHED and self.run_result() is True ) return self._result
def stopping(self): """Stop the executor.""" if self._loop_handler: interruptible_join(self._loop_handler, timeout=self._STOP_TIMEOUT)
def stopping(self): """Stops the worker.""" self._transport.active = False if self._loop_handler: interruptible_join(self._loop_handler)
def stopping(self): """Stops the worker.""" if self._handler: interruptible_join(self._handler) self._handler = None self.status.change(self.STATUS.STOPPED)
def stopping(self): """Stop the executor.""" if self._loop_handler: interruptible_join(self._loop_handler)
def stopping(self): """Stopping the LocalRunner.""" interruptible_join(self._loop_handler)
def stopping(self): """Stops the worker.""" if self._handler: interruptible_join(self._handler) self._handler = None
def wait_for_kb_interrupt(self): try: interruptible_join(self._web_server_thread) except KeyboardInterrupt: self._web_server_thread.stop()