Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jan-janssen committed Nov 9, 2024
1 parent c859e07 commit 28e214a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
3 changes: 3 additions & 0 deletions executorlib/interactive/executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions executorlib/standalone/inputcheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
"""
Expand Down
11 changes: 6 additions & 5 deletions tests/test_shared_input_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
)

0 comments on commit 28e214a

Please sign in to comment.