%appenv mycontext(write code here)
singularity run --app mycontext container.simg
singularity run container.simg
--
You received this message because you are subscribed to the Google Groups "singularity" group.
To unsubscribe from this group and stop receiving emails from it, send an email to singularity+unsubscribe@lbl.gov.
Hey Asoka,Have you tried including your source lines in the %environment section? That will be sourced when you shell / run etc. the container. If you need it to only be specific to some context (and not source for any shell at all) then you could use a SCI-F app to do it, eg:%appenv mycontext(write code here)and then when you run/shell# will source the environment abovesingularity run --app mycontext container.simg# will notsingularity run container.simgBest,Vanessa
On Sun, Dec 10, 2017 at 4:13 PM, Asoka De Silva <asoka.desilva@computecanada.ca> wrote:
Hi,$ singularity --version2.3.1-distsingularity shell -B /cvmfs/atlas-condb.cern.ch,/cvmfs/atlas-nightlies.cern.ch,/cvmfs/atlas.cern.ch,/cvmfs/sft.cern.ch /cvmfs/atlas.cern.ch/repo/containers/images/singularity/x86_64-centos6.imgwill result in an interactive bash shell of a singularity container. What I would like to do is to source a script automatically - e.g. do these lines, and then continue with the interactive shell:cat mySetup.shif [ -z $ATLAS_LOCAL_ROOT_BASE ]; thenexport ATLAS_LOCAL_ROOT_BASE=/cvmfs/atlas.cern.ch/repo/ATLASLocalRootBasefisource ${ATLAS_LOCAL_ROOT_BASE}/user/atlasLocalSetup.shIs there a way to do this and continue with the interactive bash shell env ? I triedecho "source mySetup.sh" | singularity shell -B /cvmfs/atlas-condb.cern.ch,/cvmfs/atlas-nightlies.cern.ch,/cvmfs/atlas.cern.ch,/cvmfs/sft.cern.ch /cvmfs/atlas.cern.ch/repo/containers/images/singularity/x86_64-centos6.imgand alsosingularity shell -B /cvmfs/atlas-condb.cern.ch,/cvmfs/atlas-nightlies.cern.ch,/cvmfs/atlas.cern.ch,/cvmfs/sft.cern.ch /cvmfs/atlas.cern.ch/repo/containers/images/singularity/x86_64-centos6.img < mySetup.shbut it sources mySetup.sh script and then exits the container.(The container images are not user modifiable.)Thanks in advance for any help !regards,Asoka
--
You received this message because you are subscribed to the Google Groups "singularity" group.
To unsubscribe from this group and stop receiving emails from it, send an email to singularity...@lbl.gov.
--
singularity exec container.simg env | grep ATLAS_LOCAL_ROOT_BASE
singularity exec container.simg cat ${ATLAS_LOCAL_ROOT_BASE}/user/atlasLocalSetup.sh
To unsubscribe from this group and stop receiving emails from it, send an email to singularity...@lbl.gov.
--
You received this message because you are subscribed to the Google Groups "singularity" group.
To unsubscribe from this group and stop receiving emails from it, send an email to singularity+unsubscribe@lbl.gov.
Hey Asoka,
If you are just using shell, is there any reason you can't source it after entering the container? You could also have something in a bashrc or profile that is used from your home, if you don't want to do that. We can definitely think of other ways - but arguably the best (and more reproducible way) is to get the build recipe (that %environment section I was talking about is there) and modify it to be correct. Because if someone finds your container and needs to do what you did, they would have a hard time.It could also be that the ATLAS_LOCAL_ROOT_BASE isn't being found so it's not sourcing at all, you can also pass it into the container like ATLAS_LOCAL_ROOT_BASE=/cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase singularity shell...the way you can test that the variable is getting in is to do something like:singularity exec container.simg env | grep ATLAS_LOCAL_ROOT_BASEand then do the same for the script, maybe use cat to look at it.singularity exec container.simg cat ${ATLAS_LOCAL_ROOT_BASE}/user/atlasLocalSetup.shI'm also wondering why the container is exiting if you are shelling. It would be logical for it to exit on exec or run, but probably not shell. If there is a source that runs cleanly it should not technically exit. I would check 1) if there is any exit logic in the source and 2) that you aren't still actually in the container.Best,Vanessa
To unsubscribe from this group and stop receiving emails from it, send an email to singularity+unsubscribe@lbl.gov.
Hi Vanessa,I am trying to extend the container for other users / use cases so I cannot modify .bashrc / profile or even manually enter it since I am considering making the startup of the container to be transparent to the user. The end result of this is to provide users with an ATLAS Tier3 environment. I would like to avoid rebuilding it but as a very last resort can can ask if the container developers can build future versions with %appenv.
(ATLAS_LOCAL_ROOT_BASE should not be passed to the container unless the container does not define it but this doe snot seem to be the issue as the sourcing will fail if it does not exist.) If you have /cvmfs available , you can try it:
singularity inspect -e container.simgsingularity inspect -r container.simg
singularity exec container.simg cat /.singularity.d/runscript#!/bin/shexec "/bin/bash"
singularity exec container.simg cat /.singularity.d/env/90-environment.sh
In fact, make it a very simple script that just does[desilva@cedar5 ~]$ cat -v hello.shecho "hello"[desilva@cedar5 ~]$and it will do:[desilva@cdr818 ~]$ singularity shell -B /cvmfs/atlas-condb.cern.ch,/cvmfs/atlas-nightlies.cern.ch,/cvmfs/atlas.cern.ch,/cvmfs/sft.cern.ch /cvmfs/atlas.cern.ch/repo/containers/images/singularity/x86_64-centos6.img < ./hello.shSingularity: Invoking an interactive shell within container...hello[desilva@cdr818 ~]$i.e. it exists.
regards,Asoka
To unsubscribe from this group and stop receiving emails from it, send an email to singularity+unsubscribe@lbl.gov.
To unsubscribe from this group and stop receiving emails from it, send an email to singularity+unsubscribe@lbl.gov.
[desilva@cdr818 ~]$ singularity exec -H /home/desilva/contTest:/srv -B /cvmfs /cvmfs/atlas.cern.ch/repo/containers/fs/singularity/x86_64-centos6 bash
lsetup lsetup <tool1> [ <tool2> ...] (see lsetup -h):
lsetup agis ATLAS Grid Information System
lsetup asetup (or asetup) to setup an Athena release
lsetup atlantis Atlantis: event display
lsetup eiclient Event Index
lsetup emi EMI: grid middleware user interface
lsetup fax Federated XRootD data storage access (FAX)
lsetup ganga Ganga: job definition and management client
lsetup lcgenv lcgenv: setup tools from cvmfs SFT repository
lsetup panda Panda: Production ANd Distributed Analysis
lsetup pod Proof-on-Demand (obsolete)
lsetup pyami pyAMI: ATLAS Metadata Interface python client
lsetup rcsetup (or rcSetup) to setup an ASG release
lsetup root ROOT data processing framework
lsetup rucio distributed data management system client
lsetup sft setup tools from SFT repo (use lcgenv instead)
lsetup xcache XRootD local proxy cache
lsetup xrootd XRootD data access
advancedTools advanced tools menu
diagnostics diagnostic tools menu
helpMe more help
printMenu show this menu
showVersions show versions of installed software
It works now.