|
30 | 30 | from .builder import Builder
|
31 | 31 | from .context import RuntimeContext
|
32 | 32 | from .cuda import cuda_check
|
33 |
| -from .errors import UnsupportedRequirement, WorkflowException |
| 33 | +from .errors import UnsupportedRequirement, WorkflowException, WorkflowKillSwitch |
34 | 34 | from .loghandler import _logger
|
35 | 35 | from .pathmapper import MapperEnt, PathMapper
|
36 | 36 | from .process import stage_files
|
@@ -348,14 +348,19 @@ def stderr_stdout_log_path(
|
348 | 348 | processStatus = "permanentFail"
|
349 | 349 |
|
350 | 350 | if processStatus != "success":
|
351 |
| - if rcode < 0: |
| 351 | + if runtimeContext.kill_switch.is_set(): |
| 352 | + return |
| 353 | + elif rcode < 0: |
352 | 354 | _logger.warning(
|
353 | 355 | "[job %s] was terminated by signal: %s",
|
354 | 356 | self.name,
|
355 | 357 | signal.Signals(-rcode).name,
|
356 | 358 | )
|
357 | 359 | else:
|
358 | 360 | _logger.warning("[job %s] exited with status: %d", self.name, rcode)
|
| 361 | + if runtimeContext.on_error == "kill": |
| 362 | + runtimeContext.kill_switch.set() |
| 363 | + raise WorkflowKillSwitch(self.name, rcode) |
359 | 364 |
|
360 | 365 | if "listing" in self.generatefiles:
|
361 | 366 | if self.generatemapper:
|
@@ -386,6 +391,8 @@ def stderr_stdout_log_path(
|
386 | 391 | except WorkflowException as err:
|
387 | 392 | _logger.error("[job %s] Job error:\n%s", self.name, str(err))
|
388 | 393 | processStatus = "permanentFail"
|
| 394 | + except WorkflowKillSwitch: |
| 395 | + raise |
389 | 396 | except Exception:
|
390 | 397 | _logger.exception("Exception while running job")
|
391 | 398 | processStatus = "permanentFail"
|
|
0 commit comments