From b92527fc3d92f5b874437b13f7014e1349d2c61c Mon Sep 17 00:00:00 2001 From: "Michael R. Crusoe" Date: Wed, 17 Apr 2024 09:48:25 +0200 Subject: [PATCH] cleanups --- cwltool/errors.py | 4 +++- cwltool/job.py | 3 ++- cwltool/task_queue.py | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/cwltool/errors.py b/cwltool/errors.py index 361853cdb5..f402633779 100644 --- a/cwltool/errors.py +++ b/cwltool/errors.py @@ -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}" diff --git a/cwltool/job.py b/cwltool/job.py index 3c27d2c417..02288cab03 100644 --- a/cwltool/job.py +++ b/cwltool/job.py @@ -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) diff --git a/cwltool/task_queue.py b/cwltool/task_queue.py index fbd441e01e..51c4dfbb3e 100644 --- a/cwltool/task_queue.py +++ b/cwltool/task_queue.py @@ -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: