You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "dongjoon-hyun (via GitHub)" <gi...@apache.org> on 2023/05/07 20:27:49 UTC

[GitHub] [spark] dongjoon-hyun commented on a diff in pull request #41077: [SPARK-43397][CORE] Log executor decommission duration

dongjoon-hyun commented on code in PR #41077:
URL: https://github.com/apache/spark/pull/41077#discussion_r1186909802


##########
core/src/main/scala/org/apache/spark/scheduler/TaskSchedulerImpl.scala:
##########
@@ -1086,11 +1086,18 @@ private[spark] class TaskSchedulerImpl(
     case ExecutorKilled =>
       logInfo(s"Executor $executorId on $hostPort killed by driver.")
     case _: ExecutorDecommission =>
-      logInfo(s"Executor $executorId on $hostPort is decommissioned.")
+      logInfo(s"Executor $executorId on $hostPort is decommissioned after " +
+        s"${Utils.msDurationToString(getDecommissionDurationMs(executorId))}.")
     case _ =>
       logError(s"Lost executor $executorId on $hostPort: $reason")
   }
 
+  private def getDecommissionDurationMs(executorId: String): Long = {
+    executorsPendingDecommission.get(executorId)
+      .map(s => clock.getTimeMillis() - s.startTime)
+      .getOrElse(0L)

Review Comment:
   Could you add a function description. Especially, describing about what is the meaning of `0L` when `executorsPendingDecommission.get` doesn't exist.



##########
core/src/main/scala/org/apache/spark/scheduler/TaskSchedulerImpl.scala:
##########
@@ -1086,11 +1086,18 @@ private[spark] class TaskSchedulerImpl(
     case ExecutorKilled =>
       logInfo(s"Executor $executorId on $hostPort killed by driver.")
     case _: ExecutorDecommission =>
-      logInfo(s"Executor $executorId on $hostPort is decommissioned.")
+      logInfo(s"Executor $executorId on $hostPort is decommissioned after " +
+        s"${Utils.msDurationToString(getDecommissionDurationMs(executorId))}.")
     case _ =>
       logError(s"Lost executor $executorId on $hostPort: $reason")
   }
 
+  private def getDecommissionDurationMs(executorId: String): Long = {
+    executorsPendingDecommission.get(executorId)
+      .map(s => clock.getTimeMillis() - s.startTime)
+      .getOrElse(0L)

Review Comment:
   Could you add a function description? Especially, describing about what is the meaning of `0L` when `executorsPendingDecommission.get` doesn't exist.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org