Skip to content

Commit 106a774

Browse files
author
Vasileios Karakasis
authored
Merge pull request #1259 from teojgo/bugfix/slurm_filter_nodes
[bugfix] Fix `AttributeError` in flexible node allocation from the Slurm backend
2 parents 60015c3 + 38a53e5 commit 106a774

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

reframe/core/schedulers/slurm.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,8 +228,10 @@ def _merge_files(self, job):
228228
os_ext.concat_files(job.stderr, *err_glob, overwrite=True)
229229

230230
def filternodes(self, job, nodes):
231-
# Collect options that restrict node selection
232-
options = job.sched_access + job.options
231+
# Collect options that restrict node selection, but we need to first
232+
# create a mutable list out of the immutable SequenceView that
233+
# sched_access is
234+
options = list(job.sched_access + job.options)
233235
if job.sched_partition:
234236
options.append('--partition=%s' % job.sched_partition)
235237

unittests/test_schedulers.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -743,6 +743,18 @@ def test_sched_access_idle(self):
743743
self.prepare_job()
744744
assert self.testjob.num_tasks == 8
745745

746+
def test_sched_access_idle_sequence_view(self):
747+
from reframe.utility import SequenceView
748+
749+
self.testjob._sched_flex_alloc_nodes = 'idle'
750+
751+
# Here simulate passing a readonly 'sched_access' as returned
752+
# by a 'SystemPartition' instance.
753+
self.testjob._sched_access = SequenceView(['--constraint=f3'])
754+
self.testjob._sched_partition = 'p3'
755+
self.prepare_job()
756+
assert self.testjob.num_tasks == 4
757+
746758
def test_sched_access_constraint_partition(self):
747759
self.testjob._sched_flex_alloc_nodes = 'all'
748760
self.testjob._sched_access = ['--constraint=f1', '--partition=p2']

0 commit comments

Comments
 (0)