spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From andrewor14 <...@git.apache.org>
Subject [GitHub] spark pull request: SPARK-4337. [YARN] Add ability to cancel pendi...
Date Thu, 05 Feb 2015 23:29:15 GMT
Github user andrewor14 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/4141#discussion_r24210363
  
    --- Diff: yarn/src/main/scala/org/apache/spark/deploy/yarn/YarnAllocator.scala ---
    @@ -192,15 +186,32 @@ private[yarn] class YarnAllocator(
       }
     
       /**
    -   * Request numExecutors additional containers from YARN. Visible for testing.
    +   * Update the set of container requests that we will sync with the RM based on the
number of
    +   * executors we have currently running and our target number of executors.
    +   *
    +   * Visible for testing.
        */
    -  def addResourceRequests(numExecutors: Int): Unit = {
    -    for (i <- 0 until numExecutors) {
    -      val request = new ContainerRequest(resource, null, null, RM_REQUEST_PRIORITY)
    -      amClient.addContainerRequest(request)
    -      val nodes = request.getNodes
    -      val hostStr = if (nodes == null || nodes.isEmpty) "Any" else nodes.last
    -      logInfo("Container request (host: %s, capability: %s".format(hostStr, resource))
    +  def updateResourceRequests(): Unit = {
    +    val numPendingAllocate = getNumPendingAllocate
    +    val missing = targetNumExecutors - numPendingAllocate - numExecutorsRunning
    +
    +    if (missing > 0) {
    +      logInfo(s"Will request $missing executor containers, each with ${resource.getVirtualCores}
" +
    +        s"cores and ${resource.getMemory} MB memory including $memoryOverhead MB overhead")
    +
    +      for (i <- 0 until missing) {
    +        val request = new ContainerRequest(resource, null, null, RM_REQUEST_PRIORITY)
    +        amClient.addContainerRequest(request)
    +        val nodes = request.getNodes
    +        val hostStr = if (nodes == null || nodes.isEmpty) "Any" else nodes.last
    +        logInfo("Container request (host: %s, capability: %s)".format(hostStr, resource))
    --- End diff --
    
    nit: Not your code, but would be better with string interpolation


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


Mime
View raw message