From 0ae9badcbf6a0ceeac4409ae695b5973553019db Mon Sep 17 00:00:00 2001 From: Jo Basevi Date: Wed, 18 Mar 2026 09:55:15 +1100 Subject: [PATCH] Use new apptainer singularity install to avoid transient errors --- modules/common_v3 | 2 +- scripts/install_config.sh | 2 +- scripts/launcher.sh | 10 +++++----- scripts/launcher_conf.sh | 2 +- scripts/overrides/functions.sh | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/modules/common_v3 b/modules/common_v3 index 8d41354..6a75ed5 100644 --- a/modules/common_v3 +++ b/modules/common_v3 @@ -21,7 +21,7 @@ set overlay_path [ string map {/conda/ /envs/} $basedir ].sqsh set launcher $myscripts/launcher.sh -module load singularity +module load apptainer prepend-path CONTAINER_OVERLAY_PATH $overlay_path prepend-path SINGULARITYENV_PREPEND_PATH $basedir/condabin diff --git a/scripts/install_config.sh b/scripts/install_config.sh index cd505df..5d4de2f 100644 --- a/scripts/install_config.sh +++ b/scripts/install_config.sh @@ -57,7 +57,7 @@ fi export TEST_OUT_FILE=test_results.xml export PYTHONNOUSERSITE=true export CONTAINER_PATH="${SCRIPT_DIR}"/../container/base.sif -export SINGULARITY_BINARY_PATH="/opt/singularity/bin/singularity" +export SINGULARITY_BINARY_PATH="/opt/nci/apptainer/bin/singularity" declare -a bind_dirs=( "/etc" "/half-root" "/local" "/ram" "/run" "/system" "/usr" "/var/lib/sss" "/var/lib/rpm" "/var/run/munge" "/sys/fs/cgroup" "/iointensive" ) diff --git a/scripts/launcher.sh b/scripts/launcher.sh index 06b65a4..bba6432 100755 --- a/scripts/launcher.sh +++ b/scripts/launcher.sh @@ -78,7 +78,7 @@ done $debug "PROG_ARGS =" "${PROG_ARGS[@]}" if ! [[ "${SINGULARITY_BINARY_PATH}" ]]; then - module load singularity + module load apptainer export SINGULARITY_BINARY_PATH=$( type -p singularity ) fi @@ -114,10 +114,10 @@ $debug "CONTAINER_OVERLAY_PATH after override check = " ${CONTAINER_OVERLAY_PATH export CONDA_BASE="${CONDA_BASE_ENV_PATH}/envs/${myenv}" -if ! [[ -x "${SINGULARITY_BINARY_PATH}" ]]; then - ### Short circuit detection +if [[ $(awk '/NoNewPrivs/ {print $2}' /proc/self/status) -ne 0 ]]; then + ### Short circuit detection - check process status (0 if running out outside a container) ### In some cases (e.g. mpi processes launched from orterun), launcher will be invoked from - ### within the container. The tell-tale sign for this is if /opt/singularity is missing. + ### within the container. ### The only way this can happen is if we've tried to run something that has come ### from the bin directory in scripts/env.d/bin/ - the only place these can come from is the ### bin directory of the active conda env, so just reset the path to that but keep the @@ -144,7 +144,7 @@ declare -a singularity_default_path=( '/usr/local/sbin' '/usr/local/bin' '/usr/s while IFS= read -r -d: i; do in_array "${singularity_default_path[@]}" "${i}" && continue - [[ "${i}" == "/opt/singularity/bin" ]] && continue + [[ "${i}" == "/opt/nci/apptainer/bin" ]] && continue [[ "${i}" == "${wrapper_bin}" ]] && continue SINGULARITYENV_PREPEND_PATH="${SINGULARITYENV_PREPEND_PATH}:${i}" done<<<"${PATH%:}:" diff --git a/scripts/launcher_conf.sh b/scripts/launcher_conf.sh index 34dbcb8..e2abd0a 100644 --- a/scripts/launcher_conf.sh +++ b/scripts/launcher_conf.sh @@ -1,5 +1,5 @@ ### Subject to change -export SINGULARITY_BINARY_PATH="/opt/singularity/bin/singularity" +export SINGULARITY_BINARY_PATH="/opt/nci/apptainer/bin/singularity" export CONTAINER_PATH="__CONDA_BASE__/__APPS_SUBDIR__/__CONDA_INSTALL_BASENAME__/etc/base.sif" export CONDA_BASE_ENV_PATH="__CONDA_BASE__/__APPS_SUBDIR__/__CONDA_INSTALL_BASENAME__" diff --git a/scripts/overrides/functions.sh b/scripts/overrides/functions.sh index 28fa911..73ef91f 100755 --- a/scripts/overrides/functions.sh +++ b/scripts/overrides/functions.sh @@ -11,4 +11,4 @@ function findreal { } ### Subject to change -export SINGULARITY_BINARY_PATH=/opt/singularity/bin/singularity \ No newline at end of file +export SINGULARITY_BINARY_PATH=/opt/nci/apptainer/bin/singularity \ No newline at end of file