diff --git a/environments/payu-dev/build_inner.sh b/environments/payu-dev/build_inner.sh index 5935347..02f71b1 100644 --- a/environments/payu-dev/build_inner.sh +++ b/environments/payu-dev/build_inner.sh @@ -1,14 +1,10 @@ ### Custom install inner # Fix shebang headers in payu entry points (issue with pip installed packages: https://github.com/ACCESS-NRI/MED-condaenv/issues/78) -for file in ${CONDA_INSTALLATION_PATH}/envs/${FULLENV}/bin/payu-*; do - # Using payu-* to modify payu-run, payu-collate, payu-sync files +for file in ${CONDA_INSTALLATION_PATH}/envs/${FULLENV}/bin/payu*; do + # Using payu* to modify payu, payu-run, payu-collate, payu-sync files echo "Adding python header to $file" # Substitute the first line of file (e.g. 1s), if it starts with #! (regex ^#!/.*$), # with the python executable in the conda environment sed -i "1s|^#!/.*$|#!${CONDA_INSTALLATION_PATH}/envs/${FULLENV}/bin/python|" "$file" -done - -# Patch payu shebang header with outer python executable that launches a container when run. -# This means when payu submits qsub commands (e.g. payu run), it uses this python executable and launches a container on PBS job -sed -i "1s|^#!/.*$|#!${CONDA_SCRIPT_PATH}/${FULLENV}.d/bin/python|" "${CONDA_INSTALLATION_PATH}/envs/${FULLENV}/bin/payu" \ No newline at end of file +done \ No newline at end of file diff --git a/environments/payu-dev/environment.yml b/environments/payu-dev/environment.yml index 6bec45c..014555f 100644 --- a/environments/payu-dev/environment.yml +++ b/environments/payu-dev/environment.yml @@ -17,4 +17,5 @@ dependencies: - xarray - mule - um2nc - - accessnri::yamanifest \ No newline at end of file + - accessnri::yamanifest + - netcdf4=*=nompi_* \ No newline at end of file diff --git a/modules/common_v3 b/modules/common_v3 index 5f1506b..8d41354 100644 --- a/modules/common_v3 +++ b/modules/common_v3 @@ -40,8 +40,3 @@ if { [ file exists $mydir/.$module_version ] } { puts stderr "ERROR! Environment spec is missing!" exit 1 } - -### Extra env to get other things working -setenv OMPI_MCA_orte_launch_agent $myscripts/orted -setenv MAMBA_ROOT_PREFIX $prefix/$package -setenv CONDA_EXE $prefix/$package/bin/micromamba \ No newline at end of file diff --git a/scripts/build.sh b/scripts/build.sh index 807b5e6..c89a0fb 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -120,7 +120,7 @@ function inner() { done mkdir -p "${CONDA_MODULE_PATH}" copy_and_replace "${SCRIPT_DIR}"/../modules/common_v3 "${CONDA_MODULE_PATH}"/.common_v3 CONDA_BASE APPS_SUBDIR CONDA_INSTALL_BASENAME SCRIPT_SUBDIR - copy_and_replace "${SCRIPT_DIR}"/launcher_conf.sh "${CONDA_SCRIPT_PATH}"/launcher_conf.sh CONDA_BASE APPS_SUBDIR CONDA_INSTALL_BASENAME + copy_and_replace "${SCRIPT_DIR}"/launcher_conf.sh "${CONDA_SCRIPT_PATH}"/launcher_conf.sh CONDA_BASE APPS_SUBDIR CONDA_INSTALL_BASENAME CONDA_SCRIPT_PATH FULLENV ### Create symlink tree mkdir -p "${CONDA_SCRIPT_PATH}"/"${FULLENV}".d/{bin,overrides} diff --git a/scripts/launcher_conf.sh b/scripts/launcher_conf.sh index 17f7040..e3e09b0 100644 --- a/scripts/launcher_conf.sh +++ b/scripts/launcher_conf.sh @@ -1,10 +1,11 @@ ### Subject to change export SINGULARITY_BINARY_PATH="/opt/singularity/bin/singularity" export CONTAINER_PATH="__CONDA_BASE__/__APPS_SUBDIR__/__CONDA_INSTALL_BASENAME__/etc/base.sif" -if [[ "${CONDA_EXE}" ]]; then - export CONDA_BASE_ENV_PATH="${CONDA_EXE//\/bin\/micromamba/}" -else - export CONDA_BASE_ENV_PATH="__CONDA_BASE__/__APPS_SUBDIR__/__CONDA_INSTALL_BASENAME__" -fi + +export CONDA_BASE_ENV_PATH="__CONDA_BASE__/__APPS_SUBDIR__/__CONDA_INSTALL_BASENAME__" declare -a bind_dirs=( "/etc" "/half-root" "/local" "/ram" "/run" "/system" "/usr" "/var/lib/sss" "/var/run/munge" "/sys/fs/cgroup" "/iointensive" ) + +# Set up the environment launcher script path - useful for scripts, such as payu, +# to know how launch the container directly +export ENV_LAUNCHER_SCRIPT_PATH="__CONDA_SCRIPT_PATH__/__FULLENV__.d/bin/launcher.sh" \ No newline at end of file