spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mgummelt <...@git.apache.org>
Subject [GitHub] spark pull request #17031: [SPARK-19702][MESOS] Add suppress/revive support ...
Date Mon, 27 Feb 2017 20:25:29 GMT
Github user mgummelt commented on a diff in the pull request:

    https://github.com/apache/spark/pull/17031#discussion_r103303283
  
    --- Diff: resource-managers/mesos/src/main/scala/org/apache/spark/scheduler/cluster/mesos/MesosClusterScheduler.scala
---
    @@ -737,13 +735,75 @@ private[spark] class MesosClusterScheduler(
         if (index != -1) {
           pendingRetryDrivers.remove(index)
           pendingRetryDriversState.expunge(id)
    +      suppressOrRevive()
           true
         } else {
           false
         }
       }
     
    -  def getQueuedDriversSize: Int = queuedDrivers.size
    -  def getLaunchedDriversSize: Int = launchedDrivers.size
    -  def getPendingRetryDriversSize: Int = pendingRetryDrivers.size
    +  private def copyBuffer(buffer: ArrayBuffer[MesosDriverDescription]):
    +      ArrayBuffer[MesosDriverDescription] = {
    +    val newBuffer = new ArrayBuffer[MesosDriverDescription](buffer.size)
    +    buffer.copyToBuffer(newBuffer)
    +    newBuffer
    +  }
    +
    +  /**
    +   * Check if the task state is a recoverable state that we can relaunch the task.
    +   * Task state like TASK_ERROR are not relaunchable state since it wasn't able
    +   * to be validated by Mesos.
    +   */
    +  private def isFailure(state: MesosTaskState): Boolean = {
    +    state == MesosTaskState.TASK_FAILED ||
    +      state == MesosTaskState.TASK_LOST
    +  }
    +
    +  private def shouldSuppress: Boolean = {
    +    return queuedDrivers.isEmpty && pendingRetryDrivers.isEmpty
    +  }
    +
    +  private def suppressOrRevive(): Unit = {
    +    if (shouldSuppress && !isSuppressed) {
    +      logInfo("Suppressing Offers.")
    +      driver.suppressOffers()
    +      isSuppressed = true
    +    } else if (!shouldSuppress && isSuppressed) {
    +      logInfo("Reviving Offers.")
    +      driver.reviveOffers()
    +      isSuppressed = false
    +    }
    +  }
    +
    +  /**
    +   * Escape args for Unix-like shells, unless already quoted by the user.
    +   * Based on: http://www.gnu.org/software/bash/manual/html_node/Double-Quotes.html
    +   * and http://www.grymoire.com/Unix/Quote.html
    +   *
    +   * @param value argument
    +   * @return escaped argument
    +   */
    +  private[scheduler] def shellEscape(value: String): String = {
    +    val WrappedInQuotes = """^(".+"|'.+')$""".r
    +    val ShellSpecialChars = (""".*([ '<>&|\?\*;!#\\(\)"$`]).*""").r
    --- End diff --
    
    see above


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