Skip to content
This repository has been archived by the owner on May 14, 2024. It is now read-only.

Commit

Permalink
Adjustments to reduce crc-usage output to <80 characters (#324)
Browse files Browse the repository at this point in the history
Co-authored-by: Nickolas Comeau <[email protected]>
  • Loading branch information
Comeani and Comeani authored Sep 15, 2023
1 parent dd574c4 commit 1372622
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions bank/account_logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -732,10 +732,10 @@ def _build_usage_table(self) -> PrettyTable:
continue

output_table.add_row([f"Cluster: {cluster_name}",
f"Available SUs: {allocation.service_units_total}",""], divider=True)
f"Total SUs: {allocation.service_units_total}",""], divider=True)

# Build a list of individual user usage on the current cluster
output_table.add_row(["User", "SUs Used", "Percentage of Total"], divider=True)
output_table.add_row(["User", "SUs Used", "% Used"], divider=True)
for index, data in enumerate(usage_data.items()):
user = data[0]
user_usage = data[1]
Expand All @@ -757,11 +757,12 @@ def _build_usage_table(self) -> PrettyTable:
usage_percentage = self._calculate_percentage(aggregate_usage_total, allocation_total)

floating_su_percent = self._calculate_percentage(floating_su_usage, floating_su_total)
output_table.add_row(['Floating Service Units', "Units Remaining", "Percent Used"], divider=True)
output_table.add_row([f'**Floating SUs are applied to any cluster to cover usage ',
floating_su_remaining,
floating_su_percent])
output_table.add_row([f'exceeding proposal limits', "", ""], divider=True)
output_table.add_row(['Floating SUs', "SUs Remaining", "% Used"], divider=True)
output_table.add_row([f'*Floating SUs', "", ""])
output_table.add_row([f'are applied on', "", ""])
output_table.add_row([f'any cluster to', str(floating_su_remaining)+'*', floating_su_percent])
output_table.add_row([f'cover usage above', "", ""])
output_table.add_row([f'Total SUs', "", ""], divider=True)

# Add another inner table describing aggregate usage
if not investments:
Expand All @@ -771,11 +772,14 @@ def _build_usage_table(self) -> PrettyTable:
investment_percentage = self._calculate_percentage(aggregate_usage_total,
allocation_total + investment_total)

output_table.add_row(['Investments Total', str(investment_total)+f"\N{ASTERISK}", ""])
output_table.add_row(['Aggregate Usage (excluding investments)', usage_percentage, ""])
output_table.add_row(['Aggregate Usage', investment_percentage, ""])
output_table.add_row([f'\N{ASTERISK}Investment SUs are applied to cover usage ', "",""], divider=True)
output_table.add_row([f'exceeding proposal limits across any cluster',"",""])
output_table.add_row(['Investment SUs', "SUs Remaining", "% Used"], divider=True)
output_table.add_row([f'**Investment SUs', "",""])
output_table.add_row([f'are applied on', "", ""])
output_table.add_row([f'any cluster to', str(investment_total)+"**", investment_percentage])
output_table.add_row([f'cover usage above',"",""])
output_table.add_row([f'Total SUs', "", ""], divider=True)
output_table.add_row(['Aggregate Usage', usage_percentage, ""])
output_table.add_row(['(no investments)', "", ""])

return output_table

Expand Down

0 comments on commit 1372622

Please sign in to comment.