Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Nov 9, 2024
1 parent d540f15 commit c859e07
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
13 changes: 10 additions & 3 deletions executorlib/interactive/shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,10 @@ def _get_backend_path(


def _wait_for_free_slots(
active_task_dict: dict, cores_requested: int, max_cores: Optional[int] = None, max_workers: Optional[int] = None,
active_task_dict: dict,
cores_requested: int,
max_cores: Optional[int] = None,
max_workers: Optional[int] = None,
) -> dict:
"""
Wait for available computing resources to become available.
Expand All @@ -414,10 +417,14 @@ def _wait_for_free_slots(
"""
if max_cores is not None:
while sum(active_task_dict.values()) + cores_requested > max_cores:
active_task_dict = {k: v for k, v in active_task_dict.items() if not k.done()}
active_task_dict = {
k: v for k, v in active_task_dict.items() if not k.done()
}
elif max_workers is not None and max_cores is None:
while len(active_task_dict.values()) + 1 > max_workers:
active_task_dict = {k: v for k, v in active_task_dict.items() if not k.done()}
active_task_dict = {
k: v for k, v in active_task_dict.items() if not k.done()
}
return active_task_dict


Expand Down
4 changes: 3 additions & 1 deletion executorlib/standalone/inputcheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,9 @@ 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, set_local_cores: bool = False,
max_cores: Optional[int] = None,
max_workers: Optional[int] = None,
set_local_cores: bool = False,
) -> int:
"""
Validate the number of cores and return the appropriate value.
Expand Down

0 comments on commit c859e07

Please sign in to comment.