Github user jerryshao commented on a diff in the pull request:

    https://github.com/apache/spark/pull/10412#discussion_r66532121
  
    --- Diff: 
yarn/src/main/scala/org/apache/spark/deploy/yarn/YarnAllocator.scala ---
    @@ -399,40 +402,61 @@ private[yarn] class YarnAllocator(
        */
       private def runAllocatedContainers(containersToUse: 
ArrayBuffer[Container]): Unit = {
         for (container <- containersToUse) {
    -      numExecutorsRunning += 1
    -      assert(numExecutorsRunning <= targetNumExecutors)
    +      executorIdCounter += 1
           val executorHostname = container.getNodeId.getHost
           val containerId = container.getId
    -      executorIdCounter += 1
           val executorId = executorIdCounter.toString
    -
           assert(container.getResource.getMemory >= resource.getMemory)
    -
           logInfo("Launching container %s for on host %s".format(containerId, 
executorHostname))
    -      executorIdToContainer(executorId) = container
    -      containerIdToExecutorId(container.getId) = executorId
    -
    -      val containerSet = 
allocatedHostToContainersMap.getOrElseUpdate(executorHostname,
    -        new HashSet[ContainerId])
    -
    -      containerSet += containerId
    -      allocatedContainerToHostMap.put(containerId, executorHostname)
    -
    -      val executorRunnable = new ExecutorRunnable(
    -        container,
    -        conf,
    -        sparkConf,
    -        driverUrl,
    -        executorId,
    -        executorHostname,
    -        executorMemory,
    -        executorCores,
    -        appAttemptId.getApplicationId.toString,
    -        securityMgr)
    +
    +      def updateInternalState(): Unit = synchronized {
    +        numExecutorsRunning += 1
    +        assert(numExecutorsRunning <= targetNumExecutors)
    +        executorIdToContainer(executorId) = container
    +        containerIdToExecutorId(container.getId) = executorId
    +
    +        val containerSet = 
allocatedHostToContainersMap.getOrElseUpdate(executorHostname,
    +          new HashSet[ContainerId])
    +        containerSet += containerId
    +        allocatedContainerToHostMap.put(containerId, executorHostname)
    +      }
    +
           if (launchContainers) {
             logInfo("Launching ExecutorRunnable. driverUrl: %s,  
executorHostname: %s".format(
               driverUrl, executorHostname))
    -        launcherPool.execute(executorRunnable)
    +
    +        val future = Future {
    --- End diff --
    
    @vanzin , what is the potential problem of using Scala Future and implicit 
value?


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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

Reply via email to