Skip to content

Commit

Permalink
fix referencing data section of schema
Browse files Browse the repository at this point in the history
  • Loading branch information
Comeani committed Aug 21, 2024
1 parent 07fdef5 commit be37f41
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions apps/utils/keystone.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@
def get_request_allocations(session: KeystoneClient, request_pk: int) -> dict:
"""Get All Allocation information from keystone for a given request"""

return session.http_get(session.schema.allocations, {'request': request_pk}).json()
return session.http_get(session.schema.data.allocations, {'request': request_pk}).json()


def get_active_requests(session: KeystoneClient, group_pk: int) -> [dict]:
"""Get all active AllocationRequest information from keystone for a given group"""

today = date.today().isoformat()
return session.http_get(session.schema.requests,
return session.http_get(session.schema.data.requests,
{'group': group_pk,
'status': 'AP',
'active__lte': today,
Expand All @@ -37,7 +37,7 @@ def get_researchgroup_id(session: KeystoneClient, account_name: str) -> int:

# Attempt to get the primary key for the ResearchGroup
try:
keystone_group_id = session.http_get(session.schema.research_groups, {'name': account_name}).json()[0]['id']
keystone_group_id = session.http_get(session.schema.data.research_groups, {'name': account_name}).json()[0]['id']

Check notice on line 40 in apps/utils/keystone.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

apps/utils/keystone.py#L40

Line too long (121/120)
except IndexError:
print(f"No Slurm Account found in the accounting system for '{account_name}'. \n"
f"Please submit a ticket to the CRC team to ensure your allocation was properly configured")
Expand All @@ -63,7 +63,7 @@ def get_most_recent_expired_request(session: KeystoneClient, group_pk: int) -> [
"""Get the single most recently expired AllocationRequest information from keystone for a given group"""

today = date.today().isoformat()
return session.http_get(session.schema.requests,
return session.http_get(session.schema.data.requests,
{'group': group_pk,
'status': 'AP',
'ordering': '-expire',
Expand All @@ -74,7 +74,7 @@ def get_enabled_cluster_ids(session: KeystoneClient) -> dict():
"""Get the list of enabled clusters defined in Keystone along with their IDs"""

clusters = {}
for cluster in session.http_get(session.schema.clusters, {'enabled': True}).json():
for cluster in session.http_get(session.schema.data.clusters, {'enabled': True}).json():
clusters[cluster['id']] = cluster['name']

return clusters
Expand Down

0 comments on commit be37f41

Please sign in to comment.