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
2 changes: 1 addition & 1 deletion reframe/core/launchers/mpi.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def command(self, job):
hint = 'multithread' if job.use_smt else 'nomultithread'
ret += ['--hint=%s' % hint]

for opt in job.options:
for opt in job.options + job.cli_options:
if opt.startswith('#'):
continue

Expand Down
3 changes: 2 additions & 1 deletion reframe/core/schedulers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,8 @@ def __init__(self,
self.num_cpus_per_task = None
self.use_smt = None
self.time_limit = None
self.options = list(sched_options) if sched_options else []
self.cli_options = list(sched_options) if sched_options else []
self.options = []

self._name = name
self._workdir = workdir
Expand Down
2 changes: 1 addition & 1 deletion reframe/core/schedulers/pbs.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def _emit_lselect_option(self, job):
# Options starting with `-` are emitted in separate lines
rem_opts = []
verb_opts = []
for opt in (*job.sched_access, *job.options):
for opt in (*job.sched_access, *job.options, *job.cli_options):
if opt.startswith('-'):
rem_opts.append(opt)
elif opt.startswith('#'):
Expand Down
14 changes: 9 additions & 5 deletions reframe/core/schedulers/slurm.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,12 @@ def emit_preamble(self, job):
]

# Determine if job refers to a Slurm job array, by looking into the
# job.options
# job.options and job.cli_options
jobarr_parser = ArgumentParser()
jobarr_parser.add_argument('-a', '--array')
parsed_args, _ = jobarr_parser.parse_known_args(job.options)
parsed_args, _ = jobarr_parser.parse_known_args(
job.options + job.cli_options
)
if parsed_args.array:
job._is_array = True
self.log('Slurm job is a job array')
Expand Down Expand Up @@ -197,7 +199,9 @@ def emit_preamble(self, job):

# NOTE: Here last of the passed --constraint job options is taken
# into account in order to respect the behavior of slurm.
parsed_options, _ = constraint_parser.parse_known_args(job.options)
parsed_options, _ = constraint_parser.parse_known_args(
job.options + job.cli_options
)
if parsed_options.constraint:
constraints.append(parsed_options.constraint.strip())

Expand All @@ -208,7 +212,7 @@ def emit_preamble(self, job):

preamble.append(self._format_option(hint, '--hint={0}'))
prefix_patt = re.compile(r'(#\w+)')
for opt in job.options:
for opt in job.options + job.cli_options:
if opt.strip().startswith(('-C', '--constraint')):
# Constraints are already processed
continue
Expand Down Expand Up @@ -267,7 +271,7 @@ def filternodes(self, job, nodes):
# 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)
options = list(job.sched_access + job.options + job.cli_options)
option_parser = ArgumentParser()
option_parser.add_argument('--reservation')
option_parser.add_argument('-p', '--partition')
Expand Down
4 changes: 2 additions & 2 deletions unittests/test_launchers.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def job(make_job, launcher):
job.num_cpus_per_task = 2
job.use_smt = True
job.time_limit = '10m'
job.options += ['--gres=gpu:4', '#DW jobdw anything']
job.options = ['--gres=gpu:4', '#DW jobdw anything']
job.launcher.options = ['--foo']
return job

Expand Down Expand Up @@ -130,8 +130,8 @@ def test_run_command(job):
'--cpus-per-task=2 '
'--exclusive '
'--hint=multithread '
'--fake '
'--gres=gpu:4 '
'--fake '
'--foo')
elif launcher_name == 'ssh':
assert command == 'ssh -o BatchMode=yes -l user -p 22222 --foo host'
Expand Down