Skip to content

Commit 46a00d1

Browse files
author
Vasileios Karakasis
authored
Merge pull request #2417 from vkarak/bugfix/reqnodenotavail-cancel-job
[bugfix] Fix job cancellation when job is pending due to `ReqNodeNotAvail`
2 parents cd924f8 + 628a0a6 commit 46a00d1

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

reframe/core/schedulers/slurm.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -502,25 +502,25 @@ def _do_cancel_if_blocked(self, job, reason_descr):
502502
if node_match:
503503
node_names = node_match['node_names']
504504
if node_names:
505-
# Retrieve the info of the unavailable nodes
506-
# and check if they are indeed down
505+
# Retrieve the info of the unavailable nodes and check
506+
# if they are indeed down. According to Slurm's docs
507+
# this should not be necessary, but we check anyways
508+
# to be on the safe side.
507509
self.log(f'Checking if nodes {node_names!r} '
508510
f'are indeed unavailable')
509511
nodes = self._get_nodes_by_name(node_names)
510512
if not any(n.is_down() for n in nodes):
511513
return
512-
else:
513-
# List of unavailable nodes is empty; assume job
514-
# is pending
515-
return
516514

517-
self.cancel(job)
518-
reason_msg = ('job cancelled because it was blocked due to '
519-
'a perhaps non-recoverable reason: ' + reason)
520-
if reason_details is not None:
521-
reason_msg += ', ' + reason_details
515+
self.cancel(job)
516+
reason_msg = (
517+
'job cancelled because it was blocked due to '
518+
'a perhaps non-recoverable reason: ' + reason
519+
)
520+
if reason_details is not None:
521+
reason_msg += ', ' + reason_details
522522

523-
job._exception = JobBlockedError(reason_msg, job.jobid)
523+
job._exception = JobBlockedError(reason_msg, job.jobid)
524524

525525
def wait(self, job):
526526
# Quickly return in case we have finished already

0 commit comments

Comments
 (0)