From 4ec9b6a72e8d501a22719f5af77e2109be5e6049 Mon Sep 17 00:00:00 2001 From: MaximeVdB Date: Thu, 20 Aug 2020 10:18:54 +0200 Subject: [PATCH 1/2] Fix parsing of multiline exec_host in qstat output The exec_host field in the qstat output may span multiple lines as the number of compute nodes gets larger, like this: exec_host = r26i13n04/0-35+r26i13n07/0-35+r26i13n19/0-35+r25i13n15/0-35+r2 5i13n18/0-35+r25i27n03/0-35+r25i27n04/0-35+r25i27n05/0-35+r25i27n07/0- 35+r25i27n08/0-35+r25i27n10/0-35+r25i27n11/0-35+r25i27n23/0-35 Before this commit, only the first line would be parsed, and hence the node list would be incomplete at best. --- reframe/core/schedulers/torque.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/reframe/core/schedulers/torque.py b/reframe/core/schedulers/torque.py index 5504fb605a..f624e9e5b1 100644 --- a/reframe/core/schedulers/torque.py +++ b/reframe/core/schedulers/torque.py @@ -61,10 +61,12 @@ def _update_state(self, job): raise JobError('qstat failed: %s' % completed.stderr, job.jobid) nodelist_match = re.search( - r'exec_host = (?P\S+)', completed.stdout + re.compile(r'exec_host = (?P[\S\t\n]+)', re.MULTILINE), + completed.stdout ) if nodelist_match: nodespec = nodelist_match.group('nodespec') + nodespec = re.sub(r'[\n\t]*', '', nodespec) self._set_nodelist(job, nodespec) state_match = re.search( From 3194e4772713361ca624cee5b453792557fc7b92 Mon Sep 17 00:00:00 2001 From: Vasileios Karakasis Date: Fri, 21 Aug 2020 13:11:44 +0200 Subject: [PATCH 2/2] Address PR comments --- reframe/core/schedulers/torque.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/reframe/core/schedulers/torque.py b/reframe/core/schedulers/torque.py index f624e9e5b1..771e48769f 100644 --- a/reframe/core/schedulers/torque.py +++ b/reframe/core/schedulers/torque.py @@ -61,8 +61,9 @@ def _update_state(self, job): raise JobError('qstat failed: %s' % completed.stderr, job.jobid) nodelist_match = re.search( - re.compile(r'exec_host = (?P[\S\t\n]+)', re.MULTILINE), - completed.stdout + r'exec_host = (?P[\S\t\n]+)', + completed.stdout, + re.MULTILINE ) if nodelist_match: nodespec = nodelist_match.group('nodespec')