From 2a97ec6b7f12afc1ced2d23b4fe19d1b006aaa37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20Laurin=20H=C3=B6rmann?= Date: Thu, 7 May 2020 17:21:20 +0200 Subject: [PATCH] ENH: stoppable background tasts by simple set_stop_event method on tasks --- fireworks/core/rocket.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fireworks/core/rocket.py b/fireworks/core/rocket.py index f1d145c52..2afa45f14 100644 --- a/fireworks/core/rocket.py +++ b/fireworks/core/rocket.py @@ -84,6 +84,8 @@ def background_task(btask, spec, stop_event, master_thread): num_launched = 0 while not stop_event.is_set() and master_thread.isAlive(): for task in btask.tasks: + if hasattr(task, 'set_stop_event'): + task.set_stop_event(stop_event) task.run_task(spec) if btask.sleep_time > 0: stop_event.wait(btask.sleep_time)