attilapiros commented on a change in pull request #35172:
URL: https://github.com/apache/spark/pull/35172#discussion_r804315807



##########
File path: 
core/src/main/scala/org/apache/spark/scheduler/cluster/CoarseGrainedSchedulerBackend.scala
##########
@@ -260,9 +266,27 @@ class CoarseGrainedSchedulerBackend(scheduler: 
TaskSchedulerImpl, val rpcEnv: Rp
               
.resourceProfileFromId(resourceProfileId).getNumSlotsPerAddress(rName, conf)
             (info.name, new ExecutorResourceInfo(info.name, info.addresses, 
numParts))
           }
+          // If we've requested the executor figure out when we did.
+          val reqTs: Option[Long] = 
CoarseGrainedSchedulerBackend.this.synchronized {
+            execRequestTimes.get(resourceProfileId).flatMap {
+              times =>
+              times.headOption.map {
+                h =>
+                // Take off the top element
+                times.dequeue()
+                // If we requested more than one exec reduce the req count by 
1 and prepend it back
+                if (h._1 > 1) {
+                  ((h._1 - 1, h._2)) +=: times

Review comment:
       My bad I mixed the operators, now I see:
   ```scala
   scala> import scala.collection.mutable.Queue
   import scala.collection.mutable.Queue
   
   scala> val times = Queue[(Int, Int)]()
   times: scala.collection.mutable.Queue[(Int, Int)] = Queue()
   
   scala> times += 2 -> 1
   res1: times.type = Queue((2,1))
   
   scala> times += 2 -> 2
   res2: times.type = Queue((2,1), (2,2))
   
   scala> times += 2 -> 3
   res3: times.type = Queue((2,1), (2,2), (2,3))
   
   scala> times.dequeue()
   res4: (Int, Int) = (2,1)
   
   scala> (1 -> 1) +=: times
   res5: times.type = Queue((1,1), (2,2), (2,3))
   ```




-- 
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: [email protected]

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