Skip to content

Commit a5acd35

Browse files
authored
Merge pull request #3318 from ekouts/bugfix/autodetection_job_options
[bugfix] Add job options from the command-line to processor auto-detection remote job
2 parents 29d838d + 78772a2 commit a5acd35

File tree

3 files changed

+21
-19
lines changed

3 files changed

+21
-19
lines changed

reframe/frontend/autodetect.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ def _is_part_local(part):
136136
part.launcher_type.registered_name == 'local')
137137

138138

139-
def _remote_detect(part):
139+
def _remote_detect(part, cli_job_options):
140140
use_login_shell = runtime.runtime().get_option('general/0/use_login_shell')
141141

142142
def _emit_script_for_source(job, env):
@@ -172,7 +172,7 @@ def _emit_custom_script(job, env, commands):
172172
job = Job.create(part.scheduler,
173173
part.launcher_type(),
174174
name='rfm-detect-job',
175-
sched_access=part.access)
175+
sched_access=part.access + cli_job_options)
176176
custom_command = runtime.runtime().get_option(
177177
'general/0/remote_install'
178178
)
@@ -201,7 +201,8 @@ def _emit_custom_script(job, env, commands):
201201
return topo_info
202202

203203

204-
def detect_topology():
204+
def detect_topology(cli_job_options=None):
205+
cli_job_options = [] if cli_job_options is None else cli_job_options
205206
rt = runtime.runtime()
206207
detect_remote_systems = rt.get_option('general/0/remote_detect')
207208
topo_prefix = osext.expandvars(rt.get_option('general/0/topology_prefix'))
@@ -280,7 +281,9 @@ def detect_topology():
280281
_save_info(topo_file, part.processor.info)
281282
elif detect_remote_systems:
282283
with runtime.temp_environment(modules=modules, env_vars=vars):
283-
part._processor = ProcessorInfo(_remote_detect(part))
284+
part._processor = ProcessorInfo(
285+
_remote_detect(part, cli_job_options)
286+
)
284287

285288
if part.processor.info:
286289
_save_info(topo_file, part.processor.info)

reframe/frontend/cli.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1109,7 +1109,20 @@ def restrict_logging():
11091109

11101110
sys.exit(0)
11111111

1112-
autodetect.detect_topology()
1112+
# Need to parse the cli options before autodetection
1113+
parsed_job_options = []
1114+
for opt in options.job_options:
1115+
opt_split = opt.split('=', maxsplit=1)
1116+
optstr = opt_split[0]
1117+
valstr = opt_split[1] if len(opt_split) > 1 else ''
1118+
if opt.startswith('-') or opt.startswith('#'):
1119+
parsed_job_options.append(opt)
1120+
elif len(optstr) == 1:
1121+
parsed_job_options.append(f'-{optstr} {valstr}')
1122+
else:
1123+
parsed_job_options.append(f'--{optstr}={valstr}')
1124+
1125+
autodetect.detect_topology(parsed_job_options)
11131126
printer.debug(format_env(options.env_vars))
11141127

11151128
# Setup the check loader
@@ -1224,19 +1237,6 @@ def print_infoline(param, value):
12241237
try:
12251238
logging.getprofiler().enter_region('test processing')
12261239

1227-
# Need to parse the cli options before loading the tests
1228-
parsed_job_options = []
1229-
for opt in options.job_options:
1230-
opt_split = opt.split('=', maxsplit=1)
1231-
optstr = opt_split[0]
1232-
valstr = opt_split[1] if len(opt_split) > 1 else ''
1233-
if opt.startswith('-') or opt.startswith('#'):
1234-
parsed_job_options.append(opt)
1235-
elif len(optstr) == 1:
1236-
parsed_job_options.append(f'-{optstr} {valstr}')
1237-
else:
1238-
parsed_job_options.append(f'--{optstr}={valstr}')
1239-
12401240
# Locate and load checks; `force=True` is not needed for normal
12411241
# invocations from the command line and has practically no effect, but
12421242
# it is needed to better emulate the behavior of running reframe's CLI

unittests/test_parameters.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
import reframe as rfm
1212
from reframe.core.exceptions import ReframeSyntaxError
13-
import reframe.core.decorators as decorators
1413

1514

1615
class NoParams(rfm.RunOnlyRegressionTest):

0 commit comments

Comments
 (0)