Exemple #1
0
 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
Exemple #2
0
    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()
Exemple #3
0
    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
Exemple #4
0
 def stopping(self):
     """Stop the executor."""
     if self._loop_handler:
         interruptible_join(self._loop_handler, timeout=self._STOP_TIMEOUT)
Exemple #5
0
 def stopping(self):
     """Stops the worker."""
     self._transport.active = False
     if self._loop_handler:
         interruptible_join(self._loop_handler)
Exemple #6
0
 def stopping(self):
     """Stops the worker."""
     if self._handler:
         interruptible_join(self._handler)
     self._handler = None
     self.status.change(self.STATUS.STOPPED)
Exemple #7
0
 def stopping(self):
     """Stop the executor."""
     if self._loop_handler:
         interruptible_join(self._loop_handler)
Exemple #8
0
 def stopping(self):
     """Stopping the LocalRunner."""
     interruptible_join(self._loop_handler)
Exemple #9
0
 def stopping(self):
     """Stops the worker."""
     if self._handler:
         interruptible_join(self._handler)
     self._handler = None
Exemple #10
0
 def wait_for_kb_interrupt(self):
     try:
         interruptible_join(self._web_server_thread)
     except KeyboardInterrupt:
         self._web_server_thread.stop()