diff --git a/executorlib/interactive/executor.py b/executorlib/interactive/executor.py index 6e55ae5a..9dee5abd 100644 --- a/executorlib/interactive/executor.py +++ b/executorlib/interactive/executor.py @@ -220,6 +220,7 @@ def create_executor( max_workers=validate_number_of_cores( max_cores=max_cores, max_workers=max_workers, + cores_per_worker=cores_per_worker, set_local_cores=False, ), executor_kwargs=resource_dict, @@ -241,6 +242,7 @@ def create_executor( max_workers=validate_number_of_cores( max_cores=max_cores, max_workers=max_workers, + cores_per_worker=cores_per_worker, set_local_cores=False, ), executor_kwargs=resource_dict, @@ -270,6 +272,7 @@ def create_executor( max_workers=validate_number_of_cores( max_cores=max_cores, max_workers=max_workers, + cores_per_worker=cores_per_worker, set_local_cores=True, ), executor_kwargs=resource_dict, diff --git a/executorlib/standalone/inputcheck.py b/executorlib/standalone/inputcheck.py index d776cf6b..040bbe51 100644 --- a/executorlib/standalone/inputcheck.py +++ b/executorlib/standalone/inputcheck.py @@ -172,6 +172,7 @@ def check_pysqa_config_directory(pysqa_config_directory: Optional[str]) -> None: def validate_number_of_cores( max_cores: Optional[int] = None, max_workers: Optional[int] = None, + cores_per_worker: Optional[int] = None, set_local_cores: bool = False, ) -> int: """ diff --git a/tests/test_shared_input_check.py b/tests/test_shared_input_check.py index 44f5e599..21cc089d 100644 --- a/tests/test_shared_input_check.py +++ b/tests/test_shared_input_check.py @@ -98,12 +98,13 @@ def test_check_pysqa_config_directory(self): check_pysqa_config_directory(pysqa_config_directory="path/to/config") def test_validate_number_of_cores(self): + with self.assertRaises(ValueError): + validate_number_of_cores(max_cores=None, max_workers=None, cores_per_worker=None) + with self.assertRaises(TypeError): + validate_number_of_cores(max_cores=1, max_workers=None, cores_per_worker=None) self.assertIsInstance( - validate_number_of_cores(max_cores=None, max_workers=None), int - ) - self.assertIsInstance( - validate_number_of_cores(max_cores=1, max_workers=None), int + validate_number_of_cores(max_cores=1, max_workers=None, cores_per_worker=1), int ) self.assertIsInstance( - validate_number_of_cores(max_cores=None, max_workers=1), int + validate_number_of_cores(max_cores=None, max_workers=1, cores_per_worker=None), int )