-
-
Notifications
You must be signed in to change notification settings - Fork 28
New functionality: wrapper scripts #473
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
New functionality: wrapper scripts #473
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.
Ah okay I think I get this conceptually! I'm going to need an evening or two to test and review, and order wise I want to get #472 in first just for review order of operations. So stay tuned! One thing to think about in the meantime is, aside from having the aliases be the driver for the wrapper scripts (e.g., it looks like each alias becomes an executable to basically run a container) what other functionality could be provided? E.g., what would be a different kind of wrapper script, or even one that is custom provided by a user? I will think on this too - so expect to hear from me probably in a few days, latest the weekend!
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.
Okay some early comments are below! Sorry for the delay, busy week and had some other shpc things to work on. Given that I tested outside of a container I think this would have worked, but it's led me to realize two things:
- we need to figure out how to not hard code paths into the modules (and make them un-usable given a bind or change of location).
- we should likely load the default config first and then update with the user to be able to better handle issues like forgetting to set a value.
And of course when this is more ready we need some good docs to describe wrapper scripts and show how they work and what happens when you set to true!
okay and here is a quick proposal to handle the bug I ran into here (not adding the wrapper_shell) #475 |
thanks @vsoch ! should be able to work on SHPC later today |
OK, I will deep dive on this one tomorrow, for now just replying to this very first comment of yours:
Great point!
For point 2. (ie your point) then, it would be about providing similar features to More coming tomorrow.. |
OK, I think I am done for today. I have provided and tested fixes for some of your feedback. Just summarising from the above what seem to be the current open points, which I can go back to next week:
|
I love this idea and think it's so important - in practice I'm not sure how to implement it, because the module files are sort of "written once and then done." I was trying to look for a way to get this relative path via the module software but maybe there is a better way?
This is an interesting idea that I'd like to think through more.
Can you expand on this?
I think for now having a variable for a custom file would be perfect. E.g., use the default (the container ones) or write a custom one and use it. I think if we have more than one what we ultimately will want is an organized folder with named files, and then perhaps a default, but a way for an install to request using one or more (probably via the container.yaml) and then it could be provided with the container for a one off script relevant to it, or somewhere else in shpc for more generic templates. Given install of a module and request for a name, we'd first search the container.yaml directory, and then go to the shpc install.
100% ! |
Sorry @vsoch , been busy, will be back on it soon :) |
okay we should be able to rebase with main and then pick up discussion here! |
Yep, in my to do list for today! ;) |
Ok, so the big win of the day is the dynamic path in the modulefiles for wrapper scripts! |
Ok, so, after the modularisation of the code that generates the wrapper scripts, I can still see two outstanding points from our thread above. The 1st one is about allowing for custom template files for the wrapper scripts. In terms of what we could do in the future for these custom templates, as we said previously, there are few possibilities:
If you're happy with keeping this in the backlog, I can turn this comment in a separated github issue. |
The 2nd outstanding point is documenting the new wrapper scripts feature, which I will try to do asap! :-) |
On a separate note, a couple of days ago I also did a commit to this PR, to ensure wildcard arguments are "quoted" appropriately in the wrapper templates, a bit like a did in the modulefile templates the other day. Look at the weird syntax that csh needs inside a script:
The wildcard is https://stackoverflow.com/questions/42263202/bash-csh-echo-the-strings-argv-and-bin-csh |
Let me take a shot at this, and I'll work on your branch here (but won't push in case you don't like the changes of the work!) I think it's important to have this in, for the first shot.
This is actually an interesting idea I was pondering - if the lua / tcl templates could be considered under the same namespace as wrapper, and then just with a different output directory. And I like all your ideas for custom templates! I'm hoping I can figure out something that the user can provide one, one off, and the container-specific ones make sense (if there is a use case). |
Thanks @vsoch ! I agree with what you say, especially around the template/wrapper customisation benefitting Lua/Tcl templates, and hence the need for a wrapper class...or should it be called a template class, to effectively include lua/tcl modulefile templates? Please go ahead and feel free to work on this branch/PR! On my side, I expect to shoot one more commit today with some basic documentation on the feature, and then be quite for a bit ;) |
Hold off on the docs - I can do that fairly quickly, and with the refactor I'm thinking it would be not the best use of your time. I can't promise to get the PR in tonight because it's late, but I have a good start so it will be sometime this week! |
Ok sure, will wait on the docs! |
Added with #496 ! |
With this PR, I am adding a beta version for the wrapper scripts functionality that I was mentioning in issue #383 . The main scope is to enable interaction of the command aliases with mpirun/srun, which don't work with shell aliases.
In this first iteration, it is an on/off functionality controlled in the settings.yml; I have added a 2nd setting to control the shell type in the wrapper scripts (I just added it in compliance with other shell usages in SHPC):
Setting
wrapper_scripts
to false (default), gives the traditional behaviour of shpc.When it is set to true, 2 things change:
Note that aliases are still created for the generic commands -exec, -shell and so on.
Support:
Implementation notes:
singularity.sh
anddocker.sh
singularity.py
anddocker.py
wrapper_template
between module and container methods. Maybe this could be made cleaner?Other notes:
What do you think?