-
Notifications
You must be signed in to change notification settings - Fork 203
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
InstalledCode
: Allow relative path for filepath_executable
#5879
InstalledCode
: Allow relative path for filepath_executable
#5879
Conversation
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.
thanks @sphuber !
just one question.
Also, if you haven't done so already, could you please do a grep on the codebase to check whether there are other instances of 'absolute' that should be removed from the docs?
:raises `~aiida.common.exceptions.ValidationError`: if no transport could be opened or if the defined executable | ||
does not exist on the remote computer. | ||
""" | ||
if not self.filepath_executable.is_absolute(): | ||
return |
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 checking: what effect does this have in verdi computer test
(or wherever this validation is used)?
will the check be shown as skipped or as passed?
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 check is only run by verdi code test
. It will show that all tests have passed. But this is also the case for codes that are not InstalledCode
even though no test was run.
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.
Ok
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.
@sphuber I would note that ideally what you want to do, if the path is not absolute, is load the same environment that you would have, then check that the executable is on the $PATH
.
Perhaps there could be an option in the code test, to run the prepend text (from both computer and code) then look for the executable
this would be a more "complete" test of whether the code might have issues running
I did do a search, which is how I found the section that was updated in the PR. |
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.
Feel free to go ahead.
If you like, it may be useful to actually change one of the paths of the codes in the tests to no longer be absolute to make sure this works
The `InstalledCode` required the `filepath_executable` to be an absolute path. The original reasoning behind this design choice was that this improves the provenance of data produced with this code slightly as it would be more difficult to accidentally change the version of the code that was associated with the executable. For relative paths, the actual linked code could be easily changed through, for example, environment variables. However, this restriction also has downsides. On many compute clusters the preferred approach is to load specific modules that provide the software of interest in which relative executables are provided. The absolute paths can change depending on microarchitecture of the system or other system variables. Requiring the user to provide the absolute path to the executable defeats the purpose of this system. Therefore the requirement of the executable path having to be absolute is dropped.
21149a0
to
1ebf91b
Compare
Thanks @ltalirz . I have added a test. |
Fixes #5867
The
InstalledCode
required thefilepath_executable
to be an absolute path. The original reasoning behind this design choice was that this improves the provenance of data produced with this code slightly as it would be more difficult to accidentally change the version of the code that was associated with the executable. For relative paths, the actual linked code could be easily changed through, for example, environment variables.However, this restriction also has downsides. On many compute clusters the preferred approach is to load specific modules that provide the software of interest in which relative executables are provided. The absolute paths can change depending on microarchitecture of the system or other system variables. Requiring the user to provide the absolute path to the executable defeats the purpose of this system.
Therefore the requirement of the executable path having to be absolute is dropped.