diff --git a/reframe/core/schedulers/slurm.py b/reframe/core/schedulers/slurm.py index 6adacd47f6..5c3a29dce1 100644 --- a/reframe/core/schedulers/slurm.py +++ b/reframe/core/schedulers/slurm.py @@ -90,12 +90,16 @@ class SlurmJobScheduler(sched.JobScheduler): # standard job state polling using sacct. SACCT_SQUEUE_RATIO = 10 - # This matches the format for both normal jobs as well as job arrays. + # This matches the format for both normal and heterogeneous jobs, + # as well as job arrays. + # For heterogeneous jobs, the job_id has the following format: + # + + # (https://slurm.schedmd.com/heterogeneous_jobs.html) # For job arrays the job_id has one of the following formats: # * _ # * _[-] - # See (`Job Array Support{self._state_patt})\|(?P\S+)([^\|]*)\|' + fr'^(?P{self._jobid_patt})\|(?P\S+)([^\|]*)\|' fr'(?P\d+)\:(?P\d+)\|(?P\S+)\|' fr'(?P.*)', completed.stdout, re.MULTILINE) ) @@ -418,7 +422,8 @@ def poll(self, *jobs): job_info = {} for s in state_match: - jobid = s.group('jobid').split('_')[0] + # Take into account both job arrays and heterogeneous jobs + jobid = re.split(r'_|\+', s.group('jobid'))[0] job_info.setdefault(jobid, []).append(s) for job in jobs: @@ -427,7 +432,7 @@ def poll(self, *jobs): except KeyError: continue - # Join the states with ',' in case of job arrays + # Join the states with ',' in case of job arrays|heterogeneous jobs job._state = ','.join(m.group('state') for m in jobarr_info) if not self._update_state_count % self.SACCT_SQUEUE_RATIO: @@ -574,7 +579,7 @@ def poll(self, *jobs): # We need the match objects, so we have to use finditer() state_match = list(re.finditer( - fr'^(?P{self._state_patt})\|(?P\S+)\|' + fr'^(?P{self._jobid_patt})\|(?P\S+)\|' fr'(?P\S*)\|(?P.+)', completed.stdout, re.MULTILINE) )