Skip to content

Commit

Permalink
pull gathering team_ids from keystone-interfacing wrappers in favor o…
Browse files Browse the repository at this point in the history
…f searching on the slurm account name
  • Loading branch information
Comeani committed Dec 12, 2024
1 parent df79d86 commit 3771b27
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
9 changes: 4 additions & 5 deletions apps/crc_proposal_end.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
5 changes: 2 additions & 3 deletions apps/crc_sus.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 "
Expand Down
5 changes: 2 additions & 3 deletions apps/crc_usage.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 "
Expand Down

0 comments on commit 3771b27

Please sign in to comment.