From 3771b273d87b00c4e44cb617754129d0c0d0cbfe Mon Sep 17 00:00:00 2001 From: Comeani Date: Thu, 12 Dec 2024 13:04:40 -0500 Subject: [PATCH] pull gathering team_ids from keystone-interfacing wrappers in favor of searching on the slurm account name --- apps/crc_proposal_end.py | 9 ++++----- apps/crc_sus.py | 5 ++--- apps/crc_usage.py | 5 ++--- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/apps/crc_proposal_end.py b/apps/crc_proposal_end.py index 5890da7..1edb219 100755 --- a/apps/crc_proposal_end.py +++ b/apps/crc_proposal_end.py @@ -37,18 +37,17 @@ def app_logic(self, args: Namespace) -> None: keystone_session.login(username=os.environ["USER"], password=getpass("Please enter your CRCD login password:\n")) - team_id = get_team_id(keystone_session, args.account) - alloc_requests = get_active_requests(keystone_session, team_id) + alloc_requests = get_active_requests(keystone_session, args.account) if not alloc_requests: print(f"\033[91m\033[1mNo active allocation information found in accounting system for '{args.account}'!\n") print("Showing end date for most recently expired Resource Allocation Request:\033[0m \n") try: - alloc_requests = [get_most_recent_expired_request(keystone_session, team_id)] + alloc_requests = [get_most_recent_expired_request(keystone_session, args.account)] except IndexError: print("\033[91m\033[1mNo allocation information found. Either the group does not have any allocations, " - "or you do not have permissions to view them. If you believe this to be a mistake, please submit a " - "help ticket to the CRCD team. \033[0m \n") + "or you do not have permissions to view them. If you believe this to be a mistake, please submit " + "a help ticket to the CRCD team. \033[0m \n") exit() for request in alloc_requests: diff --git a/apps/crc_sus.py b/apps/crc_sus.py index 5cf6d73..d5e6f74 100755 --- a/apps/crc_sus.py +++ b/apps/crc_sus.py @@ -62,15 +62,14 @@ def app_logic(self, args: Namespace) -> None: keystone_session.login(username=os.environ["USER"], password=getpass("Please enter your CRCD login password:\n")) - group_id = get_team_id(keystone_session, args.account) - alloc_requests = get_active_requests(keystone_session, group_id) + alloc_requests = get_active_requests(keystone_session, args.account) if not alloc_requests: print(f"\033[91m\033[1mNo active allocation information found in accounting system for '{args.account}'!\n") print("Showing remaining service unit amounts for most recently expired Resource Allocation Request:" "\033[0m \n") try: - alloc_requests = [get_most_recent_expired_request(keystone_session, group_id)] + alloc_requests = [get_most_recent_expired_request(keystone_session, args.account)] except IndexError: print("\033[91m\033[1mNo allocation information found. Either the group does not have any allocations, " "or you do not have permissions to view them. If you believe this to be a mistake, please submit " diff --git a/apps/crc_usage.py b/apps/crc_usage.py index 1996c5f..6d1daa3 100755 --- a/apps/crc_usage.py +++ b/apps/crc_usage.py @@ -100,14 +100,13 @@ def app_logic(self, args: Namespace) -> None: password=getpass("Please enter your CRCD login password:\n")) # Gather AllocationRequests from Keystone - group_id = get_team_id(keystone_session, args.account) - alloc_requests = get_active_requests(keystone_session, group_id) + alloc_requests = get_active_requests(keystone_session, args.account) if not alloc_requests: print(f"\033[91m\033[1mNo active allocation information found in accounting system for '{args.account}'!\n") print("Attempting to show the most recently expired Resource Allocation Request info: \033[0m \n") try: - alloc_requests = [get_most_recent_expired_request(keystone_session, group_id)] + alloc_requests = [get_most_recent_expired_request(keystone_session, args.account)] except IndexError: print("\033[91m\033[1mNo allocation information found. Either the group does not have any allocations, " "or you do not have permissions to view them. If you believe this to be a mistake, please submit "