Skip to content

Commit

Permalink
Add logging to the AWSED.py file in ext to test API functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
trn024 committed Aug 27, 2024
1 parent 0c40043 commit c0abaf4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/dsmlp/app/gpu_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ def determine_gpu_quota(self, awsed_quota, kube_client_quota):
default_gpu_quota = awsed_quota
elif kube_client_quota is not None and kube_client_quota > 0:
default_gpu_quota = kube_client_quota

return default_gpu_quota

def validate_pod(self, request: Request):
Expand Down
6 changes: 5 additions & 1 deletion src/dsmlp/ext/awsed.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@

import awsed.client
import awsed.types
import logging

# added logging to check if API has an error getting GPU quota
logging.basicConfig(level=logging.ERROR, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
class ExternalAwsedClient(AwsedClient):
def __init__(self):
self.client = awsed.client.DefaultAwsedClient(endpoint=os.environ.get('AWSED_ENDPOINT'),
Expand Down Expand Up @@ -37,5 +40,6 @@ def get_user_gpu_quota(self, username: str) -> UserQuotaResponse:
gpu_quota = usrGpuQuota.get("gpu", 0)
quota = Quota(user=username, resources=gpu_quota)
return UserQuotaResponse(quota=quota)
except:
except Exception as e:
self.logger.error(f"Failed to fetch GPU quota for user {username}: {e}")
return None

0 comments on commit c0abaf4

Please sign in to comment.