forked from EESSI/software-layer
-
Notifications
You must be signed in to change notification settings - Fork 1
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
Add a script that can install EESSI-extend if it doesn't exist #76
Open
ocaisa
wants to merge
2
commits into
trz42:easystacks_arg_and_bootstrap_fixes
Choose a base branch
from
ocaisa:easystacks_arg_and_bootstrap_fixes
base: easystacks_arg_and_bootstrap_fixes
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
# Script to load the environment module for EESSI-extend. | ||
# If that module is not available yet, a specific version will be installed using the latest EasyBuild. | ||
# | ||
# This script must be sourced, since it makes changes in the current environment, like loading an EESSI-extend module. | ||
# | ||
# This script is part of the EESSI software layer, see | ||
# https://github.com/EESSI/software-layer.git | ||
# | ||
# author: Kenneth Hoste (@boegel, HPC-UGent) | ||
# author: Alan O'Cais (@ocaisa, CECAM) | ||
# | ||
# license: GPLv2 | ||
# | ||
# | ||
set -o pipefail | ||
|
||
if [ $# -ne 1 ]; then | ||
echo "Usage: $0 <EESSI-extend version>" >&2 | ||
exit 1 | ||
fi | ||
|
||
EESSI_EXTEND_VERSION="${1}-easybuild" | ||
|
||
# make sure that environment variables that we expect to be set are indeed set | ||
if [ -z "${TMPDIR}" ]; then | ||
echo "\$TMPDIR is not set" >&2 | ||
exit 2 | ||
fi | ||
|
||
# ${EB} is used to specify which 'eb' command should be used; | ||
# can potentially be more than just 'eb', for example when using 'eb --optarch=GENERIC' | ||
if [ -z "${EB}" ]; then | ||
echo "\$EB is not set" >&2 | ||
exit 2 | ||
fi | ||
|
||
# make sure that utility functions are defined (cfr. scripts/utils.sh script in EESSI/software-layer repo) | ||
type check_exit_code | ||
if [ $? -ne 0 ]; then | ||
echo "check_exit_code function is not defined" >&2 | ||
exit 3 | ||
fi | ||
|
||
echo ">> Checking for EESSI-extend module..." | ||
|
||
ml_av_eessi_extend_out=${TMPDIR}/ml_av_eessi_extend.out | ||
module avail 2>&1 | grep -i EESSI-extend/${EESSI_EXTEND_VERSION} &> ${ml_av_eessi_extend_out} | ||
|
||
if [[ $? -eq 0 ]]; then | ||
echo_green ">> Module for EESSI-extend/${EESSI_EXTEND_VERSION} found!" | ||
else | ||
echo_yellow ">> No module yet for EESSI-extend/${EESSI_EXTEND_VERSION}, installing it..." | ||
|
||
EB_TMPDIR=${TMPDIR}/ebtmp | ||
echo ">> Using temporary installation of EasyBuild (in ${EB_TMPDIR})..." | ||
pip_install_out=${TMPDIR}/pip_install.out | ||
pip3 install --prefix ${EB_TMPDIR} easybuild &> ${pip_install_out} | ||
|
||
# keep track of original $PATH and $PYTHONPATH values, so we can restore them | ||
ORIG_PATH=${PATH} | ||
ORIG_PYTHONPATH=${PYTHONPATH} | ||
|
||
echo ">> Final installation in ${EASYBUILD_INSTALLPATH}..." | ||
export PATH=${EB_TMPDIR}/bin:${PATH} | ||
export PYTHONPATH=$(ls -d ${EB_TMPDIR}/lib/python*/site-packages):${PYTHONPATH} | ||
eb_install_out=${TMPDIR}/eb_install.out | ||
Comment on lines
+55
to
+66
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, this looks odd to me. Should we not rely on having at least one EasyBuild module already in the stack? If there is none, then we should just stop the installation of the extend module. |
||
ok_msg="EESSI-extend/${EESSI_EXTEND_VERSION} installed, let's go!" | ||
fail_msg="Installing EESSI-extend/${EESSI_EXTEND_VERSION} failed, that's not good... (output: ${eb_install_out})" | ||
${EB} "EESSI-extend-${EESSI_EXTEND_VERSION}.eb" 2>&1 | tee ${eb_install_out} | ||
check_exit_code $? "${ok_msg}" "${fail_msg}" | ||
|
||
# restore origin $PATH and $PYTHONPATH values, and clean up environment variables that are no longer needed | ||
export PATH=${ORIG_PATH} | ||
export PYTHONPATH=${ORIG_PYTHONPATH} | ||
unset EB_TMPDIR ORIG_PATH ORIG_PYTHONPATH | ||
|
||
module --ignore-cache avail EESSI-extend/${EESSI_EXTEND_VERSION} &> ${ml_av_eessi_extend_out} | ||
if [[ $? -eq 0 ]]; then | ||
echo_green ">> EESSI-extend/${EESSI_EXTEND_VERSION} module installed!" | ||
else | ||
fatal_error "EESSI-extend/${EESSI_EXTEND_VERSION} module failed to install?! (output of 'pip install' in ${pip_install_out}, output of 'eb' in ${eb_install_out}, output of 'module avail EESSI-extend' in ${ml_av_eessi_extend_out})" | ||
fi | ||
fi | ||
|
||
echo ">> Loading EESSI-extend/${EESSI_EXTEND_VERSION} module..." | ||
module --ignore-cache load EESSI-extend/${EESSI_EXTEND_VERSION} | ||
|
||
unset EESSI_EXTEND_VERSION |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because the new script checks if the module exists, the whole block starting at line 282 and ending at line 292 could be replaced with the
source load_eessi_extend...
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost, issue is that the script relies on
$EASYBUILD_INSTALLPATH
... so setting this plus sourcing the script could be sufficient.