org.apache.hadoop.yarn.client.api

## Class AMRMClient.ContainerRequest

- java.lang.Object
- - org.apache.hadoop.yarn.client.api.AMRMClient.ContainerRequest

- Enclosing class:
    AMRMClient<T extends AMRMClient.ContainerRequest>

      public static class AMRMClient.ContainerRequest
      extends Object

  Object to represent a single container request for resources. Scheduler documentation should be consulted for the specifics of how the parameters are honored. By default, YARN schedulers try to allocate containers at the requested locations but they may relax the constraints in order to expedite meeting allocations limits. They first relax the constraint to the same rack as the requested node and then to anywhere in the cluster. The relaxLocality flag may be used to disable locality relaxation and request containers at only specific locations. The following conditions apply.
  - Within a priority, all container requests must have the same value for locality relaxation. Either enabled or disabled.
  - If locality relaxation is disabled, then across requests, locations at different network levels may not be specified. E.g. its invalid to make a request for a specific node and another request for a specific rack.
  - If locality relaxation is disabled, then only within the same request, a node and its rack may be specified together. This allows for a specific rack with a preference for a specific node within that rack.
  To re-enable locality relaxation at a given priority, all pending requests with locality relaxation disabled must be first removed. Then they can be added back with locality relaxation enabled. All getters return immutable values.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `AMRMClient.ContainerRequest.ContainerRequestBuilder` Class to construct instances of `AMRMClient.ContainerRequest` with specific options.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ContainerRequest(org.apache.hadoop.yarn.api.records.Resource capability, String[] nodes, String[] racks, org.apache.hadoop.yarn.api.records.Priority priority)` Instantiates a `AMRMClient.ContainerRequest` with the given constraints and locality relaxation enabled.
    `ContainerRequest(org.apache.hadoop.yarn.api.records.Resource capability, String[] nodes, String[] racks, org.apache.hadoop.yarn.api.records.Priority priority, boolean relaxLocality)` Instantiates a `AMRMClient.ContainerRequest` with the given constraints.
    `ContainerRequest(org.apache.hadoop.yarn.api.records.Resource capability, String[] nodes, String[] racks, org.apache.hadoop.yarn.api.records.Priority priority, boolean relaxLocality, String nodeLabelsExpression)` Instantiates a `AMRMClient.ContainerRequest` with the given constraints.
    `ContainerRequest(org.apache.hadoop.yarn.api.records.Resource capability, String[] nodes, String[] racks, org.apache.hadoop.yarn.api.records.Priority priority, long allocationRequestId)` Instantiates a `AMRMClient.ContainerRequest` with the given constraints and locality relaxation enabled.
    `ContainerRequest(org.apache.hadoop.yarn.api.records.Resource capability, String[] nodes, String[] racks, org.apache.hadoop.yarn.api.records.Priority priority, long allocationRequestId, boolean relaxLocality)` Instantiates a `AMRMClient.ContainerRequest` with the given constraints.
    `ContainerRequest(org.apache.hadoop.yarn.api.records.Resource capability, String[] nodes, String[] racks, org.apache.hadoop.yarn.api.records.Priority priority, long allocationRequestId, boolean relaxLocality, String nodeLabelsExpression)` Instantiates a `AMRMClient.ContainerRequest` with the given constraints.
    `ContainerRequest(org.apache.hadoop.yarn.api.records.Resource capability, String[] nodes, String[] racks, org.apache.hadoop.yarn.api.records.Priority priority, long allocationRequestId, boolean relaxLocality, String nodeLabelsExpression, org.apache.hadoop.yarn.api.records.ExecutionTypeRequest executionTypeRequest)` Instantiates a `AMRMClient.ContainerRequest` with the given constraints.
    `ContainerRequest(org.apache.hadoop.yarn.api.records.Resource capability, String[] nodes, String[] racks, org.apache.hadoop.yarn.api.records.Priority priority, long allocationRequestId, boolean relaxLocality, String nodeLabelsExpression, org.apache.hadoop.yarn.api.records.ExecutionTypeRequest executionTypeRequest, String profile)` Instantiates a `AMRMClient.ContainerRequest` with the given constraints.
    `ContainerRequest(org.apache.hadoop.yarn.api.records.Resource capability, String[] nodes, String[] racks, org.apache.hadoop.yarn.api.records.Priority priority, String profile)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `long` | `getAllocationRequestId()`
    `org.apache.hadoop.yarn.api.records.Resource` | `getCapability()`
    `org.apache.hadoop.yarn.api.records.ExecutionTypeRequest` | `getExecutionTypeRequest()`
    `String` | `getNodeLabelExpression()`
    `List<String>` | `getNodes()`
    `org.apache.hadoop.yarn.api.records.Priority` | `getPriority()`
    `List<String>` | `getRacks()`
    `boolean` | `getRelaxLocality()`
    `String` | `getResourceProfile()`
    `static AMRMClient.ContainerRequest.ContainerRequestBuilder` | `newBuilder()`
    `String` | `toString()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### ContainerRequest

          public ContainerRequest(org.apache.hadoop.yarn.api.records.Resource capability,
                                  String[] nodes,
                                  String[] racks,
                                  org.apache.hadoop.yarn.api.records.Priority priority)

      Instantiates a `AMRMClient.ContainerRequest` with the given constraints and locality relaxation enabled.
      Parameters:
        `capability` - The `Resource` to be requested for each container.
        `nodes` - Any hosts to request that the containers are placed on.
        `racks` - Any racks to request that the containers are placed on. The racks corresponding to any hosts requested will be automatically added to this list.
        `priority` - The priority at which to request the containers. Higher priorities have lower numerical values.

    - #### ContainerRequest

          public ContainerRequest(org.apache.hadoop.yarn.api.records.Resource capability,
                                  String[] nodes,
                                  String[] racks,
                                  org.apache.hadoop.yarn.api.records.Priority priority,
                                  String profile)

    - #### ContainerRequest

          @InterfaceAudience.Public
           @InterfaceStability.Evolving
          public ContainerRequest(org.apache.hadoop.yarn.api.records.Resource capability,
                                                                                          String[] nodes,
                                                                                          String[] racks,
                                                                                          org.apache.hadoop.yarn.api.records.Priority priority,
                                                                                          long allocationRequestId)

      Instantiates a `AMRMClient.ContainerRequest` with the given constraints and locality relaxation enabled.
      Parameters:
        `capability` - The `Resource` to be requested for each container.
        `nodes` - Any hosts to request that the containers are placed on.
        `racks` - Any racks to request that the containers are placed on. The racks corresponding to any hosts requested will be automatically added to this list.
        `priority` - The priority at which to request the containers. Higher priorities have lower numerical values.
        `allocationRequestId` - Allocation Request Id

    - #### ContainerRequest

          public ContainerRequest(org.apache.hadoop.yarn.api.records.Resource capability,
                                  String[] nodes,
                                  String[] racks,
                                  org.apache.hadoop.yarn.api.records.Priority priority,
                                  boolean relaxLocality)

      Instantiates a `AMRMClient.ContainerRequest` with the given constraints.
      Parameters:
        `capability` - The `Resource` to be requested for each container.
        `nodes` - Any hosts to request that the containers are placed on.
        `racks` - Any racks to request that the containers are placed on. The racks corresponding to any hosts requested will be automatically added to this list.
        `priority` - The priority at which to request the containers. Higher priorities have lower numerical values.
        `relaxLocality` - If true, containers for this request may be assigned on hosts and racks other than the ones explicitly requested.

    - #### ContainerRequest

          @InterfaceAudience.Public
           @InterfaceStability.Evolving
          public ContainerRequest(org.apache.hadoop.yarn.api.records.Resource capability,
                                                                                          String[] nodes,
                                                                                          String[] racks,
                                                                                          org.apache.hadoop.yarn.api.records.Priority priority,
                                                                                          long allocationRequestId,
                                                                                          boolean relaxLocality)

      Instantiates a `AMRMClient.ContainerRequest` with the given constraints.
      Parameters:
        `capability` - The `Resource` to be requested for each container.
        `nodes` - Any hosts to request that the containers are placed on.
        `racks` - Any racks to request that the containers are placed on. The racks corresponding to any hosts requested will be automatically added to this list.
        `priority` - The priority at which to request the containers. Higher priorities have lower numerical values.
        `relaxLocality` - If true, containers for this request may be assigned on hosts and racks other than the ones explicitly requested.
        `allocationRequestId` - Allocation Request Id

    - #### ContainerRequest

          public ContainerRequest(org.apache.hadoop.yarn.api.records.Resource capability,
                                  String[] nodes,
                                  String[] racks,
                                  org.apache.hadoop.yarn.api.records.Priority priority,
                                  boolean relaxLocality,
                                  String nodeLabelsExpression)

      Instantiates a `AMRMClient.ContainerRequest` with the given constraints.
      Parameters:
        `capability` - The `Resource` to be requested for each container.
        `nodes` - Any hosts to request that the containers are placed on.
        `racks` - Any racks to request that the containers are placed on. The racks corresponding to any hosts requested will be automatically added to this list.
        `priority` - The priority at which to request the containers. Higher priorities have lower numerical values.
        `relaxLocality` - If true, containers for this request may be assigned on hosts and racks other than the ones explicitly requested.
        `nodeLabelsExpression` - Set node labels to allocate resource, now we only support asking for only a single node label

    - #### ContainerRequest

          @InterfaceAudience.Public
           @InterfaceStability.Evolving
          public ContainerRequest(org.apache.hadoop.yarn.api.records.Resource capability,
                                                                                          String[] nodes,
                                                                                          String[] racks,
                                                                                          org.apache.hadoop.yarn.api.records.Priority priority,
                                                                                          long allocationRequestId,
                                                                                          boolean relaxLocality,
                                                                                          String nodeLabelsExpression)

      Instantiates a `AMRMClient.ContainerRequest` with the given constraints.
      Parameters:
        `capability` - The `Resource` to be requested for each container.
        `nodes` - Any hosts to request that the containers are placed on.
        `racks` - Any racks to request that the containers are placed on. The racks corresponding to any hosts requested will be automatically added to this list.
        `priority` - The priority at which to request the containers. Higher priorities have lower numerical values.
        `allocationRequestId` - The allocationRequestId of the request. To be used as a tracking id to match Containers allocated against this request. Will default to 0 if not specified.
        `relaxLocality` - If true, containers for this request may be assigned on hosts and racks other than the ones explicitly requested.
        `nodeLabelsExpression` - Set node labels to allocate resource, now we only support asking for only a single node label

    - #### ContainerRequest

          public ContainerRequest(org.apache.hadoop.yarn.api.records.Resource capability,
                                  String[] nodes,
                                  String[] racks,
                                  org.apache.hadoop.yarn.api.records.Priority priority,
                                  long allocationRequestId,
                                  boolean relaxLocality,
                                  String nodeLabelsExpression,
                                  org.apache.hadoop.yarn.api.records.ExecutionTypeRequest executionTypeRequest)

      Instantiates a `AMRMClient.ContainerRequest` with the given constraints.
      Parameters:
        `capability` - The `Resource` to be requested for each container.
        `nodes` - Any hosts to request that the containers are placed on.
        `racks` - Any racks to request that the containers are placed on. The racks corresponding to any hosts requested will be automatically added to this list.
        `priority` - The priority at which to request the containers. Higher priorities have lower numerical values.
        `allocationRequestId` - The allocationRequestId of the request. To be used as a tracking id to match Containers allocated against this request. Will default to 0 if not specified.
        `relaxLocality` - If true, containers for this request may be assigned on hosts and racks other than the ones explicitly requested.
        `nodeLabelsExpression` - Set node labels to allocate resource, now we only support asking for only a single node label
        `executionTypeRequest` - Set the execution type of the container request.

    - #### ContainerRequest

          public ContainerRequest(org.apache.hadoop.yarn.api.records.Resource capability,
                                  String[] nodes,
                                  String[] racks,
                                  org.apache.hadoop.yarn.api.records.Priority priority,
                                  long allocationRequestId,
                                  boolean relaxLocality,
                                  String nodeLabelsExpression,
                                  org.apache.hadoop.yarn.api.records.ExecutionTypeRequest executionTypeRequest,
                                  String profile)

      Instantiates a `AMRMClient.ContainerRequest` with the given constraints.
      Parameters:
        `capability` - The `Resource` to be requested for each container.
        `nodes` - Any hosts to request that the containers are placed on.
        `racks` - Any racks to request that the containers are placed on. The racks corresponding to any hosts requested will be automatically added to this list.
        `priority` - The priority at which to request the containers. Higher priorities have lower numerical values.
        `allocationRequestId` - The allocationRequestId of the request. To be used as a tracking id to match Containers allocated against this request. Will default to 0 if not specified.
        `relaxLocality` - If true, containers for this request may be assigned on hosts and racks other than the ones explicitly requested.
        `nodeLabelsExpression` - Set node labels to allocate resource, now we only support asking for only a single node label
        `executionTypeRequest` - Set the execution type of the container request.
        `profile` - Set the resource profile for the container request

  - ### Method Detail

    - #### getCapability

          public org.apache.hadoop.yarn.api.records.Resource getCapability()

    - #### getNodes

          public List<String> getNodes()

    - #### getRacks

          public List<String> getRacks()

    - #### getPriority

          public org.apache.hadoop.yarn.api.records.Priority getPriority()

    - #### getAllocationRequestId

          public long getAllocationRequestId()

    - #### getRelaxLocality

          public boolean getRelaxLocality()

    - #### getNodeLabelExpression

          public String getNodeLabelExpression()

    - #### getExecutionTypeRequest

          public org.apache.hadoop.yarn.api.records.ExecutionTypeRequest getExecutionTypeRequest()

    - #### getResourceProfile

          public String getResourceProfile()

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### newBuilder

          public static AMRMClient.ContainerRequest.ContainerRequestBuilder newBuilder()

Copyright © 2008–2022 Apache Software Foundation. All rights reserved.