Skip to content

Instantly share code, notes, and snippets.

@kpedro88
Last active June 14, 2021 14:49
Show Gist options
  • Save kpedro88/d47a7b40b71a8fd9bdcb4b81c51bcef6 to your computer and use it in GitHub Desktop.
Save kpedro88/d47a7b40b71a8fd9bdcb4b81c51bcef6 to your computer and use it in GitHub Desktop.
testSingularity
universe = vanilla
Executable = testSingularity.sh
+REQUIRED_OS = "rhel7"
+DesiredOS = REQUIRED_OS
request_cpus = 1
Should_Transfer_Files = YES
WhenToTransferOutput = ON_EXIT_OR_EVICT
Transfer_Input_Files = testSingularity.sh
Output = testSingularity_$(Process)_$(Cluster).stdout
Error = testSingularity_$(Process)_$(Cluster).stderr
Log = testSingularity_$(Process)_$(Cluster).condor
notification = Never
x509userproxy = $ENV(X509_USER_PROXY)
want_graceful_removal = true
on_exit_remove = (ExitBySignal == False) && (ExitCode == 0)
on_exit_hold = ( (ExitBySignal == True) || (ExitCode != 0) )
on_exit_hold_reason = strcat("Job held by ON_EXIT_HOLD due to ",\
ifThenElse((ExitBySignal == True), "exit by signal", \
strcat("exit code ",ExitCode)), ".")
job_machine_attrs = "GLIDEIN_CMSSite"
+AvoidSystemPeriodicRemove = True
+DESIRED_Sites = "T1_US_FNAL"
Queue 1
+DESIRED_Sites = "T2_US_Caltech"
Queue 1
+DESIRED_Sites = "T2_US_Florida"
Queue 1
+DESIRED_Sites = "T2_US_MIT"
Queue 1
+DESIRED_Sites = "T2_US_Nebraska"
Queue 1
+DESIRED_Sites = "T2_US_Purdue"
Queue 1
+DESIRED_Sites = "T2_US_UCSD"
Queue 1
+DESIRED_Sites = "T2_US_Vanderbilt"
Queue 1
+DESIRED_Sites = "T2_US_Wisconsin"
Queue 1
#!/bin/bash
echo "Starting job on "`date` # to display the start date
echo "Running on "`uname -a` # to display the machine where the job is running
echo "System release "`cat /etc/redhat-release` # and the system release
if type singularity >& /dev/null; then
echo "has singularity"
else
echo "missing singularity"
fi
if [ -n "$SINGULARITY_CONTAINER" ]; then
echo "in singularity container"
if grep -q "^allow setuid = no" /etc/singularity/singularity.conf; then
echo "has 'allow setuid = no'"
else
echo "missing 'allow setuid = no'"
fi
if unshare -U echo >/dev/null 2>&1; then
echo "has unprivileged user namespaces"
else
echo "missing unprivileged user namespaces"
fi
fi
echo ""
echo "Contents of /etc/singularity/singularity.conf:"
cat /etc/singularity/singularity.conf
echo ""
# try to run a singularity container
source /cvmfs/cms.cern.ch/cmsset_default.sh
cmssw-cc6 -- echo "hello world"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment