Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 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
5 changes: 5 additions & 0 deletions core/src/main/scala/org/apache/spark/deploy/SparkSubmit.scala
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import org.apache.ivy.plugins.resolver.{ChainResolver, IBiblioResolver}
import org.apache.spark.deploy.rest._
import org.apache.spark.executor._
import org.apache.spark.util.{ChildFirstURLClassLoader, MutableURLClassLoader, Utils}
import org.apache.spark

/**
* Whether to submit, kill, or request the status of an application.
Expand Down Expand Up @@ -89,6 +90,10 @@ object SparkSubmit {
printStream.println("Run with --help for usage help or --verbose for debug output")
exitFn()
}
private[spark] def printVersionAndExit() = {
Copy link
Contributor

Choose a reason for hiding this comment

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

need Unit return type

printStream.println(s"Spark Version: ${spark.SPARK_VERSION}")
exitFn()
}

def main(args: Array[String]) {
val appArgs = new SparkSubmitArguments(args)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -413,10 +413,13 @@ private[spark] class SparkSubmitArguments(args: Seq[String], env: Map[String, St
case ("--help" | "-h") :: tail =>
printUsageAndExit(0)

case ("--verbose" | "-v") :: tail =>
case ("--verbose") :: tail =>
verbose = true
parse(tail)

case ("--version" | "-v") :: tail =>
Copy link
Member

Choose a reason for hiding this comment

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

Eh, I don't think you should just change behavior of -v!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it remains open to question.

Copy link
Contributor

Choose a reason for hiding this comment

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

IMHO it would be better to keep the compatible behavior to the old version, not to change -v.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK, I will remain the behavior of -v

SparkSubmit.printVersionAndExit()
Copy link
Member

Choose a reason for hiding this comment

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

Some binaries, like Java, don't exit just because the version is printed. Rather than push some flow control and exit from the argument parsing code, this could become another flag in the args object, that later causes version to print in the normal flow.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

IMHO, we may just need to print the version information as simply as possible, just like what the option help dose.


case EQ_SEPARATED_OPT(opt, value) :: tail =>
parse(opt :: value :: tail)

Expand Down Expand Up @@ -484,7 +487,8 @@ private[spark] class SparkSubmitArguments(args: Seq[String], env: Map[String, St
| --proxy-user NAME User to impersonate when submitting the application.
|
| --help, -h Show this help message and exit
| --verbose, -v Print additional debug output
| --verbose, Print additional debug output
| --version, -v Print the version of current Spark
|
| Spark standalone with cluster deploy mode only:
| --driver-cores NUM Cores for driver (Default: 1).
Expand Down