From 6ff52227ef7a8f97cb7e430b8ae7c5e51e58a482 Mon Sep 17 00:00:00 2001 From: Jose Gracia Date: Wed, 22 Nov 2023 14:35:19 +0100 Subject: [PATCH] Decouple argument parser from sys.argv --- monitoring/db/scripts/get_detailed_power.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/monitoring/db/scripts/get_detailed_power.py b/monitoring/db/scripts/get_detailed_power.py index 60b8232..fa2cf60 100644 --- a/monitoring/db/scripts/get_detailed_power.py +++ b/monitoring/db/scripts/get_detailed_power.py @@ -4,7 +4,7 @@ from collections import OrderedDict import os.path -def parse_arguments(): +def parse_arguments(args): parser = argparse.ArgumentParser( description='Produce detailed power usage data for a list of jobids.') parser.add_argument('-v', '--verbose', action='store_true', @@ -13,7 +13,7 @@ def parse_arguments(): nargs='+', help='Job ID such as "2260215" or "2260215.hawk-pbs5"') - return parser.parse_args() + return parser.parse_args(args) def parse_jobid(s): import re @@ -204,8 +204,8 @@ class App: if __name__ == "__main__": - config = parse_arguments() - config.interval = 5 + import sys + config = parse_arguments(sys.argv[1:]) main = App(config) main.run_all()