Skip to content

Commit 9cda157

Browse files
committed
cpu_count can be None, so fallback to 1
1 parent d810958 commit 9cda157

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cwltool/executors.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ def __init__(self) -> None:
273273
self.pending_jobs_lock = threading.Lock()
274274

275275
self.max_ram = int(psutil.virtual_memory().available / 2**20)
276-
self.max_cores = float(psutil.cpu_count())
276+
self.max_cores = float(psutil.cpu_count() or 1)
277277
self.max_cuda = cuda_version_and_device_count()[1]
278278
self.allocated_ram = float(0)
279279
self.allocated_cores = float(0)
@@ -429,7 +429,7 @@ def run_jobs(
429429
logger: logging.Logger,
430430
runtime_context: RuntimeContext,
431431
) -> None:
432-
self.taskqueue: TaskQueue = TaskQueue(threading.Lock(), psutil.cpu_count())
432+
self.taskqueue: TaskQueue = TaskQueue(threading.Lock(), psutil.cpu_count() or 1)
433433
try:
434434
jobiter = process.job(job_order_object, self.output_callback, runtime_context)
435435

0 commit comments

Comments
 (0)