Skip to content

Commit 01cf4c4

Browse files
aarondavpwendell
authored andcommitted
SPARK-1404: Always upgrade spark-env.sh vars to environment vars
This was broken when spark-env.sh was made idempotent, as the idempotence check is an environment variable, but the spark-env.sh variables may not have been. Tested in zsh, bash, and sh. Author: Aaron Davidson <aaron@databricks.com> Closes #310 from aarondav/SPARK-1404 and squashes the following commits: c3406a5 [Aaron Davidson] Add extra export in spark-shell 6a0e340 [Aaron Davidson] SPARK-1404: Always upgrade spark-env.sh vars to environment vars
1 parent 7f32fd4 commit 01cf4c4

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

bin/load-spark-env.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ if [ -z "$SPARK_ENV_LOADED" ]; then
3030
use_conf_dir=${SPARK_CONF_DIR:-"$parent_dir/conf"}
3131

3232
if [ -f "${use_conf_dir}/spark-env.sh" ]; then
33+
# Promote all variable declarations to environment (exported) variables
34+
set -a
3335
. "${use_conf_dir}/spark-env.sh"
36+
set +a
3437
fi
3538
fi

bin/spark-shell

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ function set_spark_log_conf(){
127127

128128
function set_spark_master(){
129129
if ! [[ "$1" =~ $ARG_FLAG_PATTERN ]]; then
130-
MASTER="$1"
130+
export MASTER="$1"
131131
else
132132
out_error "wrong format for $2"
133133
fi
@@ -145,7 +145,7 @@ function resolve_spark_master(){
145145
fi
146146

147147
if [ -z "$MASTER" ]; then
148-
MASTER="$DEFAULT_MASTER"
148+
export MASTER="$DEFAULT_MASTER"
149149
fi
150150

151151
}

0 commit comments

Comments
 (0)