Skip to content

Commit 2b587cc

Browse files
authored
Update executors.py
The class TascQueue accepts an argument `thread_count` that is used for the max size of a queue. In the `MultithreadedJobExecutor `class there is a variable defined (`max_cores`) that is getting its value from the available cores of the machine. Further down in the same class when TaskQueue is called instead of using the `max_cores` it is using `psutil.cpu_count()`. I suggest to use the self.max_cores in the call of TaskQueue in the file executor.py instead of psutil.cpu_count() Use case: when a job executor is setup as MultithreadedJobExecutor one can override the max_cores after the initialization of the object and limit the use to the specified cores. Additional enhancement would be to include an argument to allow the use to provide the number of cores available for use
1 parent 6d8c2a4 commit 2b587cc

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

cwltool/executors.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ def run_jobs(
438438
logger: logging.Logger,
439439
runtime_context: RuntimeContext,
440440
) -> None:
441-
self.taskqueue: TaskQueue = TaskQueue(threading.Lock(), psutil.cpu_count())
441+
self.taskqueue: TaskQueue = TaskQueue(threading.Lock(), self.max_cores )
442442
try:
443443
jobiter = process.job(job_order_object, self.output_callback, runtime_context)
444444

0 commit comments

Comments
 (0)