Skip to content

Commit

Permalink
cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-c committed Apr 17, 2024
1 parent 7746701 commit b92527f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
4 changes: 3 additions & 1 deletion cwltool/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ class WorkflowKillSwitch(Exception):
"""When processStatus != "success" and on-error=kill, raise this exception."""

def __init__(self, job_id, rcode):
"""Record the job identifier and the error code."""
self.job_id = job_id
self.rcode = rcode

def __str__(self):
return f'[job {self.job_id}] activated kill switch with return code {self.rcode}'
"""Represent this exception as a string."""
return f"[job {self.job_id}] activated kill switch with return code {self.rcode}"
3 changes: 2 additions & 1 deletion cwltool/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,8 @@ def monitor_kill_switch() -> None:
nonlocal ks_tm
if kill_switch.is_set():
_logger.error("[job %s] terminating by kill switch", self.name)
if sproc.stdin: sproc.stdin.close()
if sproc.stdin:
sproc.stdin.close()
sproc.terminate()
else:
ks_tm = Timer(interval=1, function=monitor_kill_switch)
Expand Down
2 changes: 1 addition & 1 deletion cwltool/task_queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import threading
from typing import Callable, Optional

from .loghandler import _logger
from .errors import WorkflowKillSwitch
from .loghandler import _logger


class TaskQueue:
Expand Down

0 comments on commit b92527f

Please sign in to comment.