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-6287][MESOS] Add dynamic allocation to ...
Date Thu, 02 Jul 2015 21:31:59 GMT
Github user andrewor14 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/4984#discussion_r33825030
  
    --- Diff: core/src/main/scala/org/apache/spark/scheduler/cluster/mesos/CoarseMesosSchedulerBackend.scala
---
    @@ -264,17 +286,33 @@ private[spark] class CoarseMesosSchedulerBackend(
     
       override def frameworkMessage(d: SchedulerDriver, e: ExecutorID, s: SlaveID, b: Array[Byte])
{}
     
    -  override def slaveLost(d: SchedulerDriver, slaveId: SlaveID) {
    -    logInfo("Mesos slave lost: " + slaveId.getValue)
    -    synchronized {
    -      if (slaveIdsWithExecutors.contains(slaveId.getValue)) {
    -        // Note that the slave ID corresponds to the executor ID on that slave
    -        slaveIdsWithExecutors -= slaveId.getValue
    -        removeExecutor(slaveId.getValue, "Mesos slave lost")
    +  /** Called when a slave is lost or a Mesos task finished. Update local view on
    +   *  what tasks are running and remove the terminated slave from the list of pending
    +   *  slave IDs that we might have asked to be killed. It also notifies the driver
    +   *  that an executor was removed.
    +   */
    +  private def executorTerminated(d: SchedulerDriver, slaveId: String, reason: String)
{
    +    stateLock.synchronized {
    +      if (slaveIdsWithExecutors.contains(slaveId)) {
    +        val slaveIdToTaskId = taskIdToSlaveId.inverse()
    +        if (slaveIdToTaskId.contains(slaveId)) {
    +          val taskId: Int = slaveIdToTaskId.get(slaveId)
    +          taskIdToSlaveId.remove(taskId)
    +          removeExecutor(sparkExecutorId(slaveId, taskId.toString), reason)
    +        }
    +        pendingRemovedSlaveIds -= slaveId
    +        slaveIdsWithExecutors -= slaveId
           }
         }
       }
     
    +  private def sparkExecutorId(slaveId: String, taskId: String) = "%s/%s".format(slaveId,
taskId)
    --- End diff --
    
    We have inferred types for vals everywhere, but I think we try to enforce it for even
small methods.


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