|
44 | 44 | from .builder import Builder
|
45 | 45 | from .context import RuntimeContext
|
46 | 46 | from .cuda import cuda_check
|
47 |
| -from .errors import UnsupportedRequirement, WorkflowException |
| 47 | +from .errors import UnsupportedRequirement, WorkflowException, WorkflowKillSwitch |
48 | 48 | from .loghandler import _logger
|
49 | 49 | from .pathmapper import MapperEnt, PathMapper
|
50 | 50 | from .process import stage_files
|
@@ -362,14 +362,19 @@ def stderr_stdout_log_path(
|
362 | 362 | processStatus = "permanentFail"
|
363 | 363 |
|
364 | 364 | if processStatus != "success":
|
365 |
| - if rcode < 0: |
| 365 | + if runtimeContext.kill_switch.is_set(): |
| 366 | + return |
| 367 | + elif rcode < 0: |
366 | 368 | _logger.warning(
|
367 | 369 | "[job %s] was terminated by signal: %s",
|
368 | 370 | self.name,
|
369 | 371 | signal.Signals(-rcode).name,
|
370 | 372 | )
|
371 | 373 | else:
|
372 | 374 | _logger.warning("[job %s] exited with status: %d", self.name, rcode)
|
| 375 | + if runtimeContext.on_error == "kill": |
| 376 | + runtimeContext.kill_switch.set() |
| 377 | + raise WorkflowKillSwitch(self.name, rcode) |
373 | 378 |
|
374 | 379 | if "listing" in self.generatefiles:
|
375 | 380 | if self.generatemapper:
|
@@ -400,6 +405,8 @@ def stderr_stdout_log_path(
|
400 | 405 | except WorkflowException as err:
|
401 | 406 | _logger.error("[job %s] Job error:\n%s", self.name, str(err))
|
402 | 407 | processStatus = "permanentFail"
|
| 408 | + except WorkflowKillSwitch: |
| 409 | + raise |
403 | 410 | except Exception:
|
404 | 411 | _logger.exception("Exception while running job")
|
405 | 412 | processStatus = "permanentFail"
|
|
0 commit comments