vanzin commented on a change in pull request #26682: [SPARK-29306][CORE] Stage 
Level Sched: Executors need to track what ResourceProfile they are created with 
URL: https://github.com/apache/spark/pull/26682#discussion_r365372202
 
 

 ##########
 File path: 
core/src/main/scala/org/apache/spark/scheduler/dynalloc/ExecutorMonitor.scala
 ##########
 @@ -290,15 +310,17 @@ private[spark] class ExecutorMonitor(
   }
 
   override def onExecutorAdded(event: SparkListenerExecutorAdded): Unit = {
-    val exec = ensureExecutorIsTracked(event.executorId)
+    val exec = ensureExecutorIsTracked(event.executorId, 
event.executorInfo.resourceProfileId)
     exec.updateRunningTasks(0)
     logInfo(s"New executor ${event.executorId} has registered (new total is 
${executors.size()})")
   }
 
   override def onExecutorRemoved(event: SparkListenerExecutorRemoved): Unit = {
     val removed = executors.remove(event.executorId)
     if (removed != null) {
-      logInfo(s"Executor ${event.executorId} removed (new total is 
${executors.size()})")
+      val count = 
execResourceProfileCount.getOrDefault(removed.resourceProfileId, 0)
+      execResourceProfileCount.replace(removed.resourceProfileId, count, count 
- 1)
+      execResourceProfileCount.remove(removed.resourceProfileId, 0)
 
 Review comment:
   Minor but this could be a small helper method (since it's basically the same 
code as later when you decrement the number of unknowns).

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to