Skip to content

Commit

Permalink
use setup.sh for env
Browse files Browse the repository at this point in the history
  • Loading branch information
Tianhao-Gu committed Jun 10, 2024
1 parent 03e2d69 commit d6e9f1c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
2 changes: 1 addition & 1 deletion scripts/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -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 "$@"
Expand Down
15 changes: 5 additions & 10 deletions scripts/notebook_entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
2 changes: 2 additions & 0 deletions scripts/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d6e9f1c

Please sign in to comment.