Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bugfix] Add job options from the command-line to processor auto-detection remote job #3318

Merged
merged 7 commits into from
Nov 13, 2024
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
11 changes: 7 additions & 4 deletions reframe/frontend/autodetect.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def _is_part_local(part):
part.launcher_type.registered_name == 'local')


def _remote_detect(part):
def _remote_detect(part, cli_job_options):
use_login_shell = runtime.runtime().get_option('general/0/use_login_shell')

def _emit_script_for_source(job, env):
Expand Down Expand Up @@ -172,7 +172,7 @@ def _emit_custom_script(job, env, commands):
job = Job.create(part.scheduler,
part.launcher_type(),
name='rfm-detect-job',
sched_access=part.access)
sched_access=part.access + cli_job_options)
custom_command = runtime.runtime().get_option(
'general/0/remote_install'
)
Expand Down Expand Up @@ -201,7 +201,8 @@ def _emit_custom_script(job, env, commands):
return topo_info


def detect_topology():
def detect_topology(cli_job_options=None):
cli_job_options = [] if cli_job_options is None else cli_job_options
rt = runtime.runtime()
detect_remote_systems = rt.get_option('general/0/remote_detect')
topo_prefix = osext.expandvars(rt.get_option('general/0/topology_prefix'))
Expand Down Expand Up @@ -280,7 +281,9 @@ def detect_topology():
_save_info(topo_file, part.processor.info)
elif detect_remote_systems:
with runtime.temp_environment(modules=modules, env_vars=vars):
part._processor = ProcessorInfo(_remote_detect(part))
part._processor = ProcessorInfo(
_remote_detect(part, cli_job_options)
)

if part.processor.info:
_save_info(topo_file, part.processor.info)
Expand Down
28 changes: 14 additions & 14 deletions reframe/frontend/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -1109,7 +1109,20 @@ def restrict_logging():

sys.exit(0)

autodetect.detect_topology()
# Need to parse the cli options before autodetection
parsed_job_options = []
for opt in options.job_options:
opt_split = opt.split('=', maxsplit=1)
optstr = opt_split[0]
valstr = opt_split[1] if len(opt_split) > 1 else ''
if opt.startswith('-') or opt.startswith('#'):
parsed_job_options.append(opt)
elif len(optstr) == 1:
parsed_job_options.append(f'-{optstr} {valstr}')
else:
parsed_job_options.append(f'--{optstr}={valstr}')

autodetect.detect_topology(parsed_job_options)
printer.debug(format_env(options.env_vars))

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

# Need to parse the cli options before loading the tests
parsed_job_options = []
for opt in options.job_options:
opt_split = opt.split('=', maxsplit=1)
optstr = opt_split[0]
valstr = opt_split[1] if len(opt_split) > 1 else ''
if opt.startswith('-') or opt.startswith('#'):
parsed_job_options.append(opt)
elif len(optstr) == 1:
parsed_job_options.append(f'-{optstr} {valstr}')
else:
parsed_job_options.append(f'--{optstr}={valstr}')

# Locate and load checks; `force=True` is not needed for normal
# invocations from the command line and has practically no effect, but
# it is needed to better emulate the behavior of running reframe's CLI
Expand Down
1 change: 0 additions & 1 deletion unittests/test_parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

import reframe as rfm
from reframe.core.exceptions import ReframeSyntaxError
import reframe.core.decorators as decorators


class NoParams(rfm.RunOnlyRegressionTest):
Expand Down
Loading