aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVolker Hoffmann <volker@cheleb.net>2015-08-25 23:33:17 +0200
committerVolker Hoffmann <volker@cheleb.net>2015-08-25 23:33:17 +0200
commit2ed8948c84cec1912bc84e5078210521b9f1ffe8 (patch)
tree0295df497937c52085ea8c4419c5276e0edb1bce
parent8b1be28eab48457806a051ad7807c9ef0b9368d7 (diff)
feat: aggregate over all partitions for node and job states
-rw-r--r--Common/slurm.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/Common/slurm.py b/Common/slurm.py
index 004cd63..3ff13fc 100644
--- a/Common/slurm.py
+++ b/Common/slurm.py
@@ -44,6 +44,12 @@ def get_number_of_nodes_down():
running_sum += number_of_nodes_down["%s" % partition]
number_of_nodes_down['gpu'] = running_sum
+ # Aggregate All Counts
+ running_sum = 0
+ for partition in partitions:
+ running_sum += number_of_nodes_down["%s" % partition]
+ number_of_nodes_down['all'] = running_sum
+
# Fake Data
# number_of_nodes_down = \
# {'cpu': 15,
@@ -145,6 +151,15 @@ def get_number_of_jobs_by_partition_and_state():
number_of_jobs_by_state[state] = total
number_of_jobs_by_partition['gpu'] = number_of_jobs_by_state
+ # Aggregate All Counts
+ number_of_jobs_by_state = {}
+ for state in states:
+ total = 0
+ for partition in partitions:
+ total += number_of_jobs_by_partition[partition][state]
+ number_of_jobs_by_state[state] = total
+ number_of_jobs_by_partition['all'] = number_of_jobs_by_state
+
# Fake Data
# number_of_jobs_by_partition = \
# {'cpu': {'pending': 0, 'running': 465},