Skip to content

Commit

Permalink
Fix units and update tests. (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeZiminski authored Dec 18, 2023
1 parent 20dfb03 commit 6e2636e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion slurmio/slurmio.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,6 @@ def _trackable_resources(self) -> dict:

def convert_mem_to_bytes(s):
if s.endswith("G"):
return int(s[:-1]) * 10**6
return int(s[:-1]) * 10**9
else:
return int(s)
4 changes: 2 additions & 2 deletions tests/tests/test_slurmio.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ def test_slurm_environment():
assert 12 == params.allocated_cores
assert 1 == params.requested_nodes
assert 1 == params.allocated_nodes
assert 18000000 == params.requested_memory
assert 18000000 == params.allocated_memory
assert 18 * 1e9 == params.requested_memory
assert 18 * 1e9 == params.allocated_memory
assert "12" == params._trackable_resources["cpu"]
assert "18G" == params._trackable_resources["mem"]
assert "1" == params._trackable_resources["node"]
Expand Down

0 comments on commit 6e2636e

Please sign in to comment.