You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2018/12/18 20:51:24 UTC

[GitHub] vanzin commented on a change in pull request #23344: [SPARK-26392][YARN] Cancel pending allocate requests by taking locality preference into a…

vanzin commented on a change in pull request #23344: [SPARK-26392][YARN] Cancel pending allocate requests by taking locality preference into a…
URL: https://github.com/apache/spark/pull/23344#discussion_r242700484
 
 

 ##########
 File path: resource-managers/yarn/src/main/scala/org/apache/spark/deploy/yarn/YarnAllocator.scala
 ##########
 @@ -374,14 +374,18 @@ private[yarn] class YarnAllocator(
       val numToCancel = math.min(numPendingAllocate, -missing)
       logInfo(s"Canceling requests for $numToCancel executor container(s) to have a new desired " +
         s"total $targetNumExecutors executors.")
-
-      val matchingRequests = amClient.getMatchingRequests(RM_REQUEST_PRIORITY, ANY_HOST, resource)
-      if (!matchingRequests.isEmpty) {
-        matchingRequests.iterator().next().asScala
-          .take(numToCancel).foreach(amClient.removeContainerRequest)
-      } else {
-        logWarning("Expected to find pending requests, but found none.")
+      // cancel pending allocate requests by taking locality preference into account
+      val cancelRequests = {
 
 Review comment:
   This could be a single statement, since `take` handles negative values.
   
   ```
   scala> Seq(1, 2, 3).take(-1)
   res0: Seq[Int] = List()
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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