From 2b587ccad4ee992f9d2c52669f65f5b61b7312ce Mon Sep 17 00:00:00 2001 From: Kostas Mavrommatis Date: Fri, 6 Sep 2024 19:57:32 +0200 Subject: [PATCH] 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 --- cwltool/executors.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cwltool/executors.py b/cwltool/executors.py index bfc87f9c7..f069f70a2 100644 --- a/cwltool/executors.py +++ b/cwltool/executors.py @@ -438,7 +438,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(), self.max_cores ) try: jobiter = process.job(job_order_object, self.output_callback, runtime_context)