From 84a72538dc1afa6405659fd60d46f74b73b3ce99 Mon Sep 17 00:00:00 2001 From: RodrigoSobral2000 Date: Mon, 25 Nov 2024 14:15:15 +0100 Subject: [PATCH] swancustomenvironments: Stop at the first error found Stop the env creation process when the first error on the requirements installation is found --- .../swancustomenvironments/scripts/builders/accpy.sh | 3 +++ .../swancustomenvironments/scripts/builders/mamba.sh | 3 +++ .../swancustomenvironments/scripts/builders/venv.sh | 3 +++ 3 files changed, 9 insertions(+) diff --git a/SwanCustomEnvironments/swancustomenvironments/scripts/builders/accpy.sh b/SwanCustomEnvironments/swancustomenvironments/scripts/builders/accpy.sh index 1c1c28d2..8167675e 100644 --- a/SwanCustomEnvironments/swancustomenvironments/scripts/builders/accpy.sh +++ b/SwanCustomEnvironments/swancustomenvironments/scripts/builders/accpy.sh @@ -20,6 +20,9 @@ eval "${ACTIVATE_ENV_CMD}" # Install packages in the environment and the same ipykernel that the Jupyter server uses _log "Installing packages from ${REQ_PATH}..." pip install -r "${REQ_PATH}" "ipykernel==${IPYKERNEL_VERSION}" ${NXCALS} ${SPARKMONITOR} ${SPARKCONNECTOR_DEPENDENCIES} 2>&1 # TODO +if [ $? -ne 0 ]; then + exit 1 +fi # -------------- HACK SECTION -------------- diff --git a/SwanCustomEnvironments/swancustomenvironments/scripts/builders/mamba.sh b/SwanCustomEnvironments/swancustomenvironments/scripts/builders/mamba.sh index 8a3efcaa..d764765a 100644 --- a/SwanCustomEnvironments/swancustomenvironments/scripts/builders/mamba.sh +++ b/SwanCustomEnvironments/swancustomenvironments/scripts/builders/mamba.sh @@ -2,6 +2,9 @@ # Create the environment, install packages and the same ipykernel that the Jupyter server uses mamba create -p ${ENV_PATH} --file ${REQ_PATH} "ipykernel==${IPYKERNEL_VERSION}" -y +if [ $? -ne 0 ]; then + exit 1 +fi # Activate the environment _log "Setting up the environment..." diff --git a/SwanCustomEnvironments/swancustomenvironments/scripts/builders/venv.sh b/SwanCustomEnvironments/swancustomenvironments/scripts/builders/venv.sh index 2e6f12d3..9e879161 100644 --- a/SwanCustomEnvironments/swancustomenvironments/scripts/builders/venv.sh +++ b/SwanCustomEnvironments/swancustomenvironments/scripts/builders/venv.sh @@ -11,3 +11,6 @@ eval "${ACTIVATE_ENV_CMD}" # Install packages in the environment and the same ipykernel that the Jupyter server uses _log "Installing packages from ${REQ_PATH}..." pip install -r "${REQ_PATH}" "ipykernel==${IPYKERNEL_VERSION}" 2>&1 +if [ $? -ne 0 ]; then + exit 1 +fi