    def _run_as_thread(self, params:Parameters, direct_params:Parameters, task_run:TaskRun=None):
        """Running the task in a new thread. This method should only
        be run by the new thread."""
        try:
            self.log_running(task_run)
        except TaskLoggingError as exc:
            # Logging failed
            task_run.exception = exc
            try:
                self.log_failure()
            except Exception:
                pass
            # Note that we don't raise the error as there is nothing
            # to catch it
            return
        finally:
            task_run.event_running.set()

        try:
            output = self._run_as_main(params=params, direct_params=direct_params, task_run=task_run, execution="thread")
        except Exception:
            # Task crashed before actually running the execute.
            try:
                self.log_failure()
            except TaskLoggingError as exc:
                task_run.exception = exc
Running the task in a new thread. This method should only
be run by the new thread.
rocketry/core/task.py