Skip to content

Commit b311806

Browse files
committed
Swapped last 2 arguments passed to CoarseGrainedExecutorBackend
Refactored MetricsSystem#buildRegistryName
1 parent 8a2b6ec commit b311806

File tree

2 files changed

+13
-17
lines changed

2 files changed

+13
-17
lines changed

core/src/main/scala/org/apache/spark/executor/CoarseGrainedExecutorBackend.scala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@ private[spark] object CoarseGrainedExecutorBackend extends Logging {
106106
executorId: String,
107107
hostname: String,
108108
cores: Int,
109-
workerUrl: Option[String],
110-
appId: String) {
109+
appId: String,
110+
workerUrl: Option[String]) {
111111

112112
SignalLogger.register(log)
113113

@@ -150,12 +150,12 @@ private[spark] object CoarseGrainedExecutorBackend extends Logging {
150150
System.err.println(
151151
// Worker url is used in spark standalone mode to enforce fate-sharing with worker
152152
"Usage: CoarseGrainedExecutorBackend <driverUrl> <executorId> <hostname> " +
153-
"<cores> [<workerUrl>]")
153+
"<cores> <appid> [<workerUrl>] ")
154154
System.exit(1)
155155
case 5 =>
156-
run(args(0), args(1), args(2), args(3).toInt, None, args(4))
156+
run(args(0), args(1), args(2), args(3).toInt, args(4), None)
157157
case x if x > 5 =>
158-
run(args(0), args(1), args(2), args(3).toInt, Some(args(4)), args(5))
158+
run(args(0), args(1), args(2), args(3).toInt, args(4), Some(args(5)))
159159
}
160160
}
161161
}

core/src/main/scala/org/apache/spark/metrics/MetricsSystem.scala

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -94,19 +94,15 @@ private[spark] class MetricsSystem private (val instance: String,
9494
}
9595

9696
def buildRegistryName(source: Source) = {
97-
val appNameOpt = conf.getOption("spark.app.name")
98-
val appIdOpt = conf.getOption("spark.app.id")
99-
val executorIdOpt = conf.getOption("spark.executor.id")
100-
val registryName = {
101-
if (appNameOpt.isDefined && appIdOpt.isDefined &&
102-
executorIdOpt.isDefined) {
103-
MetricRegistry.name(appIdOpt.get, appNameOpt.get,
104-
executorIdOpt.get, source.sourceName)
105-
} else {
106-
MetricRegistry.name(source.sourceName)
107-
}
97+
for {
98+
appName <- conf.getOption("spark.app.name")
99+
appId <- conf.getOption("spark.app.id")
100+
executorId <- conf.getOption("spark.executor.id")
101+
} yield {
102+
MetricRegistry.name(appId, appName, executorId, source.sourceName)
108103
}
109-
registryName
104+
}.getOrElse {
105+
MetricRegistry.name(source.sourceName)
110106
}
111107

112108
def registerSource(source: Source) {

0 commit comments

Comments
 (0)