Skip to content

Commit

Permalink
Added warning message for the situation we cannot get application id …
Browse files Browse the repository at this point in the history
…for the prefix for the name of metrics
  • Loading branch information
sarutak committed Sep 22, 2014
1 parent eea6e19 commit 36d2f7a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion core/src/main/scala/org/apache/spark/SparkContext.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 36d2f7a

Please sign in to comment.