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

Deactivate Conda Env In HPC Init Script #388

Merged
merged 2 commits into from
Nov 8, 2024
Merged
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
8 changes: 8 additions & 0 deletions batch/hpc_init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@ if [ -z "${FLEPI_CONDA}" ]; then
fi
echo "Using '$FLEPI_CONDA' for \$FLEPI_CONDA."
fi
CURRENT_CONDA_ENV=$( conda info | grep "active environment" | awk -F ':' '{print $2}' | xargs )
if [ "$CURRENT_CONDA_ENV" = "$FLEPI_CONDA" ]; then
echo "Detected the activate conda environment is '$FLEPI_CONDA' already, but will refresh."
conda deactivate
elif [ "$CURRENT_CONDA_ENV" != "None" ]; then
echo "Detected an active conda environment '$CURRENT_CONDA_ENV'. This will be deactivated and the '$FLEPI_CONDA' environment wil be activated."
conda deactivate
fi
conda activate $FLEPI_CONDA

# Check the conda environment is valid
Expand Down