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] authored and unkcpz committed Aug 19, 2024
1 parent faa0ca0 commit e97ac6a
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions aiida_hyperqueue/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
class HyperQueueJobResource(JobResource):
"""Class for HyperQueue job resources."""

_default_fields = ("num_cpus", "memory_mb")
_default_fields = ("num_cpus", "memory_mb", "num_machines", "num_mpiprocs_per_machine")

_features = {
"can_query_by_user": False,
Expand Down Expand Up @@ -58,9 +58,13 @@ def validate_resources(cls, **kwargs):
resources.num_cpus = kwargs.pop("num_cpus")
except KeyError:
try:
resources.num_cpus = kwargs.pop("num_machines") * kwargs.pop("num_mpiprocs_per_machine")
resources.num_cpus = kwargs.pop("num_machines") * kwargs.pop(
"num_mpiprocs_per_machine"
)
except KeyError:
raise KeyError(f"Must specify `num_cpus`, or (`num_machines` and `num_mpiprocs_per_machine`) {kwargs}")
raise KeyError(
f"Must specify `num_cpus`, or (`num_machines` and `num_mpiprocs_per_machine`) {kwargs}"
)
else:
if not isinstance(resources.num_cpus, int):
raise ValueError("`num_cpus` must be an integer")
Expand Down

0 comments on commit e97ac6a

Please sign in to comment.