Skip to content
Snippets Groups Projects

Better handling of systems with old singularity installs

Merged Sylvester Joosten requested to merge update_install into master
1 file
+ 37
13
Compare changes
  • Side-by-side
  • Inline
+ 37
13
@@ -14,19 +14,30 @@ echo "Setting up development environment for eicweb/$CONTAINER:$VERSION"
@@ -14,19 +14,30 @@ echo "Setting up development environment for eicweb/$CONTAINER:$VERSION"
mkdir -p local/lib || exit 1
mkdir -p local/lib || exit 1
 
SINGULARITY=
## check for a singularity install
## check for a singularity install
## jlab singularity
## default singularity if new enough
if [ -d "/apps/singularity/3.7.1/bin/" ]; then
if [ $(type -P singularity ) ]; then
SINGULARITY="/apps/singularity/3.7.1/bin/singularity"
## cvmfs singularity
elif [ -f "/cvmfs/oasis.opensciencegrid.org/mis/singularity/bin/singularity" ]; then
SINGULARITY="/cvmfs/oasis.opensciencegrid.org/mis/singularity/bin/singularity"
## whatever is in the path
elif [ $(type -P singularity ) ]; then
SINGULARITY=$(which singularity)
SINGULARITY=$(which singularity)
else
SINGULARITY_VERSION=`$SINGULARITY --version`
echo "ERROR: no singularity found, please make sure you have singularity in your \$PATH"
if [ ${SINGULARITY_VERSION:0:1} = 2 ]; then
exit 1
## too old, look for something else
 
SINGULARITY=
 
fi
 
fi
 
if [ -z $SINGULARITY ]; then
 
if [ -d "/apps/singularity/3.7.1/bin/" ]; then
 
SINGULARITY="/apps/singularity/3.7.1/bin/singularity"
 
## cvmfs singularity
 
elif [ -f "/cvmfs/oasis.opensciencegrid.org/mis/singularity/bin/singularity" ]; then
 
SINGULARITY="/cvmfs/oasis.opensciencegrid.org/mis/singularity/bin/singularity"
 
## whatever is in the path
 
elif [ $(type -P singularity ) ]; then
 
SINGULARITY=$(which singularity)
 
else
 
echo "ERROR: no singularity found, please make sure you have singularity in your \$PATH"
 
exit 1
 
fi
fi
fi
echo " - Found singularity at $SINGULARITY"
echo " - Found singularity at $SINGULARITY"
@@ -39,12 +50,13 @@ if [ ${SINGULARITY_VERSION:0:1} = 2 ]; then
@@ -39,12 +50,13 @@ if [ ${SINGULARITY_VERSION:0:1} = 2 ]; then
echo "WARNING: your singularity version $SINGULARITY_VERSION is ancient, we strongly recommend using version 3.x"
echo "WARNING: your singularity version $SINGULARITY_VERSION is ancient, we strongly recommend using version 3.x"
echo "We will attempt to use a fall-back SIMG image to be used with this singularity version"
echo "We will attempt to use a fall-back SIMG image to be used with this singularity version"
if [ -f /gpfs02/eic/athena/jug_xl-3.0-stable.simg ]; then
if [ -f /gpfs02/eic/athena/jug_xl-3.0-stable.simg ]; then
ln -df /gpfs02/eic/athena/jug_xl-3.0-stable.simg local/lib
ln -sf /gpfs02/eic/athena/jug_xl-3.0-stable.simg local/lib
SIF="$PWD/local/lib/jug_xl-3.0-stable.simg"
SIF="$PWD/local/lib/jug_xl-3.0-stable.simg"
else
else
echo "Attempting last-resort singularity pull for old image"
echo "Attempting last-resort singularity pull for old image"
echo "This may take a few minutes..."
echo "This may take a few minutes..."
singularity pull docker://eicweb/$CONTAINER:$VERSION
SIF="$PWD/local/lib/jug_xl-3.0-stable.simg"
 
singularity pull --name "$SIF" docker://eicweb/$CONTAINER:$VERSION
fi
fi
## we are in sane territory, yay!
## we are in sane territory, yay!
else
else
@@ -78,11 +90,23 @@ fi
@@ -78,11 +90,23 @@ fi
## create a new top-level eic-shell launcher script
## create a new top-level eic-shell launcher script
## that sets the ATHENA_PREFIX and then starts singularity
## that sets the ATHENA_PREFIX and then starts singularity
 
## need different script for old singularity versions
 
if [ ${SINGULARITY_VERSION:0:1} != 2 ]; then
 
## newer singularity
cat << EOF > eic-shell
cat << EOF > eic-shell
#!/bin/bash
#!/bin/bash
export ATHENA_PREFIX=$PWD/local
export ATHENA_PREFIX=$PWD/local
$SINGULARITY run $SIF
$SINGULARITY run $SIF
EOF
EOF
 
else
 
## ancient singularity
 
cat << EOF > eic-shell
 
#!/bin/bash
 
export ATHENA_PREFIX=$PWD/local
 
$SINGULARITY exec $SIF bash
 
EOF
 
fi
 
chmod +x eic-shell
chmod +x eic-shell
echo " - Created custom eic-shell excecutable"
echo " - Created custom eic-shell excecutable"
Loading