Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,17 @@ if [ -z "$uidentry" ] ; then
fi

SPARK_K8S_CMD="$1"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see two possible pass-through conditions here: one is "empty SPARK_K8S_CMD" and the other is "SPARK_K8S_CMD is non empty but has non-spark command in it" Is that the convention, or is the pass-through case always expected to be "empty SPARK_K8S_CMD" ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is handled by the case block, because pass-through mode will be used either if SPARK_K8S_CMD is empty or has a non spark-on-k8s command. I tested both scenarios.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ack, I concur, this is the way the script works historically

Copy link
Contributor

@erikerlandson erikerlandson Jun 15, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And it does the right thing w.r.t. shift in both cases?
If it is non-empty but also not one of the three spark commands, shift removes the first argument, then it falls into the "passthrough" case, but then is "$@" missing the first arg?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@erikerlandson yes, after a shift the leading arg is gone from "$@"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tmckayus that seems wrong, since the CMD that gets executed after the case is now missing the first element, am I missing something?

if [ -z "$SPARK_K8S_CMD" ]; then
echo "No command to execute has been provided." 1>&2
exit 1
fi
shift 1
case "$SPARK_K8S_CMD" in
driver | driver-py | executor)
shift 1
;;
"")
;;
*)
echo "Non-spark-on-k8s command provided, proceeding in pass-through mode..."
exec /sbin/tini -s -- "$@"
;;
esac

SPARK_CLASSPATH="$SPARK_CLASSPATH:${SPARK_HOME}/jars/*"
env | grep SPARK_JAVA_OPT_ | sort -t_ -k4 -n | sed 's/[^=]*=\(.*\)/\1/g' > /tmp/java_opts.txt
Expand Down Expand Up @@ -92,7 +98,6 @@ case "$SPARK_K8S_CMD" in
"$@" $PYSPARK_PRIMARY $PYSPARK_ARGS
)
;;

executor)
CMD=(
${JAVA_HOME}/bin/java
Expand Down