java.lang.Object
org.apache.hadoop.yarn.server.resourcemanager.scheduler.constraint.PlacementConstraintsUtil

@Public @Unstable public final class PlacementConstraintsUtil extends Object
This class contains various static methods used by the Placement Algorithms to simplify constrained placement. (see also DefaultPlacementAlgorithm).
  • Method Details

    • canSatisfyConstraints

      public static boolean canSatisfyConstraints(org.apache.hadoop.yarn.api.records.ApplicationId applicationId, org.apache.hadoop.yarn.api.records.SchedulingRequest request, SchedulerNode schedulerNode, PlacementConstraintManager pcm, AllocationTagsManager atm, Optional<DiagnosticsCollector> dcOpt) throws InvalidAllocationTagsQueryException
      Returns true if the placement constraint for a given scheduling request is currently satisfied by the specific scheduler node. This method first validates the constraint specified in the request; if not specified, then it validates application level constraint if exists; otherwise, it validates the global constraint if exists. This method only checks whether a scheduling request can be placed on a node with respect to the certain placement constraint. It gives no guarantee that asked allocations can be eventually allocated because it doesn't check resource, that needs to be further decided by a scheduler.
      Parameters:
      applicationId - application id
      request - scheduling request
      schedulerNode - node
      pcm - placement constraint manager
      atm - allocation tags manager
      dcOpt - optional diagnostics collector
      Returns:
      true if the given node satisfies the constraint of the request
      Throws:
      InvalidAllocationTagsQueryException - if given string is not in valid format.
    • canSatisfyConstraints

      public static boolean canSatisfyConstraints(org.apache.hadoop.yarn.api.records.ApplicationId applicationId, org.apache.hadoop.yarn.api.records.SchedulingRequest request, SchedulerNode schedulerNode, PlacementConstraintManager pcm, AllocationTagsManager atm) throws InvalidAllocationTagsQueryException
      Throws:
      InvalidAllocationTagsQueryException