Class TargetApplicationsNamespace

java.lang.Object
org.apache.hadoop.yarn.server.resourcemanager.scheduler.constraint.TargetApplicationsNamespace
All Implemented Interfaces:
Evaluable<TargetApplications>
Direct Known Subclasses:
TargetApplicationsNamespace.All, TargetApplicationsNamespace.AppID, TargetApplicationsNamespace.AppTag, TargetApplicationsNamespace.NotSelf, TargetApplicationsNamespace.Self

public abstract class TargetApplicationsNamespace extends Object implements Evaluable<TargetApplications>
Class to describe the namespace of allocation tags, used by AllocationTags. Each namespace can be evaluated against a target set applications, represented by TargetApplications. After evaluation, the namespace is interpreted to be a set of applications based on the namespace type.
  • Field Details

  • Constructor Details

    • TargetApplicationsNamespace

      public TargetApplicationsNamespace(org.apache.hadoop.yarn.api.records.AllocationTagNamespaceType allocationTagNamespaceType)
  • Method Details

    • setScopeIfNotNull

      protected void setScopeIfNotNull(Set<org.apache.hadoop.yarn.api.records.ApplicationId> appIds)
    • getNamespaceType

      public org.apache.hadoop.yarn.api.records.AllocationTagNamespaceType getNamespaceType()
      Get the type of the namespace.
      Returns:
      namespace type.
    • getNamespaceScope

      public Set<org.apache.hadoop.yarn.api.records.ApplicationId> getNamespaceScope()
      Get the scope of the namespace, in form of a set of applications.
      Returns:
      a set of applications.
    • evaluate

      public void evaluate(TargetApplications target) throws InvalidAllocationTagsQueryException
      Evaluate the namespace against given target applications if it is necessary. Only self/not-self/app-label namespace types require this evaluation step, because they are not binding to a specific scope during initiating. So we do lazy binding for them in this method.
      Specified by:
      evaluate in interface Evaluable<TargetApplications>
      Parameters:
      target - a generic type target that impacts this evaluation.
      Throws:
      InvalidAllocationTagsQueryException - if given string is not in valid format.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • parse

      public static TargetApplicationsNamespace parse(String namespaceStr) throws InvalidAllocationTagsQueryException
      Parse namespace from a string. The string must be in legal format defined by each AllocationTagNamespaceType.
      Parameters:
      namespaceStr - namespace string.
      Returns:
      an instance of TargetApplicationsNamespace.
      Throws:
      InvalidAllocationTagsQueryException - if given string is not in valid format