From 36d2f7a6983d7bb55ea57b513263b661f05ad6d1 Mon Sep 17 00:00:00 2001 From: Kousuke Saruta Date: Mon, 22 Sep 2014 14:09:45 +0900 Subject: [PATCH] Added warning message for the situation we cannot get application id for the prefix for the name of metrics --- core/src/main/scala/org/apache/spark/SparkContext.scala | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/src/main/scala/org/apache/spark/SparkContext.scala b/core/src/main/scala/org/apache/spark/SparkContext.scala index 16840eeb2f5c9..5ef8be5cfb150 100644 --- a/core/src/main/scala/org/apache/spark/SparkContext.scala +++ b/core/src/main/scala/org/apache/spark/SparkContext.scala @@ -310,7 +310,11 @@ class SparkContext(config: SparkConf) extends Logging { // constructor taskScheduler.start() - val appId = taskScheduler.applicationId().getOrElse(System.currentTimeMillis().toString) + val appId = taskScheduler.applicationId().getOrElse({ + logWarning("Failed to get unique Application ID. " + + "Instead of Application ID, UNIX time is used for the prefix of the name of metrics.") + System.currentTimeMillis().toString + }) conf.set("spark.app.id", appId) val metricsSystem = env.metricsSystem