Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions reframe/core/schedulers/torque.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@
class TorqueJobScheduler(PbsJobScheduler):
TASKS_OPT = '-l nodes={num_nodes}:ppn={num_cpus_per_node}'

def _set_nodelist(self, job, nodespec):
if job.nodelist is not None:
return

job.nodelist = [x.split('/')[0] for x in nodespec.split('+')]
job.nodelist.sort()

def _update_state(self, job):
'''Check the status of the job.'''

Expand All @@ -53,6 +60,13 @@ def _update_state(self, job):
if completed.returncode != 0:
raise JobError('qstat failed: %s' % completed.stderr, job.jobid)

nodelist_match = re.search(
r'exec_host = (?P<nodespec>\S+)', completed.stdout
)
if nodelist_match:
nodespec = nodelist_match.group('nodespec')
self._set_nodelist(job, nodespec)

state_match = re.search(
r'^\s*job_state = (?P<state>[A-Z])', completed.stdout, re.MULTILINE
)
Expand Down
2 changes: 1 addition & 1 deletion unittests/test_schedulers.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ def test_submit(make_job, exec_ctx):
if sched_name == 'local':
assert [socket.gethostname()] == minimal_job.nodelist
assert 0 == minimal_job.exitcode
elif sched_name == ('slurm', 'squeue'):
elif sched_name == ('slurm', 'squeue', 'pbs', 'torque'):
num_tasks_per_node = minimal_job.num_tasks_per_node or 1
num_nodes = minimal_job.num_tasks // num_tasks_per_node
assert num_nodes == len(minimal_job.nodelist)
Expand Down