Github user vanzin commented on a diff in the pull request:
https://github.com/apache/spark/pull/8758#discussion_r41050208
--- Diff:
core/src/main/scala/org/apache/spark/deploy/history/HistoryServerArguments.scala
---
@@ -30,28 +30,36 @@ private[history] class HistoryServerArguments(conf:
SparkConf, args: Array[Strin
parse(args.toList)
private def parse(args: List[String]): Unit = {
- args match {
- case ("--dir" | "-d") :: value :: tail =>
- logWarning("Setting log directory through the command line is
deprecated as of " +
- "Spark 1.1.0. Please set this through
spark.history.fs.logDirectory instead.")
- conf.set("spark.history.fs.logDirectory", value)
- System.setProperty("spark.history.fs.logDirectory", value)
- parse(tail)
+ if (args.length == 1) {
+ logWarningAndSet(args.head)
+ } else {
+ args match {
+ case ("--dir" | "-d") :: value :: tail =>
+ logWarningAndSet(value)
+ parse(tail)
- case ("--help" | "-h") :: tail =>
- printUsageAndExit(0)
+ case ("--help" | "-h") :: tail =>
+ printUsageAndExit(0)
- case ("--properties-file") :: value :: tail =>
- propertiesFile = value
- parse(tail)
+ case ("--properties-file") :: value :: tail =>
+ propertiesFile = value
+ parse(tail)
- case Nil =>
+ case Nil =>
- case _ =>
- printUsageAndExit(1)
+ case _ =>
+ printUsageAndExit(1)
+ }
}
}
+ private def logWarningAndSet(value: String): Unit = {
+ logWarning("Setting log directory through the command line is
deprecated as of " +
+ "Spark 1.1.0. Please set this through spark.history.fs.logDirectory
instead.")
+ conf.set("spark.history.fs.logDirectory", value)
+ System.setProperty("spark.history.fs.logDirectory", value)
--- End diff --
In fact, this is the cause of the latest unit test failure... which is why
system properties should be avoided.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]