Skip to content
Closed
Show file tree
Hide file tree
Changes from 13 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 @@ -958,7 +958,7 @@ private[spark] class SparkSubmit extends Logging {
throw findCause(t)
} finally {
if (!isShell(args.primaryResource) && !isSqlShell(args.mainClass) &&
!isThriftServer(args.mainClass)) {
!isThriftServer(args.mainClass) && !args.isServer) {
try {
SparkContext.getActive.foreach(_.stop())
} catch {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ private[deploy] class SparkSubmitArguments(args: Seq[String], env: Map[String, S
var submissionToKill: String = null
var submissionToRequestStatusFor: String = null
var useRest: Boolean = false // used internally
var isServer: Boolean = false // whether start as server

/** Default properties present in the currently defined defaults file. */
lazy val defaultSparkProperties: HashMap[String, String] = {
Expand Down Expand Up @@ -445,6 +446,9 @@ private[deploy] class SparkSubmitArguments(args: Seq[String], env: Map[String, S
case USAGE_ERROR =>
printUsageAndExit(1)

case IS_SERVER =>
isServer = value.toBoolean

case _ =>
error(s"Unexpected argument '$opt'.")
}
Expand Down
12 changes: 12 additions & 0 deletions core/src/test/scala/org/apache/spark/deploy/SparkSubmitSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1525,6 +1525,18 @@ class SparkSubmitSuite
conf.get(k) should be (v)
}
}

test("handles arguments with --is-server") {
val clArgs = Seq(
"--name=myApp",
"--class=org.FooBar",
"--is-server", "true",
"test.jar"
)
val appArgs = new SparkSubmitArguments(clArgs)
appArgs.name should be ("myApp")
appArgs.isServer should be (true)
}
}

object SparkSubmitSuite extends SparkFunSuite with TimeLimits {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ class SparkSubmitOptionParser {
protected final String REPOSITORIES = "--repositories";
protected final String STATUS = "--status";
protected final String TOTAL_EXECUTOR_CORES = "--total-executor-cores";
protected final String IS_SERVER = "--is-server";

// Options that do not take arguments.
protected final String HELP = "--help";
Expand Down Expand Up @@ -115,6 +116,7 @@ class SparkSubmitOptionParser {
{ REPOSITORIES },
{ STATUS },
{ TOTAL_EXECUTOR_CORES },
{ IS_SERVER },
};

/**
Expand Down