Skip to content

Commit 87b5d03

Browse files
committed
[SPARK-1860] Using more string interpolation. Better error logging.
1 parent 802473e commit 87b5d03

File tree

1 file changed

+5
-6
lines changed
  • core/src/main/scala/org/apache/spark/deploy/worker

1 file changed

+5
-6
lines changed

core/src/main/scala/org/apache/spark/deploy/worker/Worker.scala

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,7 @@ private[spark] class Worker(
194194
changeMaster(masterUrl, masterWebUiUrl)
195195
context.system.scheduler.schedule(0 millis, HEARTBEAT_MILLIS millis, self, SendHeartbeat)
196196
if (CLEANUP_ENABLED) {
197-
logInfo("Worker cleanup is enabled, so old application directories will be deleted"
198-
+ " in: " + workDir)
197+
logInfo(s"Worker cleanup enabled; old application directories will be deleted in: $workDir")
199198
context.system.scheduler.schedule(CLEANUP_INTERVAL_MILLIS millis,
200199
CLEANUP_INTERVAL_MILLIS millis, self, WorkDirCleanup)
201200
}
@@ -218,7 +217,7 @@ private[spark] class Worker(
218217
dir.isDirectory && !isAppStillRunning &&
219218
!Utils.doesDirectoryContainAnyNewFiles(dir, APP_DATA_RETENTION_SECS)
220219
}.foreach { dir =>
221-
logInfo("Removing directory: %s".format(dir.getPath))
220+
logInfo(s"Removing directory: ${dir.getPath}")
222221
Utils.deleteRecursively(dir)
223222
}
224223
}
@@ -267,13 +266,13 @@ private[spark] class Worker(
267266
master ! ExecutorStateChanged(appId, execId, manager.state, None, None)
268267
} catch {
269268
case e: Exception => {
270-
logError("Failed to launch executor %s/%d for %s. Caused by exception: %s"
271-
.format(appId, execId, appDesc.name, e.toString))
269+
logError(s"Failed to launch executor $appId/$execId for ${appDesc.name}.", e)
272270
if (executors.contains(appId + "/" + execId)) {
273271
executors(appId + "/" + execId).kill()
274272
executors -= appId + "/" + execId
275273
}
276-
master ! ExecutorStateChanged(appId, execId, ExecutorState.FAILED, None, None)
274+
master ! ExecutorStateChanged(appId, execId, ExecutorState.FAILED,
275+
Some(e.toString), None)
277276
}
278277
}
279278
}

0 commit comments

Comments
 (0)