From d6e9f1c7ce5835f46686e6034983db1a1f6db421 Mon Sep 17 00:00:00 2001 From: Tianhao-Gu Date: Mon, 10 Jun 2024 09:55:03 -0500 Subject: [PATCH] use setup.sh for env --- scripts/entrypoint.sh | 2 +- scripts/notebook_entrypoint.sh | 15 +++++---------- scripts/setup.sh | 2 ++ 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/scripts/entrypoint.sh b/scripts/entrypoint.sh index c5bf6ee..0a8eb0f 100644 --- a/scripts/entrypoint.sh +++ b/scripts/entrypoint.sh @@ -1,6 +1,6 @@ #!/bin/bash -/opt/scripts/setup.sh +. /opt/scripts/setup.sh if [ "$SPARK_MODE" = "notebook" ]; then exec /opt/scripts/notebook_entrypoint.sh "$@" diff --git a/scripts/notebook_entrypoint.sh b/scripts/notebook_entrypoint.sh index 25662cd..ccbd731 100644 --- a/scripts/notebook_entrypoint.sh +++ b/scripts/notebook_entrypoint.sh @@ -2,16 +2,11 @@ echo "starting jupyter notebook" -lowercase_usage_mode=${USAGE_MODE,,} - -case "$lowercase_usage_mode" in - dev) - export NOTEBOOK_DIR="$CDM_SHARED_DIR" - ;; - *) - export NOTEBOOK_DIR="$CDM_SHARED_DIR/user_shared_workspace" - ;; -esac +# Ensure NOTEBOOK_DIR is set +if [ -z "$NOTEBOOK_DIR" ]; then + echo "ERROR: NOTEBOOK_DIR is not set. Please run setup.sh first." + exit 1 +fi mkdir -p "$NOTEBOOK_DIR" && cd "$NOTEBOOK_DIR" diff --git a/scripts/setup.sh b/scripts/setup.sh index e7af4d7..fd611bf 100644 --- a/scripts/setup.sh +++ b/scripts/setup.sh @@ -45,9 +45,11 @@ set_environment() { case "$lowercase_usage_mode" in dev) export DATANUCLEUS_AUTO_CREATE_TABLES=true + export NOTEBOOK_DIR="$CDM_SHARED_DIR" ;; *) export DATANUCLEUS_AUTO_CREATE_TABLES=false + export NOTEBOOK_DIR="$CDM_SHARED_DIR/user_shared_workspace" ;; esac update_config