Skip to content
This repository has been archived by the owner on Dec 23, 2024. It is now read-only.

Replace file after environment build #70

Open
rbeucher opened this issue Feb 21, 2024 · 5 comments
Open

Replace file after environment build #70

rbeucher opened this issue Feb 21, 2024 · 5 comments

Comments

@rbeucher
Copy link

rbeucher commented Feb 21, 2024

Hi @dsroberts

In my ESMValTool deployment, I described last time, I replace some default config files in the container by binding the file to the container when I call singularity.

see here:

#!/bin/bash

version="$(basename -- $0)"
default="2.10"

if [[ $version == "esmvaltool" ]]; then
  version=$default
else
  version="${0#*_}"
fi
config_user="-B /g/data/xp65/public/apps/esmvaltool/config/config-user.yml:/opt/conda/envs/esmvaltool/lib/python3.11/site-packages/esmvalcore/config-user.yml"
config_developer="-B /g/data/xp65/public/apps/esmvaltool/config/config-developer.yml:/opt/conda/envs/esmvaltool/lib/python3.11/site-packages/esmvalcore/config-developer.yml"
config_references="-B /g/data/xp65/public/apps/esmvaltool/config/config-references.yml:/opt/conda/envs/esmvaltool/lib/python3.11/site-packages/esmvaltool/config-references.yml"

singularity run -B $HOME:$HOME -B /g:/g -B /scratch:/scratch $config_user $config_developer $config_references /g/data/xp65/public/apps/esmvaltool/singularity_images/esmvaltool_$version.sif "$@"

I suppose I could do something similar but I was wondering if you had some suggestions. You have an outside_files_to_copy list in the config file but they just copy to g

@dsroberts
Copy link
Member

Hi @rbeucher

So outside_files_to_copy is specifically for environment build time where a copy of the base environment is created on PBS Jobfs, and then mounted over the /g mountpoint. Anything in there has no effect on the final installation. In these environments, we have access to the all of Gadi's file systems, so there is no need to ever bind-mount anything from there into the container. Singularity doesn't permit bind-mounting into external squashfs anyway. In this case, I'd delete those files from the conda env squashfs and create symlinks pointing to those config files in their place, like we do for OpenMPI and UCX from Gadi /apps. You can add that step to the esmvaltool environment's build_inner.sh script.

Dale

@rbeucher
Copy link
Author

OK great. Will do that

@rbeucher
Copy link
Author

Can I do something like:

pushd "${ENV_INSTALLATION_PATH}"/lib/python3.11/site-packages/esmvaltool
rm config-references.yml
ln -sf /g/data/xp65/public/apps/esmvaltool/config/config-references.yml

@rbeucher
Copy link
Author

@dsroberts
Copy link
Member

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants