Skip to content

Commit 6ee057e

Browse files
committed
fix unit test and expand logic to memory and vcpu field
1 parent 3b15a68 commit 6ee057e

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/sagemaker/hyperpod/training/quota_allocation_util.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,9 @@
139139

140140
def _has_compute_resource_quota_allocation_resources(memory_in_gib: Optional[float], vcpu: Optional[float], accelerators: Optional[int]) -> bool:
141141
return (
142-
(memory_in_gib is not None) or
143-
(vcpu is not None ) or
144-
(accelerators is not None and accelerators > 0) # Fix: treat accelerators=0 as not specified
142+
(memory_in_gib is not None and memory_in_gib > 0) or
143+
(vcpu is not None and vcpu > 0) or
144+
(accelerators is not None and accelerators > 0)
145145
)
146146

147147
# Gets resources from compute quotas that user provided; if not all provided, calculates defaults.

test/unit_tests/cli/test_quota_allocation_util.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,10 @@ class TestQuotaAllocationUtil:
5252
(16.0, None, 2, True),
5353
(None, 4.0, 2, True),
5454
(16.0, 4.0, 2, True),
55-
# Zero values
56-
(0, None, None, True),
57-
(None, 0, None, True),
58-
(None, None, 0, True),
55+
# Zero values - all zeros treated as not specified for consistency
56+
(0, None, None, False),
57+
(None, 0, None, False),
58+
(None, None, 0, False),
5959
]
6060
)
6161
def test_has_gpu_quota_allocation_resources(self, memory_in_gib, vcpu, accelerators, expected):

0 commit comments

Comments
 (0)