Skip to content

Commit

Permalink
AWSED return the value as string, converted to INT for ease of use
Browse files Browse the repository at this point in the history
  • Loading branch information
trn024 committed Aug 29, 2024
1 parent 071a762 commit e063c8d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/dsmlp/ext/awsed.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,10 @@ def get_user_gpu_quota(self, username: str) -> int:
usrGpuQuota = self.client.get_user_quota(username)
if not usrGpuQuota:
return None
gpu_quota = usrGpuQuota['resources'].get("nvidia.com/gpu", 0) # Access the correct attribute
gpu_quota = usrGpuQuota['resources'].get("nvidia.com/gpu", "0") # Access the correct attribute
gpu_quota = int(gpu_quota) # convert string to INT according AWSED JSON return
quota = Quota(user=username, resources={"nvidia.com/gpu": gpu_quota})
UserQuotaResponse(quota=quota)
response = UserQuotaResponse(quota=quota)
return gpu_quota
except Exception as e:
self.logger.error(f"Failed to fetch GPU quota for user {username}: {e}")
Expand Down

0 comments on commit e063c8d

Please sign in to comment.