Skip to content

Commit f0e7d17

Browse files
committed
[DOP-31004] Change worker dir before start
For k8s environment use first path of $SPARK_LOCAL_DIRS as current directory for Spark executor, to ensure that this dir is always writable. Otherwise create a new temp directory
1 parent 34dd98e commit f0e7d17

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

docker/entrypoint_worker.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,16 @@ fi
5151
# SPARK-43540: add current working directory into executor classpath
5252
SPARK_CLASSPATH="$SPARK_CLASSPATH:$PWD"
5353

54+
if ! [ -n ${SPARK_LOCAL_DIRS} ]; then
55+
CURRENT_DIR=$(mktemp -d)
56+
else
57+
# /var/data/spark-local-123,/var/data/spark-local-234 -> /var/data/spark-local-123
58+
CURRENT_DIR=${SPARK_LOCAL_DIRS%%,*}
59+
fi
60+
61+
# current dir should always be writable
62+
cd "${CURRENT_DIR}"
63+
5464
case "$1" in
5565
driver)
5666
shift 1

0 commit comments

Comments
 (0)