cloud-fan commented on a change in pull request #29722:
URL: https://github.com/apache/spark/pull/29722#discussion_r487853452



##########
File path: core/src/main/scala/org/apache/spark/deploy/master/Master.scala
##########
@@ -891,16 +896,13 @@ private[deploy] class Master(
     logInfo(s"Decommissioning the workers with host:ports 
${workersToRemoveHostPorts}")
 
     // The workers are removed async to avoid blocking the receive loop for 
the entire batch
-    workersToRemove.foreach(wi => {
-      logInfo(s"Sending the worker decommission to ${wi.id} and 
${wi.endpoint}")
-      self.send(WorkerDecommission(wi.id, wi.endpoint))
-    })
+    self.send(DecommissionWorkers(workersToRemove.map(_.id).toSeq))
 
     // Return the count of workers actually removed
     workersToRemove.size
   }
 
-  private def decommissionWorker(worker: WorkerInfo): Unit = {
+  private def decommissionWorker(worker: WorkerInfo, triggeredByWorker: 
Boolean): Unit = {

Review comment:
       There is only one place calling this method with 
`triggeredByWorker=false`. I think we can keep this method unchanged, and in 
that caller side:
   ```
   case DecommissionWorkers(ids) =>
     ids.foreach ( id =>
       // We use foreach since get gives us an option and we can skip the 
failures.
       idToWorker.get(id).foreach { w =>
         decommissionWorker(w, triggeredByWorker = false))
         // Also send a message to the worker node to notify.
         worker.endpoint.send(DecommissionWorker)
       }
     )
   ```




----------------------------------------------------------------
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]



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

Reply via email to