Class MaxRunningAppsEnforcer

java.lang.Object
org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.MaxRunningAppsEnforcer

public class MaxRunningAppsEnforcer extends Object
Handles tracking and enforcement for user and queue maxRunningApps constraints
  • Constructor Details

    • MaxRunningAppsEnforcer

      public MaxRunningAppsEnforcer(FairScheduler scheduler)
  • Method Details

    • canAppBeRunnable

      public boolean canAppBeRunnable(FSQueue queue, FSAppAttempt attempt)
      Checks whether making the application runnable would exceed any maxRunningApps limits.
      Parameters:
      queue - the current queue
      attempt - the app attempt being checked
      Returns:
      true if the application is runnable; false otherwise
    • exceedUserMaxApps

      public boolean exceedUserMaxApps(String user)
      Checks whether the number of user runnable apps exceeds the limitation.
      Parameters:
      user - the user name
      Returns:
      true if the number hits the limit; false otherwise
    • exceedQueueMaxRunningApps

      public boolean exceedQueueMaxRunningApps(FSQueue queue)
      Recursively checks whether the number of queue runnable apps exceeds the limitation.
      Parameters:
      queue - the current queue
      Returns:
      true if the number hits the limit; false otherwise
    • trackRunnableApp

      public void trackRunnableApp(FSAppAttempt app)
      Tracks the given new runnable app for purposes of maintaining max running app limits.
      Parameters:
      app - FSAppAttempt, the given application.
    • trackNonRunnableApp

      public void trackNonRunnableApp(FSAppAttempt app)
      Tracks the given new non runnable app so that it can be made runnable when it would not violate max running app limits.
      Parameters:
      app - FSAppAttempt, the given application.
    • updateRunnabilityOnReload

      public void updateRunnabilityOnReload()
      This is called after reloading the allocation configuration when the scheduler is reinitialized Checks to see whether any non-runnable applications become runnable now that the max running apps of given queue has been changed Runs in O(n) where n is the number of apps that are non-runnable and in the queues that went from having no slack to having slack.
    • updateRunnabilityOnAppRemoval

      public void updateRunnabilityOnAppRemoval(FSAppAttempt app, FSLeafQueue queue)
      Checks to see whether any other applications runnable now that the given application has been removed from the given queue. And makes them so. Runs in O(n log(n)) where n is the number of queues that are under the highest queue that went from having no slack to having slack.
      Parameters:
      queue - FSLeafQueue, the given queue.
      app - FSAppAttempt, the given application.
    • untrackRunnableApp

      public void untrackRunnableApp(FSAppAttempt app)
      Updates the relevant tracking variables after a runnable app with the given queue and user has been removed.
      Parameters:
      app - FSAppAttempt.
    • untrackNonRunnableApp

      public void untrackNonRunnableApp(FSAppAttempt app)
      Stops tracking the given non-runnable app.
      Parameters:
      app - FSAppAttempt.