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

Commit

Permalink
Do not skip zero usage clusters if they have an award (#332)
Browse files Browse the repository at this point in the history
  • Loading branch information
Comeani authored Sep 19, 2023
1 parent 1372622 commit 15c9b51
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions bank/account_logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -709,28 +709,38 @@ def _build_usage_table(self) -> PrettyTable:
floating_su_remaining = 0

for allocation in proposal.allocations:

# Skip any cluster that does not have service units awarded on it
if not allocation.service_units_total:
continue

cluster_name = str.upper(allocation.cluster_name)

# Determine whether or not there is a floating allocation
if allocation.cluster_name == 'all_clusters':
floating_su_usage = allocation.service_units_used
floating_su_total = allocation.service_units_total
floating_su_remaining = floating_su_total - floating_su_usage
continue

# Gather usage data from sreport
usage_data = slurm_acct.get_cluster_usage_per_user(cluster=allocation.cluster_name,
start=proposal.start_date,
end=proposal.end_date,
in_hours=True)

# Skip if usage data is empty on the cluster


# Skip displaying usage data if there is none, just show cluster total
if not usage_data:
output_table.add_row([f"Cluster: {cluster_name}",
f"Total SUs: {allocation.service_units_total}",""], divider=True)
output_table.add_row(["", "", ""], divider=True)
continue

total_usage_on_cluster = sum(usage_data.values())
total_cluster_percent = self._calculate_percentage(total_usage_on_cluster,
allocation.service_units_total)
cluster_name = str.upper(allocation.cluster_name)
if not allocation.service_units_total:
continue

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

Expand Down

1 comment on commit 15c9b51

@chnixi
Copy link
Contributor

@chnixi chnixi commented on 15c9b51 Sep 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! Does this also fix the smp display issue for suh33, see also #331

Please sign in to comment.