Skip to content

Commit 08fd788

Browse files
committed
Warn against external usages of SparkSubmitDriverBootstrapper
1 parent ff34728 commit 08fd788

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

bin/spark-class

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,8 @@ if [ -n "$SPARK_SUBMIT_BOOTSTRAP_DRIVER" ]; then
167167
export CLASSPATH
168168
export JAVA_OPTS
169169
export OUR_JAVA_MEM
170-
shift
170+
export SPARK_CLASS=1
171+
shift # Ignore main class and use our own
171172
exec "$RUNNER" org.apache.spark.deploy.SparkSubmitDriverBootstrapper "$@"
172173
else
173174
# Note: The format of this command is closely echoed in SparkSubmitDriverBootstrapper.scala

core/src/main/scala/org/apache/spark/deploy/SparkSubmitDriverBootstrapper.scala

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,13 @@ private[spark] object SparkSubmitDriverBootstrapper {
3737
// Any changes made there must be reflected in this file.
3838

3939
def main(args: Array[String]): Unit = {
40+
41+
// This should be called only from `bin/spark-class`
42+
if (!sys.env.contains("SPARK_CLASS")) {
43+
System.err.println("SparkSubmitDriverBootstrapper must be called from `bin/spark-class`!")
44+
System.exit(1)
45+
}
46+
4047
val submitArgs = args
4148
val runner = sys.env("RUNNER")
4249
val classpath = sys.env("CLASSPATH")

0 commit comments

Comments
 (0)