From 11f334d2b449dfee5ec37419252c0912560a6584 Mon Sep 17 00:00:00 2001 From: Jose Gracia Date: Thu, 15 Feb 2024 11:06:54 +0100 Subject: [PATCH] Improve parsing of job IDs --- monitoring/db/scripts/get_detailed_power.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/monitoring/db/scripts/get_detailed_power.py b/monitoring/db/scripts/get_detailed_power.py index f60bdd0..733c145 100755 --- a/monitoring/db/scripts/get_detailed_power.py +++ b/monitoring/db/scripts/get_detailed_power.py @@ -25,7 +25,8 @@ def parse_jobid(s): import re hawkpbs = r'.hawk-pbs5' jobid = re.sub(hawkpbs, '', s) - if not jobid.isdigit(): + not_allowed = r'[^0-9\[\]]' # Jobid can be more complex than just digits, eg 2444420[201] + if re.search(not_allowed, jobid): raise argparse.ArgumentTypeError(f'invalid job ID "{s}"') return jobid