Skip to content

Commit

Permalink
use flag file .FLAG_HOME_INITIALIZED
Browse files Browse the repository at this point in the history
  • Loading branch information
unkcpz committed Sep 20, 2024
1 parent d03ce60 commit ef49620
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,9 @@ RUN --mount=from=qe_conda_env,source=${QE_DIR},target=${QE_DIR} \
bash /usr/local/bin/before-notebook.d/42_setup-hq-computer.sh && \
python -m aiidalab_qe install-qe --computer ${HQ_COMPUTER} && \
python -m aiidalab_qe install-pseudos --source ${PSEUDO_FOLDER} && \
touch /home/${NB_USER}/work/.placeholder && \
verdi daemon stop && \
mamba run -n aiida-core-services pg_ctl stop && \
# touch /home/${NB_USER}/.FLAG_HOME_INITIALIZED && \
touch /home/${NB_USER}/.FLAG_HOME_INITIALIZED && \
cd /home/${NB_USER} && tar -cf /opt/conda/home.tar .

# STAGE 3 - Final stage
Expand Down
5 changes: 4 additions & 1 deletion before-notebook.d/00_untar-home.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -eux
home="/home/${NB_USER}"

# Untar home archive file to restore home directory if it is empty
if [[ $(ls -A ${home} | wc -l) -le 1 ]]; then
if [ ! -e $home/.FLAG_HOME_INITIALIZED ]; then
if [[ ! -f $HOME_TAR ]]; then
echo "File $HOME_TAR does not exist!"
exit 1
Expand All @@ -15,6 +15,9 @@ if [[ $(ls -A ${home} | wc -l) -le 1 ]]; then
fi

echo "Extracting $HOME_TAR to $home"
# NOTE: a tar error when deployed to k8s but at the momment not cause any issue
# tar: .: Cannot utime: Operation not permitted
# tar: .: Cannot change mode to rwxr-s---: Operation not permitted
tar -xf $HOME_TAR -C "$home"
else
echo "$home folder is not empty!"
Expand Down

0 comments on commit ef49620

Please sign in to comment.