Commit 026418e3 authored by Andrea Sciaba's avatar Andrea Sciaba
Browse files

Added new files for xrootd and singularity wrapping

parent b45ef6ba
#!/bin/bash
TEST_SCRIPT=`basename $0 | sed 's/\.sing//'`
echo "Will run $TEST_SCRIPT with Singularity if available"
source ${SAME_SENSOR_HOME}/tests/CE-cms-singularity-wrapper ${TEST_SCRIPT}
This diff is collapsed.
#!/bin/bash
unset TMP
unset TEMP
unset X509_CERT_DIR
# Defining the SAM exit codes, just in case
export SAME_OK=10
export SAME_INFO=20
export SAME_NOTICE=30
export SAME_WARNING=40
export SAME_ERROR=50
export SAME_CRITICAL=60
export SAME_MAINTENANCE=100
# setup grid client software
rhel6_img='/cvmfs/singularity.opensciencegrid.org/bbockelm/cms:rhel6'
rhel7_img='/cvmfs/singularity.opensciencegrid.org/bbockelm/cms:rhel7'
rhel6_client='/cvmfs/oasis.opensciencegrid.org/osg-software/osg-wn-client/3.4/current/el6-x86_64/setup.sh'
rhel7_client='/cvmfs/oasis.opensciencegrid.org/osg-software/osg-wn-client/3.4/current/el7-x86_64/setup.sh'
if [ "x$OSG_SINGULARITY_IMAGE_DEFAULT" = "x$rhel6_img" -a -e $rhel6_client ]; then
source $rhel6_client
elif [ "x$OSG_SINGULARITY_IMAGE_DEFAULT" = "x$rhel7_img" -a -e $rhel7_client ]; then
source $rhel7_client
else
echo "Unable to setup grid client software, probe may or may not work!"
fi
# override some OSG specific variables
if [ "x$OSG_WN_TMP" != "x" ]; then
export OSG_WN_TMP=/tmp
fi
# fix up SAME_SENSOR_HOME environmental variable
SAME_SENSOR_HOME="/srv"; export SAME_SENSOR_HOME
# If not already set, provide a default TZ
if [ "x$TZ" = "x" ]; then
export TZ="UTC"
echo "Timezone set to UTC, be aware"
fi
# Run the requested probe
exec $1
RC=$?
echo "Bourne shell exec failed with return code ${RC}"
echo "summary: BROKEN_SINGULARITY"
exit $SAME_ERROR
#!/bin/sh
# Argument is the name of the test to run inside singularity
TEST_SCRIPT=$1
# some known singularity locations
for LOCATION in \
/util/opt/singularity/2.2.1/gcc/4.4/bin \
/util/opt/singularity/2.2/gcc/4.4/bin \
/uufs/chpc.utah.edu/sys/installdir/singularity/std/bin ; do
if [ -e "$LOCATION" ]; then
echo " ... prepending $LOCATION to PATH"
export PATH="$LOCATION:$PATH"
break
fi
done
HAS_SINGULARITY="True"
export OSG_SINGULARITY_VERSION=`singularity --version 2>/dev/null`
if [ "x$OSG_SINGULARITY_VERSION" != "x" ]; then
export OSG_SINGULARITY_PATH=`which singularity`
else
# some sites need us to do a module load first
export OSG_SINGULARITY_VERSION=`module load singularity >/dev/null 2>&1; singularity --version 2>/dev/null`
if [ "x$OSG_SINGULARITY_VERSION" != "x" ]; then
export OSG_SINGULARITY_PATH=`module load singularity >/dev/null 2>&1; which singularity`
else
HAS_SINGULARITY='False'
echo "WARNING: Could not find singularity on system"
fi
fi
# default image for this glidein
export OSG_SINGULARITY_IMAGE_DEFAULT="/cvmfs/singularity.opensciencegrid.org/bbockelm/cms:rhel6"
# for now, we will only advertise singularity on nodes which can access cvmfs
if [ ! -e "$OSG_SINGULARITY_IMAGE_DEFAULT" ]; then
HAS_SINGULARITY='False'
echo "WARNING: Could not find singularity image on system"
fi
# Grid environment is taken from OSG, check it's available:
if [ ! -e /cvmfs/oasis.opensciencegrid.org/osg-software/osg-wn-client ]; then
HAS_SINGULARITY='False'
echo "WARNING: OSG client software CVMFS not accessible"
fi
if [ "$HAS_SINGULARITY" == "False" ] ; then
echo "Executing probe without Singularity..."
exec $SAME_SENSOR_HOME/tests/$TEST_SCRIPT
fi
OSG_SINGULARITY_EXTRA_OPTS="--home ${SAME_SENSOR_HOME}:/srv --bind /cvmfs --contain"
# Various possible mount points to pull into the container:
for VAR in /lfs_roots /cms /hadoop /hdfs /mnt/hadoop /etc/cvmfs/SITECONF; do
if [ -e "$VAR" ]; then
OSG_SINGULARITY_EXTRA_OPTS="$OSG_SINGULARITY_EXTRA_OPTS --bind $VAR"
fi
done
cd /cvmfs/singularity.opensciencegrid.org
$OSG_SINGULARITY_PATH exec $OSG_SINGULARITY_EXTRA_OPTS \
--bind ${SAME_SENSOR_HOME}:/srv \
--pwd /srv \
--scratch /var/tmp \
--scratch /tmp \
--ipc --pid \
"$OSG_SINGULARITY_IMAGE_DEFAULT" \
/srv/tests/CE-cms-singularity-runner /srv/tests/${TEST_SCRIPT}
RC=$?
# If the following code executes, Singularity failed
if [ "$RC" -eq 255 ] ; then
echo "ERROR: Singularity execution of ${TEST_SCRIPT} finished with return code $RC"
echo "summary: SINGULARITY_ERROR"
exit $SAME_ERROR
fi
exit $RC
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment