Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions environments/payu-dev/build_inner.sh
Original file line number Diff line number Diff line change
@@ -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
for file in ${CONDA_INSTALLATION_PATH}/envs/${FULLENV}/bin/payu*; do
Comment thread
aidanheerdegen marked this conversation as resolved.
# Using payu-* to modify 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"
done
4 changes: 1 addition & 3 deletions modules/common_v3
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,4 @@ if { [ file exists $mydir/.$module_version ] } {
}

### 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
setenv OMPI_MCA_orte_launch_agent $myscripts/orted
2 changes: 1 addition & 1 deletion scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Comment thread
aidanheerdegen marked this conversation as resolved.

### Create symlink tree
mkdir -p "${CONDA_SCRIPT_PATH}"/"${FULLENV}".d/{bin,overrides}
Expand Down
11 changes: 6 additions & 5 deletions scripts/launcher_conf.sh
Original file line number Diff line number Diff line change
@@ -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"