Skip to content

Commit

Permalink
Fixed key error with collecting existing gpus
Browse files Browse the repository at this point in the history
  • Loading branch information
shouhanzen committed Jan 26, 2024
1 parent be8e7ec commit c72acfb
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/dsmlp/ext/kube.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ def get_gpus_in_namespace(self, name: str) -> int:

gpu_count = 0
for pod in pods.items:
gpu_count += int(pod.spec.containers.resources.requests['GPU_LABEL'])
try:
gpu_count += int(pod.spec.containers.resources.requests['GPU_LABEL'])
except KeyError:
pass

return gpu_count

Expand Down

0 comments on commit c72acfb

Please sign in to comment.