Skip to content

Commit b000b33

Browse files
AlexTatemr-c
authored andcommitted
When the WorkflowKillSwitch exception reaches the TaskQueue, try to prevent pending tasks from starting by simply draining the queue. This is a very loose policy, but since kill switch response is handled at the job level, any tasks that start after the kill switch is activated will take care of themselves and self terminate
1 parent 86b58fc commit b000b33

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

cwltool/task_queue.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from typing import Callable, Optional
99

1010
from .loghandler import _logger
11+
from .errors import WorkflowKillSwitch
1112

1213

1314
class TaskQueue:
@@ -55,6 +56,9 @@ def _task_queue_func(self) -> None:
5556
return
5657
try:
5758
task()
59+
except WorkflowKillSwitch:
60+
self.drain()
61+
break
5862
except BaseException as e: # noqa: B036
5963
_logger.exception("Unhandled exception running task", exc_info=e)
6064
self.error = e

0 commit comments

Comments
 (0)