Add option to report only total consumed energy

This commit is contained in:
Jose Gracia 2024-02-23 16:47:51 +01:00
parent dcf88a6da0
commit ba5b2d80f5

View file

@ -17,6 +17,8 @@ def parse_arguments(args):
help="Job did run on Hawk-AI") help="Job did run on Hawk-AI")
parser.add_argument('--report-nodes', action='store_true', parser.add_argument('--report-nodes', action='store_true',
help='Report power of all nodes, not just statisitcs across nodes.') help='Report power of all nodes, not just statisitcs across nodes.')
parser.add_argument('--energy-only', action='store_true',
help='Return only total consumed energy, not detailed power')
parser.add_argument('jobid', type=parse_jobid, parser.add_argument('jobid', type=parse_jobid,
nargs='+', nargs='+',
help='Job ID such as "2260215" or "2260215.hawk-pbs5"') help='Job ID such as "2260215" or "2260215.hawk-pbs5"')
@ -259,6 +261,13 @@ class App:
print('No data found for job ID "{}"'.format(jobid)) print('No data found for job ID "{}"'.format(jobid))
continue continue
if self.config.energy_only:
if power.energy:
print(power.energy)
else:
print('No total energy for job ID "{}"'.format(jobid))
continue
fn = power.to_file(jobid, header) fn = power.to_file(jobid, header)
if fn: if fn:
print('Created file {fn}'.format(fn=fn)) print('Created file {fn}'.format(fn=fn))