diff --git a/sisyphus/worker.py b/sisyphus/worker.py index 54e77b3..6fa51e3 100644 --- a/sisyphus/worker.py +++ b/sisyphus/worker.py @@ -57,7 +57,7 @@ def __init__(self, job, task, task_id): self.task = task self.task_id = task_id self.start_time = None - super().__init__() + super().__init__(daemon=True) self.out_of_memory = False self._cond = Condition() self.__stop = False @@ -248,5 +248,8 @@ def worker_helper(args): if hasattr(task._job, "_sis_environment") and task._job._sis_environment: task._job._sis_environment.modify_environment() - # run task - task.run(task_id, resume_job, logging_thread=logging_thread) + try: + # run task + task.run(task_id, resume_job, logging_thread=logging_thread) + finally: + logging_thread.stop()