diff --git a/reframe/core/schedulers/slurm.py b/reframe/core/schedulers/slurm.py index e4c9447108..a604f817f4 100644 --- a/reframe/core/schedulers/slurm.py +++ b/reframe/core/schedulers/slurm.py @@ -228,8 +228,10 @@ def _merge_files(self, job): os_ext.concat_files(job.stderr, *err_glob, overwrite=True) def filternodes(self, job, nodes): - # Collect options that restrict node selection - options = job.sched_access + job.options + # Collect options that restrict node selection, but we need to first + # create a mutable list out of the immutable SequenceView that + # sched_access is + options = list(job.sched_access + job.options) if job.sched_partition: options.append('--partition=%s' % job.sched_partition) diff --git a/unittests/test_schedulers.py b/unittests/test_schedulers.py index 4c72f256f8..8442277a01 100644 --- a/unittests/test_schedulers.py +++ b/unittests/test_schedulers.py @@ -743,6 +743,18 @@ def test_sched_access_idle(self): self.prepare_job() assert self.testjob.num_tasks == 8 + def test_sched_access_idle_sequence_view(self): + from reframe.utility import SequenceView + + self.testjob._sched_flex_alloc_nodes = 'idle' + + # Here simulate passing a readonly 'sched_access' as returned + # by a 'SystemPartition' instance. + self.testjob._sched_access = SequenceView(['--constraint=f3']) + self.testjob._sched_partition = 'p3' + self.prepare_job() + assert self.testjob.num_tasks == 4 + def test_sched_access_constraint_partition(self): self.testjob._sched_flex_alloc_nodes = 'all' self.testjob._sched_access = ['--constraint=f1', '--partition=p2']