From 87b5d036439ee51df0c95ab48f6ec664ed8a66e2 Mon Sep 17 00:00:00 2001 From: mcheah Date: Fri, 3 Oct 2014 10:42:27 -0700 Subject: [PATCH] [SPARK-1860] Using more string interpolation. Better error logging. --- .../scala/org/apache/spark/deploy/worker/Worker.scala | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/core/src/main/scala/org/apache/spark/deploy/worker/Worker.scala b/core/src/main/scala/org/apache/spark/deploy/worker/Worker.scala index 919dbc5570284..3b13f43a1868c 100755 --- a/core/src/main/scala/org/apache/spark/deploy/worker/Worker.scala +++ b/core/src/main/scala/org/apache/spark/deploy/worker/Worker.scala @@ -194,8 +194,7 @@ private[spark] class Worker( changeMaster(masterUrl, masterWebUiUrl) context.system.scheduler.schedule(0 millis, HEARTBEAT_MILLIS millis, self, SendHeartbeat) if (CLEANUP_ENABLED) { - logInfo("Worker cleanup is enabled, so old application directories will be deleted" - + " in: " + workDir) + logInfo(s"Worker cleanup enabled; old application directories will be deleted in: $workDir") context.system.scheduler.schedule(CLEANUP_INTERVAL_MILLIS millis, CLEANUP_INTERVAL_MILLIS millis, self, WorkDirCleanup) } @@ -218,7 +217,7 @@ private[spark] class Worker( dir.isDirectory && !isAppStillRunning && !Utils.doesDirectoryContainAnyNewFiles(dir, APP_DATA_RETENTION_SECS) }.foreach { dir => - logInfo("Removing directory: %s".format(dir.getPath)) + logInfo(s"Removing directory: ${dir.getPath}") Utils.deleteRecursively(dir) } } @@ -267,13 +266,13 @@ private[spark] class Worker( master ! ExecutorStateChanged(appId, execId, manager.state, None, None) } catch { case e: Exception => { - logError("Failed to launch executor %s/%d for %s. Caused by exception: %s" - .format(appId, execId, appDesc.name, e.toString)) + logError(s"Failed to launch executor $appId/$execId for ${appDesc.name}.", e) if (executors.contains(appId + "/" + execId)) { executors(appId + "/" + execId).kill() executors -= appId + "/" + execId } - master ! ExecutorStateChanged(appId, execId, ExecutorState.FAILED, None, None) + master ! ExecutorStateChanged(appId, execId, ExecutorState.FAILED, + Some(e.toString), None) } } }