Report node power only if requested

This is a hack! Monkey patches class Power :(
This commit is contained in:
Jose Gracia 2024-02-23 16:20:43 +01:00
parent 7f0228a905
commit dcf88a6da0

View file

@ -15,6 +15,8 @@ def parse_arguments(args):
help="Interval between power values in seconds")
parser.add_argument('--hawk-ai', action='store_true',
help="Job did run on Hawk-AI")
parser.add_argument('--report-nodes', action='store_true',
help='Report power of all nodes, not just statisitcs across nodes.')
parser.add_argument('jobid', type=parse_jobid,
nargs='+',
help='Job ID such as "2260215" or "2260215.hawk-pbs5"')
@ -99,7 +101,6 @@ class Power:
hd = "# all timestamp have unit miliseconds since unix epoch\n"
hd += "# all power values have unit Watt\n"
hd += "timestamp,RESERVED,head_node_power,avg_node_power,median_node_power,min_node_power,max_node_power,std_dev_sample_node_power"
# add node names here instead
hd += "," + ",".join(self.nodes)
hd += "\n"
return hd
@ -228,6 +229,9 @@ class App:
def __init__(self, config):
self.config = config
self.db = MonitoringDB(self.config.verbose)
if not self.config.report_nodes:
# Monkey patching class Power; what a hack!
Power._all_values = lambda s,x: ""
@staticmethod
def warnings(config):