-
Notifications
You must be signed in to change notification settings - Fork 28.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SPARK-5732][CORE]:Add an option to print the spark version in spark script. #4522
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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. | ||
|
@@ -89,6 +90,17 @@ object SparkSubmit { | |
printStream.println("Run with --help for usage help or --verbose for debug output") | ||
exitFn() | ||
} | ||
private[spark] def printVersionAndExit() = { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. need |
||
printStream.println("""Welcome to | ||
____ __ | ||
/ __/__ ___ _____/ /__ | ||
_\ \/ _ \/ _ `/ __/ '_/ | ||
/___/ .__/\_,_/_/ /_/\_\ version %s | ||
/_/ | ||
""".format(SPARK_VERSION)) | ||
printStream.println("Type --help for more information.") | ||
exitFn() | ||
} | ||
|
||
def main(args: Array[String]) { | ||
val appArgs = new SparkSubmitArguments(args) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -417,6 +417,9 @@ private[spark] class SparkSubmitArguments(args: Seq[String], env: Map[String, St | |
verbose = true | ||
parse(tail) | ||
|
||
case ("--version") :: tail => | ||
SparkSubmit.printVersionAndExit() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
|
||
case EQ_SEPARATED_OPT(opt, value) :: tail => | ||
parse(opt :: value :: tail) | ||
|
||
|
@@ -485,6 +488,7 @@ private[spark] class SparkSubmitArguments(args: Seq[String], env: Map[String, St | |
| | ||
| --help, -h Show this help message and exit | ||
| --verbose, -v Print additional debug output | ||
| --version, Print the version of current Spark | ||
| | ||
| Spark standalone with cluster deploy mode only: | ||
| --driver-cores NUM Cores for driver (Default: 1). | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would just explicitly import
SPARK_VERSION
since that's the only thing we need here