-
Notifications
You must be signed in to change notification settings - Fork 103
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
[feat] Add custom commands for topology detection in remote partition #3281
base: develop
Are you sure you want to change the base?
[feat] Add custom commands for topology detection in remote partition #3281
Conversation
Hello @Blanca-Fuentes, Thank you for updating! Cheers! There are no PEP8 issues in this Pull Request!Do see the ReFrame Coding Style Guide Comment last updated at 2024-10-10 11:25:37 UTC |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For me this is a very good start. It would be good to have some unittests that check the basic functionality f the feature.
Some things that maybe we still need to discuss:
- Should we copy the reframe directory in the custom command case? I think not, as long as we don't have a use case for it.
- Do we give the option to the user to add commands pre/post in the current scripts (bootstrap/pip)?
if use_pip: | ||
_emit_script_for_pip(job, [part.local_env]) | ||
else: | ||
_emit_script_for_source(job, [part.local_env]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if use_pip: | |
_emit_script_for_pip(job, [part.local_env]) | |
else: | |
_emit_script_for_source(job, [part.local_env]) | |
elif use_pip: | |
_emit_script_for_pip(job, [part.local_env]) | |
else: | |
_emit_script_for_source(job, [part.local_env]) |
No need to indent this further I think
@@ -587,6 +591,7 @@ | |||
"general/purge_environment": false, | |||
"general/remote_detect": false, | |||
"general/remote_workdir": ".", | |||
"general/remote_command": [], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep alphabetical order in the list
# Test that a dummy topo.json file is created if a command to do | ||
# so is specified as custom command for remote detection |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At the moment we are only triggering the autodetection, but cannot tell why the topo.json was created (since the reframe command will be added in the end). This is fine if it's not possible to check the script, but maybe update the comment to reflect that? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With my suggestion of only requiring the reframe installation commands, this unit test would only need to check that the installation command was executed. We could for example have a dummy installation command touch foo.txt
and here we could check that foo.txt
exists.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good overall. I have a few last comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the idea of allowing users to specify the exact commands to run, but I would rather restrict that to the installation commands only. The reframe --detect-host-topology=topo.json
should be added always by the framework.
As a result we should rather call the configuration variable as remote_install
.
if site_config.get('general/0/remote_detect') and \ | ||
site_config.get('general/0/remote_command'): | ||
remote_commands = site_config.get('general/0/remote_command') | ||
detect_topology_cmd = "reframe --detect-host-topology=topo.json" | ||
detect_topology_found = [ | ||
s for s in remote_commands if detect_topology_cmd in s | ||
] | ||
if not detect_topology_found: | ||
remote_cmd_args = site_config.get('general/0/remote_command') | ||
printer.debug( | ||
"Adding ReFrame topology detection to the curstom command" | ||
) | ||
remote_cmd_args.append(detect_topology_cmd) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not needed. We should always add the reframe command to execute.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if the command needs to be ./bin/reframe ...
, like it is the case for the bootstrap option?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess that would be the case when sb wants to clone explicitly and bootstrap it, because by default we make a copy (NB: the method we discuss is something extra to what we do now). Well, in this case the user could set the PATH
to the local bin/
:
remote_install = ['git clone ... && cd reframe && ./boostrap.sh && cd -',
'export PATH=$PWD/reframe/bin:$PATH']
@pytest.fixture | ||
def remote_custom_exec_ctx(make_exec_ctx, temp_topo): | ||
if test_util.USER_CONFIG_FILE is None: | ||
pytest.skip('no user configuration file supplied') | ||
|
||
ctx = make_exec_ctx(test_util.USER_CONFIG_FILE, | ||
test_util.USER_SYSTEM, | ||
{'general/remote_detect': True, | ||
'general/remote_command': [ | ||
'echo \'{"dummy": "value"}\' > topo.json', | ||
]}) | ||
yield ctx |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just extend the existing remote_exec_ctx
to accept additional configuration options.
# Test that a dummy topo.json file is created if a command to do | ||
# so is specified as custom command for remote detection |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With my suggestion of only requiring the reframe installation commands, this unit test would only need to check that the installation command was executed. We could for example have a dummy installation command touch foo.txt
and here we could check that foo.txt
exists.
This PR adds the option of specifying custom commands to run
reframe --detect-host-topology=topo.json
on a remote partition to detect the topology.Previously, a clone of reframe was created in order to launch reframe with auto-detect option.
Now, a list of custom commands can be specified through the configuration option
general:remote_command
to avoid creating a reframe clone withpip
or running.\bootstrap.sh
.The
reframe --detect-host-topology=topo.json
must be specified in the list of commands. If it is not, it is added at the end.Closes #2292.
Closes #2690.
Closes #2979 .