Skip to content

Commit

Permalink
Perform sorting at in wrapper until sorting at the level of the reque…
Browse files Browse the repository at this point in the history
…st filter works
  • Loading branch information
Comeani committed Oct 15, 2024
1 parent 849ce5e commit 82596b1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions apps/utils/keystone.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ 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.retrieve_request(
filters={'group': group_pk, 'status': 'AP', 'ordering': '-expire', 'expire__lte': today})[0]
requests = session.retrieve_request(filters={'group': group_pk, 'status': 'AP', 'expire__lte': today})
return sorted(requests, key=lambda request: request['expire'], reverse=True)[0]


def get_enabled_cluster_ids(session: KeystoneClient) -> dict():
Expand Down

0 comments on commit 82596b1

Please sign in to comment.