Skip to content

Commit

Permalink
Fix more stderr redirects. Install conda-build into the base environm…
Browse files Browse the repository at this point in the history
  • Loading branch information
tskisner committed Feb 13, 2024
1 parent ac3a3a3 commit 5865d0f
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 30 deletions.
3 changes: 0 additions & 3 deletions config/common.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
# These are low-level tools needed to build local packages
# and parse pip dependencies with pipgrip.
#
conda-build
conda-verify
compilers
setuptools
pip
wheel
Expand Down
28 changes: 14 additions & 14 deletions deploy/install_nersc_tag.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ fi
# always created.

# Update the persistent git checkout and find the most recent tag
pushd "${git_dir}" >/dev/null 2>&1
pushd "${git_dir}" 2>&1 >/dev/null
git checkout main
git fetch --tags
git rebase origin/main
git remote prune origin
latest=$(git describe --tags $(git rev-list --tags --max-count=1))
popd >/dev/null 2>&1
popd 2>&1 >/dev/null

# See if we already have this tag installed
found=no
Expand Down Expand Up @@ -74,7 +74,7 @@ today=$(date +%Y%m%d)
log_file="${log_dir}/check_tags_${host}_${now}"

# Create the log file
echo "Starting at ${now}" > "${log_file}" 2>&1
echo "Starting at ${now}" 2>&1 > "${log_file}"

# Get the module file version that will be installed
mod_ver="${today}_${latest}"
Expand All @@ -83,26 +83,26 @@ send_log=no
annoy="${git_dir}/.already_annoyed"
remain=$(get_common_free_gb)
if (( remain < typical )); then
echo "Only ${remain} GB are available in /global/common/software/sobs" >> "${log_file}" 2>&1
echo "Installing latest tag requires approximately ${typical} GB" >> "${log_file}" 2>&1
echo "SKIPPING until disk space is cleared." >> "${log_file}" 2>&1
echo "Only ${remain} GB are available in /global/common/software/sobs" 2>&1 >> "${log_file}"
echo "Installing latest tag requires approximately ${typical} GB" 2>&1 >> "${log_file}"
echo "SKIPPING until disk space is cleared." 2>&1 >> "${log_file}"
if [ ! -e "${annoy}" ]; then
send_log=yes
touch "${annoy}"
fi
else
send_log=yes
rm -f "${git_dir}/.already_annoyed"
echo "Latest tag '${latest}' not found, installing..." >> "${log_file}" 2>&1
echo "Note: ${remain} GB are available in /global/common/software/sobs" >> "${log_file}" 2>&1
echo "Installing latest tag requires approximately ${typical} GB" >> "${log_file}" 2>&1
echo "Latest tag '${latest}' not found, installing..." 2>&1 >> "${log_file}"
echo "Note: ${remain} GB are available in /global/common/software/sobs" 2>&1 >> "${log_file}"
echo "Installing latest tag requires approximately ${typical} GB" 2>&1 >> "${log_file}"
install_log=$(eval "${git_dir}/deploy/install_${host}.sh" "${latest}")
if [ -f "${install_log}" ]; then
# There were no errors, and the log file was returned
cat "${install_log}" >> "${log_file}" 2>&1
cat "${install_log}" 2>&1 >> "${log_file}"
else
# The script must have printed out some errors
echo "${install_log}" >> "${log_file}" 2>&1
echo "${install_log}" 2>&1 >> "${log_file}"
fi
fi

Expand All @@ -114,7 +114,7 @@ if [ -e "${mod_latest}" ]; then
rm -f "${mod_dir}/stable.lua" \
&& ln -s "${mod_latest}" "${mod_dir}/stable.lua"
else
echo "ERROR: module file ${mod_latest} was not created- leaving stable symlink" >> "${log_file}" 2>&1
echo "ERROR: module file ${mod_latest} was not created- leaving stable symlink" 2>&1 >> "${log_file}"
fi

echo "Finished installing tag '${latest}' on host ${NERSC_HOST} at $(date +%Y%m%d-%H%M%S)" >> "${log_file}"
Expand All @@ -124,14 +124,14 @@ if [ "${send_log}" = "yes" ]; then
slack_web_hook=${SLACKBOT_SOCONDA}

