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

    https://github.com/apache/spark/pull/17031#discussion_r103280797
  
    --- 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 --
    
    Parentheses are redundant. 


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