Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clean up local tmp if it has been saved to a tarball #267

Open
wants to merge 3 commits into
base: 2023.06-software.eessi.io
Choose a base branch
from
Open
Changes from all 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
20 changes: 20 additions & 0 deletions bot/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -196,4 +196,24 @@ echo " -- ./create_tarball.sh ${TMP_IN_CONTAINER} ${EESSI_PI
./eessi_container.sh "${COMMON_ARGS[@]}" "${TARBALL_STEP_ARGS[@]}" \
-- ./create_tarball.sh ${TMP_IN_CONTAINER} ${EESSI_PILOT_VERSION} ${EESSI_SOFTWARE_SUBDIR_OVERRIDE} /eessi_bot_job/${TGZ} 2>&1 | tee -a ${tar_outerr}

function check_tmp_tarball {
dir=$1
ls ${dir} | grep -E 'tgz$|\.gz$'
return $?
}

# clean storage used on local disk
if [[ -d ${STORAGE} ]]; then
# double-check that at least one tarball of the temporary storage was created
if check_tmp_tarball ${TARBALL_TMP_BUILD_STEP_DIR} || check_tmp_tarball ${TARBALL_TMP_TARBALL_STEP_DIR}; then
echo "Removing temporary storage under '${STORAGE}'"
rm -rf ${STORAGE}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I understand things correctly, $STORAGE refers to the base directory where all jobs create their unique subdirectory? In that case, shouldn't we only remove ${JOB_STORAGE} here, as there may be other (running) jobs on the same machine?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think, that's right.

Surprisingly, this ${JOB_STORAGE} is just created (a subdirectory under ${STORAGE}) but it is never used.

We should do two things

  • replace uses of ${STORAGE} by ${JOB_STORAGE} when running eessi_container.sh and test properly if that still works (maybe a separate PR would be beneficial)
  • replace uses of ${STORAGE} by ${JOB_STORAGE} in this PR here such that only job specific job temporary storage is removed

else
echo "Did not find any tarball containing the temporary storage for neither the"
echo "build nor the tar step. Hence, not removing the storage at '${STORAGE}'."
fi
else
echo "Local disk storage at '${STORAGE}' not accessible, so wasn't cleaned up."
fi

exit 0