-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor job submission and environment setup for CREST integration
- Loading branch information
Showing
3 changed files
with
49 additions
and
36 deletions.
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
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 |
---|---|---|
@@ -1,43 +1,43 @@ | ||
#!/bin/bash -l | ||
|
||
# Check if Micromamba is installed | ||
if [ -x "$(command -v micromamba)" ]; then | ||
echo "Micromamba is installed." | ||
COMMAND_PKG=micromamba | ||
if [[ -x "$(command -v micromamba)" ]]; then | ||
echo "Micromamba is installed." | ||
COMMAND_PKG=micromamba | ||
# Check if Mamba is installed | ||
elif [ -x "$(command -v mamba)" ]; then | ||
echo "Mamba is installed." | ||
COMMAND_PKG=mamba | ||
elif [[ -x "$(command -v mamba)" ]]; then | ||
echo "Mamba is installed." | ||
COMMAND_PKG=mamba | ||
# Check if Conda is installed | ||
elif [ -x "$(command -v conda)" ]; then | ||
echo "Conda is installed." | ||
COMMAND_PKG=conda | ||
elif [[ -x "$(command -v conda)" ]]; then | ||
echo "Conda is installed." | ||
COMMAND_PKG=conda | ||
else | ||
echo "Micromamba, Mamba, and Conda are not installed. Please download and install one of them - we strongly recommend Micromamba or Mamba." | ||
exit 1 | ||
echo "Micromamba, Mamba, and Conda are not installed. Please download and install one of them - we strongly recommend Micromamba or Mamba." | ||
exit 1 | ||
fi | ||
|
||
# Set up Conda/Micromamba environment | ||
if [ "$COMMAND_PKG" = "micromamba" ]; then | ||
eval "$(micromamba shell hook --shell=bash)" | ||
micromamba activate base | ||
BASE=$MAMBA_ROOT_PREFIX | ||
# shellcheck source=/dev/null | ||
. "$BASE/etc/profile.d/micromamba.sh" | ||
if [[ ${COMMAND_PKG} == "micromamba" ]]; then | ||
eval "$(micromamba shell hook --shell=bash)" | ||
micromamba activate base | ||
BASE=${MAMBA_ROOT_PREFIX} | ||
# shellcheck source=/dev/null | ||
. "${BASE}/etc/profile.d/micromamba.sh" | ||
else | ||
BASE=$(conda info --base) | ||
# shellcheck source=/dev/null | ||
. "$BASE/etc/profile.d/conda.sh" | ||
BASE=$(conda info --base) | ||
# shellcheck source=/dev/null | ||
. "${BASE}/etc/profile.d/conda.sh" | ||
fi | ||
|
||
# create the environment | ||
echo "Creating the Crest environment..." | ||
$COMMAND_PKG create -n crest_env -c conda-forge python=3.10 crest=2.12 -y | ||
${COMMAND_PKG} create -n crest_env -c conda-forge python=3.10 crest=2.12 -y | ||
# Activate the environment | ||
if [ "$COMMAND_PKG" == "micromamba" ]; then | ||
micromamba activate crest_env | ||
if [[ ${COMMAND_PKG} == "micromamba" ]]; then | ||
micromamba activate crest_env | ||
else | ||
conda activate crest_env | ||
conda activate crest_env | ||
fi | ||
|
||
echo "Done installing Crest environment." |