if [ "x${slack_web_hook}" = "x" ]; then
echo "Environment variable SLACKBOT_SOCONDA not set- skipping notifications" >> "${log_file}" 2>&1
echo "Environment variable SLACKBOT_SOCONDA not set- skipping notifications" 2>&1 >> "${log_file}"
else
# Create the JSON payload.
slackjson="${log_file}_slack.json"
headtail=12
echo -e "{\"text\":\"soconda install tag (log at \`${log_file}\`):\n\`\`\`$(head -n ${headtail} ${log_file} | sed -e "s|'|\\\'|g")\`\`\`\n(Snip)\n\`\`\`$(tail -n ${headtail} ${log_file} | sed -e "s|'|\\\'|g")\`\`\`\"}" > "${slackjson}"
# Post it.
slackerror=$(curl -X POST -H 'Content-type: application/json' --data "$(cat ${slackjson})" ${slack_web_hook})
echo "Slack API post ${slackerror}" >> "${log_file}" 2>&1
echo "Slack API post ${slackerror}" 2>&1 >> "${log_file}"
fi
fi
13 changes: 7 additions & 6 deletions deploy/install_perlmutter.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,13 @@ if [ -d "${clone_dir}" ]; then
rm -rf "${clone_dir}"
fi

git clone --depth=1 --single-branch --branch=${version} https://github.com/simonsobs/soconda.git "${clone_dir}" >> "${logfile}" 2>&1
git clone --depth=1 --single-branch --branch=${version} https://github.com/simonsobs/soconda.git "${clone_dir}" 2>&1 >> "${logfile}"

# Activate the base environment and keep it up to date.
source "${base_dir}/etc/profile.d/conda.sh"
conda activate base >> "${logfile}" 2>&1
conda update --yes --all -n base >> "${logfile}" 2>&1
conda activate base 2>&1 >> "${logfile}"
conda update --yes -n base conda conda-build 2>&1 >> "${logfile}"
conda update --yes --all -n base 2>&1 >> "${logfile}"

# Build things from the temp directory

Expand All @@ -68,14 +69,14 @@ eval "${clone_dir}/soconda.sh" \
-c "perlmutter" \
-e "${env_name}" \
-v "${env_version}" \
-m "${module_dir}" >> "${logfile}" 2>&1
-m "${module_dir}" 2>&1 >> "${logfile}"

popd 2>&1 >/dev/null
popd 2>&1 >/dev/null

# Update permissions
chmod -R g-w,g+rX "${env_name}_${env_version}" >> "${logfile}" 2>&1
chmod -R g-w,g+rX "${module_dir}/soconda" >> "${logfile}" 2>&1
chmod -R g-w,g+rX "${env_name}_${env_version}" 2>&1 >> "${logfile}"
chmod -R g-w,g+rX "${module_dir}/soconda" 2>&1 >> "${logfile}"

# Return name of log file
echo "${logfile}"
7 changes: 1 addition & 6 deletions soconda.sh
Original file line number Diff line number Diff line change
Expand Up @@ -230,11 +230,6 @@ fi
# conda command is availabe in both micromamba and miniforge installation.
# If you run $(which conda) command it should return $CONDA_PREFIX/bin/conda
# in both cases.
mkdir -p "${CONDA_PREFIX}/conda-bld"
conda index "${CONDA_PREFIX}/conda-bld"
conda config \
--file "${CONDA_PREFIX}/.condarc" \
--add channels "file://${CONDA_PREFIX}/conda-bld"

while IFS='' read -r line || [[ -n "${line}" ]]; do
# Is this line commented?
Expand All @@ -258,7 +253,7 @@ conda build purge
rm -rf "${conda_tmp}" &> /dev/null

# Remove /tmp/pixell-* test files create by pixell/setup.py
find /tmp -maxdepth 1 -type f -name 'pixell-*' -exec rm {} \;
find "/tmp" -maxdepth 1 -type f -name 'pixell-*' -exec rm {} \;


# Install pip packages. We install one package at a time
Expand Down
2 changes: 1 addition & 1 deletion tools/bootstrap_base.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ bash "${inst}" -b -f -p "${base}"
source "${base}/etc/profile.d/conda.sh"
conda activate base
conda update -n base --yes conda
conda install -n base --yes conda-libmamba-solver
conda install -n base --yes conda-libmamba-solver conda-build
conda deactivate

# Create base config file
Expand Down

0 comments on commit 5865d0f

Please sign in to comment.