Repository: spark
Updated Branches:
  refs/heads/branch-1.2 ff2d7bd7b -> 1f8b71868


[SPARK-5401] set executor ID before creating MetricsSystem

Author: Ryan Williams <[email protected]>

Closes #4194 from ryan-williams/metrics and squashes the following commits:

7c5a33f [Ryan Williams] set executor ID before creating MetricsSystem


Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/1f8b7186
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/1f8b7186
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/1f8b7186

Branch: refs/heads/branch-1.2
Commit: 1f8b7186813643afdb592131bfd89228ef971e74
Parents: ff2d7bd
Author: Ryan Williams <[email protected]>
Authored: Sun Jan 25 14:17:59 2015 -0800
Committer: Andrew Or <[email protected]>
Committed: Sun Jan 25 14:19:09 2015 -0800

----------------------------------------------------------------------
 core/src/main/scala/org/apache/spark/SparkEnv.scala              | 4 ++++
 core/src/main/scala/org/apache/spark/metrics/MetricsSystem.scala | 4 ++--
 2 files changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/1f8b7186/core/src/main/scala/org/apache/spark/SparkEnv.scala
----------------------------------------------------------------------
diff --git a/core/src/main/scala/org/apache/spark/SparkEnv.scala 
b/core/src/main/scala/org/apache/spark/SparkEnv.scala
index e6ebbff..5d465c5 100644
--- a/core/src/main/scala/org/apache/spark/SparkEnv.scala
+++ b/core/src/main/scala/org/apache/spark/SparkEnv.scala
@@ -330,6 +330,10 @@ object SparkEnv extends Logging {
       // Then we can start the metrics system.
       MetricsSystem.createMetricsSystem("driver", conf, securityManager)
     } else {
+      // We need to set the executor ID before the MetricsSystem is created 
because sources and
+      // sinks specified in the metrics configuration file will want to 
incorporate this executor's
+      // ID into the metrics they report.
+      conf.set("spark.executor.id", executorId)
       val ms = MetricsSystem.createMetricsSystem("executor", conf, 
securityManager)
       ms.start()
       ms

http://git-wip-us.apache.org/repos/asf/spark/blob/1f8b7186/core/src/main/scala/org/apache/spark/metrics/MetricsSystem.scala
----------------------------------------------------------------------
diff --git a/core/src/main/scala/org/apache/spark/metrics/MetricsSystem.scala 
b/core/src/main/scala/org/apache/spark/metrics/MetricsSystem.scala
index 45633e3..83e8eb7 100644
--- a/core/src/main/scala/org/apache/spark/metrics/MetricsSystem.scala
+++ b/core/src/main/scala/org/apache/spark/metrics/MetricsSystem.scala
@@ -130,8 +130,8 @@ private[spark] class MetricsSystem private (
       if (appId.isDefined && executorId.isDefined) {
         MetricRegistry.name(appId.get, executorId.get, source.sourceName)
       } else {
-        // Only Driver and Executor are set spark.app.id and spark.executor.id.
-        // For instance, Master and Worker are not related to a specific 
application.
+        // Only Driver and Executor set spark.app.id and spark.executor.id.
+        // Other instance types, e.g. Master and Worker, are not related to a 
specific application.
         val warningMsg = s"Using default name $defaultName for source because 
%s is not set."
         if (appId.isEmpty) { logWarning(warningMsg.format("spark.app.id")) }
         if (executorId.isEmpty) { 
logWarning(warningMsg.format("spark.executor.id")) }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to