From 9cda157cb4380e9d30dec29f0452c56d0c10d064 Mon Sep 17 00:00:00 2001 From: "Michael R. Crusoe" Date: Sat, 2 Nov 2024 10:30:37 +0100 Subject: [PATCH] cpu_count can be None, so fallback to 1 --- cwltool/executors.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cwltool/executors.py b/cwltool/executors.py index 6070462ab..03fa948e7 100644 --- a/cwltool/executors.py +++ b/cwltool/executors.py @@ -273,7 +273,7 @@ def __init__(self) -> None: self.pending_jobs_lock = threading.Lock() self.max_ram = int(psutil.virtual_memory().available / 2**20) - self.max_cores = float(psutil.cpu_count()) + self.max_cores = float(psutil.cpu_count() or 1) self.max_cuda = cuda_version_and_device_count()[1] self.allocated_ram = float(0) self.allocated_cores = float(0) @@ -429,7 +429,7 @@ def run_jobs( logger: logging.Logger, runtime_context: RuntimeContext, ) -> None: - self.taskqueue: TaskQueue = TaskQueue(threading.Lock(), psutil.cpu_count()) + self.taskqueue: TaskQueue = TaskQueue(threading.Lock(), psutil.cpu_count() or 1) try: jobiter = process.job(job_order_object, self.output_callback, runtime_context)