-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Add hook for custom apptainer environment #28845
base: next
Are you sure you want to change the base?
Conversation
c01c8a9
to
cb0b2bf
Compare
I can address this in #28813 |
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.
Need to bump the whole conda stack due to changing mpi.def (which is versioned alongside moose-mpi)
@@ -0,0 +1,3 @@ | |||
if [ -e $HOME/.bashrc_apptainer ]; then |
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.
Please do a chmod +x
on this file if you haven't. and while you're at it, do one on 01-fix-exec.sh
too because I think we forgot it
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.
x is not really necessary for source
, but I can make that change
Can you try the following, see if alias work: apptainer shell -B /path/to/your/.bashrc_apptainer:/init_env oras://theimage I am finding many things don't work by simply sourcing the file, as you are suggesting to do. If the above works, then this feature is already present. We just need to be more clear as to its availability. Edit: Edit2: |
I'm using |
Why wouldn't that work?! |
Job Precheck, step Conda build config check on 3b38a76 wanted to post the following: A change of the following file(s) triggered this check: conda/peacock The following file(s) are unchanged: conda/mpi/conda_build_config.yaml The conda build config was not changed but one or more of its dependencies have changed |
Here has been my experience: $ apptainer shell -B /home/milljm/.testing:/init_env oras://mooseharbor.hpc.inl.gov/moose-dev/moose-dev-mpich-x86_64:28a1964
INFO: Using cached SIF image
moose-dev-mpich-x86_64:28a1964 [milljm@rod: ~ ]
$ cat /init_env
function my_test(){
echo 'hello from my_test function'
}
alias jas='ls -latrh' So the file exists inside the container well enough. But... moose-dev-mpich-x86_64:28a1964 [milljm@rod: ~ ]
$ my_test
bash: my_test: command not found
moose-dev-mpich-x86_64:28a1964 [milljm@rod: ~ ]
$ jas
bash: jas: command not found no dice. Not until I source it again moose-dev-mpich-x86_64:28a1964 [milljm@rod: ~ ]
$ . /init_env
moose-dev-mpich-x86_64:28a1964 [milljm@rod: ~ ]
$ my_test
hello from my_test function
moose-dev-mpich-x86_64:28a1964 [milljm@rod: ~ ]
$ jas
total 195M
-rw------- 1 milljm milljm 256 Sep 18 2013 .pulse-cookie
<trimmed> All the while we do seem to be doing it: Lines 52 to 55 in a35543b
Perhaps what you are doing may work. As I have been experiencing different results as to when this file gets sourced. |
I am trying what you are suggesting, and it won't work. My PR I am working on should fix this. But simply "sourcing" files doesn't seem to be enough. Don't ask me why, lol. editing the atrocious PS prompt... $ apptainer shell moose-dev-mpich-x86_64_28a1964.sifw
$ jas
bash: jas: command not found
$ my_test
bash: my_test: command not found
$ echo $MYVAR # exports work!?
foobar
$ cat /.singularity.d/env/02-bashrc-apptainer.sh
if [ -e $HOME/.bashrc_apptainer ]; then
source $HOME/.bashrc_apptainer
fi
$ cat $HOME/.bashrc_apptainer
function my_test(){
echo 'hello from my_test function'
}
alias jas='ls -latrh'
export MYVAR=foobar
$ . /.singularity.d/env/02-bashrc-apptainer.sh # sourcing it again works. 🤷
$ my_test
hello from my_test function
$ jas
total 2.2G
<trimmed>
drwxr-xr-x 3 milljm milljm 60 Oct 14 12:56 ..
$ |
Hm... I suppose that env stuff is not sourced in my current shell, and aliases are not inherited. But why is the bash not sourcing my |
Job Precheck, step Conda build config check on e44885a wanted to post the following: A change of the following file(s) triggered this check: conda/peacock The following file(s) are unchanged: conda/mpi/conda_build_config.yaml The conda build config was not changed but one or more of its dependencies have changed |
Isn't this due to the |
Reason
I'm missing my aliases in the apptainer shells.
Design
Add an apptainer env script that sources
$HOME/.bashrc_apptainer
if it exists.Impact
Permit users to set up familiar environments in apptainer containers.