@InterfaceAudience.Private @InterfaceStability.Unstable public class AMRMClientImpl<T extends AMRMClient.ContainerRequest> extends AMRMClient<T>
AMRMClient.ContainerRequest
Modifier and Type | Field and Description |
---|---|
protected String |
appHostName |
protected int |
appHostPort |
protected String |
appTrackingUrl |
protected Set<org.apache.hadoop.yarn.api.records.ResourceRequest> |
ask |
protected Set<String> |
blacklistAdditions |
protected Set<String> |
blacklistedNodes |
protected Set<String> |
blacklistRemovals |
protected Map<org.apache.hadoop.yarn.api.records.ContainerId,AbstractMap.SimpleEntry<org.apache.hadoop.yarn.api.records.Container,org.apache.hadoop.yarn.api.records.UpdateContainerRequest>> |
change |
protected org.apache.hadoop.yarn.api.records.Resource |
clusterAvailableResources |
protected int |
clusterNodeCount |
protected Map<org.apache.hadoop.yarn.api.records.ContainerId,AbstractMap.SimpleEntry<org.apache.hadoop.yarn.api.records.Container,org.apache.hadoop.yarn.api.records.UpdateContainerRequest>> |
pendingChange |
protected Set<org.apache.hadoop.yarn.api.records.ContainerId> |
pendingRelease |
protected Set<org.apache.hadoop.yarn.api.records.ContainerId> |
release |
protected Map<String,org.apache.hadoop.yarn.api.records.Resource> |
resourceProfilesMap |
protected org.apache.hadoop.yarn.api.ApplicationMasterProtocol |
rmClient |
Constructor and Description |
---|
AMRMClientImpl() |
Modifier and Type | Method and Description |
---|---|
void |
addContainerRequest(T req)
Request containers for resources before calling
allocate |
void |
addSchedulingRequests(Collection<org.apache.hadoop.yarn.api.records.SchedulingRequest> schedulingRequests)
Add a Collection of SchedulingRequests.
|
org.apache.hadoop.yarn.api.protocolrecords.AllocateResponse |
allocate(float progressIndicator)
Request additional containers and receive new container allocations.
|
org.apache.hadoop.yarn.api.records.Resource |
getAvailableResources()
Get the currently available resources in the cluster.
|
int |
getClusterNodeCount()
Get the current number of nodes in the cluster.
|
Collection<T> |
getMatchingRequests(long allocationRequestId)
Get outstanding
ContainerRequest s matching the given
allocationRequestId. |
List<? extends Collection<T>> |
getMatchingRequests(org.apache.hadoop.yarn.api.records.Priority priority,
String resourceName,
org.apache.hadoop.yarn.api.records.ExecutionType executionType,
org.apache.hadoop.yarn.api.records.Resource capability)
Get outstanding
ContainerRequest s matching the given
parameters. |
List<? extends Collection<T>> |
getMatchingRequests(org.apache.hadoop.yarn.api.records.Priority priority,
String resourceName,
org.apache.hadoop.yarn.api.records.ExecutionType executionType,
org.apache.hadoop.yarn.api.records.Resource capability,
String profile) |
List<? extends Collection<T>> |
getMatchingRequests(org.apache.hadoop.yarn.api.records.Priority priority,
String resourceName,
org.apache.hadoop.yarn.api.records.Resource capability)
Get outstanding
ContainerRequest s matching the given
parameters. |
protected void |
populateNMTokens(List<org.apache.hadoop.yarn.api.records.NMToken> nmTokens) |
org.apache.hadoop.yarn.api.protocolrecords.RegisterApplicationMasterResponse |
registerApplicationMaster(String appHostName,
int appHostPort,
String appTrackingUrl)
Register the application master.
|
org.apache.hadoop.yarn.api.protocolrecords.RegisterApplicationMasterResponse |
registerApplicationMaster(String appHostName,
int appHostPort,
String appTrackingUrl,
Map<Set<String>,org.apache.hadoop.yarn.api.resource.PlacementConstraint> placementConstraintsMap)
Register the application master.
|
void |
releaseAssignedContainer(org.apache.hadoop.yarn.api.records.ContainerId containerId)
Release containers assigned by the Resource Manager.
|
void |
removeContainerRequest(T req)
Remove previous container request.
|
protected void |
removePendingChangeRequests(List<org.apache.hadoop.yarn.api.records.UpdatedContainer> changedContainers) |
protected void |
removePendingReleaseRequests(List<org.apache.hadoop.yarn.api.records.ContainerStatus> completedContainersStatuses) |
void |
requestContainerUpdate(org.apache.hadoop.yarn.api.records.Container container,
org.apache.hadoop.yarn.api.records.UpdateContainerRequest updateContainerRequest)
Request a container update before calling
allocate . |
protected void |
serviceInit(org.apache.hadoop.conf.Configuration conf) |
protected void |
serviceStart() |
protected void |
serviceStop() |
void |
unregisterApplicationMaster(org.apache.hadoop.yarn.api.records.FinalApplicationStatus appStatus,
String appMessage,
String appTrackingUrl)
Unregister the application master.
|
void |
updateBlacklist(List<String> blacklistAdditions,
List<String> blacklistRemovals)
Update application's blacklist with addition or removal resources.
|
createAMRMClient, getNMTokenCache, getRegisteredTimelineV2Client, registerTimelineV2Client, requestContainerResourceChange, setNMTokenCache, waitFor, waitFor, waitFor
close, getBlockers, getConfig, getFailureCause, getFailureState, getLifecycleHistory, getName, getServiceState, getStartTime, init, isInState, noteFailure, putBlocker, registerGlobalListener, registerServiceListener, removeBlocker, setConfig, start, stop, toString, unregisterGlobalListener, unregisterServiceListener, waitForServiceToStop
protected String appHostName
protected int appHostPort
protected String appTrackingUrl
protected org.apache.hadoop.yarn.api.ApplicationMasterProtocol rmClient
protected org.apache.hadoop.yarn.api.records.Resource clusterAvailableResources
protected int clusterNodeCount
protected Map<String,org.apache.hadoop.yarn.api.records.Resource> resourceProfilesMap
protected final Set<org.apache.hadoop.yarn.api.records.ResourceRequest> ask
protected final Set<org.apache.hadoop.yarn.api.records.ContainerId> release
protected Set<org.apache.hadoop.yarn.api.records.ContainerId> pendingRelease
protected final Map<org.apache.hadoop.yarn.api.records.ContainerId,AbstractMap.SimpleEntry<org.apache.hadoop.yarn.api.records.Container,org.apache.hadoop.yarn.api.records.UpdateContainerRequest>> change
protected final Map<org.apache.hadoop.yarn.api.records.ContainerId,AbstractMap.SimpleEntry<org.apache.hadoop.yarn.api.records.Container,org.apache.hadoop.yarn.api.records.UpdateContainerRequest>> pendingChange
protected void serviceInit(org.apache.hadoop.conf.Configuration conf) throws Exception
serviceInit
in class org.apache.hadoop.service.AbstractService
Exception
protected void serviceStart() throws Exception
serviceStart
in class org.apache.hadoop.service.AbstractService
Exception
protected void serviceStop() throws Exception
serviceStop
in class org.apache.hadoop.service.AbstractService
Exception
public org.apache.hadoop.yarn.api.protocolrecords.RegisterApplicationMasterResponse registerApplicationMaster(String appHostName, int appHostPort, String appTrackingUrl) throws org.apache.hadoop.yarn.exceptions.YarnException, IOException
AMRMClient
registerApplicationMaster
in class AMRMClient<T extends AMRMClient.ContainerRequest>
appHostName
- Name of the host on which master is runningappHostPort
- Port master is listening onappTrackingUrl
- URL at which the master info can be seenRegisterApplicationMasterResponse
org.apache.hadoop.yarn.exceptions.YarnException
IOException
public org.apache.hadoop.yarn.api.protocolrecords.RegisterApplicationMasterResponse registerApplicationMaster(String appHostName, int appHostPort, String appTrackingUrl, Map<Set<String>,org.apache.hadoop.yarn.api.resource.PlacementConstraint> placementConstraintsMap) throws org.apache.hadoop.yarn.exceptions.YarnException, IOException
AMRMClient
registerApplicationMaster
in class AMRMClient<T extends AMRMClient.ContainerRequest>
appHostName
- Name of the host on which master is runningappHostPort
- Port master is listening onappTrackingUrl
- URL at which the master info can be seenplacementConstraintsMap
- Placement Constraints mappings.RegisterApplicationMasterResponse
org.apache.hadoop.yarn.exceptions.YarnException
IOException
public void addSchedulingRequests(Collection<org.apache.hadoop.yarn.api.records.SchedulingRequest> schedulingRequests)
AMRMClient
addSchedulingRequests
in class AMRMClient<T extends AMRMClient.ContainerRequest>
schedulingRequests
- Collection of Scheduling Requests.public org.apache.hadoop.yarn.api.protocolrecords.AllocateResponse allocate(float progressIndicator) throws org.apache.hadoop.yarn.exceptions.YarnException, IOException
AMRMClient
addContainerRequest
are sent to the
ResourceManager
. New containers assigned to the master are
retrieved. Status of completed containers and node health updates are also
retrieved. This also doubles up as a heartbeat to the ResourceManager and
must be made periodically. The call may not always return any new
allocations of containers. App should not make concurrent allocate
requests. May cause request loss.
Note : If the user has not removed container requests that have already been satisfied, then the re-register may end up sending the entire container requests to the RM (including matched requests). Which would mean the RM could end up giving it a lot of new allocated containers.
allocate
in class AMRMClient<T extends AMRMClient.ContainerRequest>
progressIndicator
- Indicates progress made by the masterorg.apache.hadoop.yarn.exceptions.YarnException
IOException
protected void removePendingReleaseRequests(List<org.apache.hadoop.yarn.api.records.ContainerStatus> completedContainersStatuses)
protected void removePendingChangeRequests(List<org.apache.hadoop.yarn.api.records.UpdatedContainer> changedContainers)
@InterfaceAudience.Private protected void populateNMTokens(List<org.apache.hadoop.yarn.api.records.NMToken> nmTokens)
public void unregisterApplicationMaster(org.apache.hadoop.yarn.api.records.FinalApplicationStatus appStatus, String appMessage, String appTrackingUrl) throws org.apache.hadoop.yarn.exceptions.YarnException, IOException
AMRMClient
unregisterApplicationMaster
in class AMRMClient<T extends AMRMClient.ContainerRequest>
appStatus
- Success/Failure status of the masterappMessage
- Diagnostics message on failureappTrackingUrl
- New URL to get master infoorg.apache.hadoop.yarn.exceptions.YarnException
IOException
public void addContainerRequest(T req)
AMRMClient
allocate
addContainerRequest
in class AMRMClient<T extends AMRMClient.ContainerRequest>
req
- Resource requestpublic void removeContainerRequest(T req)
AMRMClient
removeContainerRequest
in class AMRMClient<T extends AMRMClient.ContainerRequest>
req
- Resource requestpublic void requestContainerUpdate(org.apache.hadoop.yarn.api.records.Container container, org.apache.hadoop.yarn.api.records.UpdateContainerRequest updateContainerRequest)
AMRMClient
allocate
.
Any previous pending update request of the same container will be
removed.requestContainerUpdate
in class AMRMClient<T extends AMRMClient.ContainerRequest>
container
- The container returned from the last successful resource
allocation or updateupdateContainerRequest
- The UpdateContainerRequest
.public void releaseAssignedContainer(org.apache.hadoop.yarn.api.records.ContainerId containerId)
AMRMClient
releaseAssignedContainer
in class AMRMClient<T extends AMRMClient.ContainerRequest>
public org.apache.hadoop.yarn.api.records.Resource getAvailableResources()
AMRMClient
getAvailableResources
in class AMRMClient<T extends AMRMClient.ContainerRequest>
public int getClusterNodeCount()
AMRMClient
getClusterNodeCount
in class AMRMClient<T extends AMRMClient.ContainerRequest>
public Collection<T> getMatchingRequests(long allocationRequestId)
AMRMClient
ContainerRequest
s matching the given
allocationRequestId. These ContainerRequests should have been added via
addContainerRequest
earlier in the lifecycle. For performance,
the AMRMClient may return its internal collection directly without creating
a copy. Users should not perform mutable operations on the return value.
NOTE: This API only matches Container requests that were created by the
client WITH the allocationRequestId being set to a non-default value.getMatchingRequests
in class AMRMClient<T extends AMRMClient.ContainerRequest>
allocationRequestId
- Allocation Request Idpublic List<? extends Collection<T>> getMatchingRequests(org.apache.hadoop.yarn.api.records.Priority priority, String resourceName, org.apache.hadoop.yarn.api.records.Resource capability)
AMRMClient
ContainerRequest
s matching the given
parameters. These ContainerRequests should have been added via
addContainerRequest
earlier in the lifecycle. For performance,
the AMRMClient may return its internal collection directly without creating
a copy. Users should not perform mutable operations on the return value.
Each collection in the list contains requests with identical
Resource
size that fit in the given capability. In a
collection, requests will be returned in the same order as they were added.
NOTE: This API only matches Container requests that were created by the
client WITHOUT the allocationRequestId being set.getMatchingRequests
in class AMRMClient<T extends AMRMClient.ContainerRequest>
public List<? extends Collection<T>> getMatchingRequests(org.apache.hadoop.yarn.api.records.Priority priority, String resourceName, org.apache.hadoop.yarn.api.records.ExecutionType executionType, org.apache.hadoop.yarn.api.records.Resource capability, String profile)
getMatchingRequests
in class AMRMClient<T extends AMRMClient.ContainerRequest>
public List<? extends Collection<T>> getMatchingRequests(org.apache.hadoop.yarn.api.records.Priority priority, String resourceName, org.apache.hadoop.yarn.api.records.ExecutionType executionType, org.apache.hadoop.yarn.api.records.Resource capability)
AMRMClient
ContainerRequest
s matching the given
parameters. These ContainerRequests should have been added via
addContainerRequest
earlier in the lifecycle. For performance,
the AMRMClient may return its internal collection directly without creating
a copy. Users should not perform mutable operations on the return value.
Each collection in the list contains requests with identical
Resource
size that fit in the given capability. In a
collection, requests will be returned in the same order as they were added.
specify an ExecutionType
.
NOTE: This API only matches Container requests that were created by the
client WITHOUT the allocationRequestId being set.getMatchingRequests
in class AMRMClient<T extends AMRMClient.ContainerRequest>
priority
- PriorityresourceName
- LocationexecutionType
- ExecutionTypecapability
- Capabilitypublic void updateBlacklist(List<String> blacklistAdditions, List<String> blacklistRemovals)
AMRMClient
updateBlacklist
in class AMRMClient<T extends AMRMClient.ContainerRequest>
blacklistAdditions
- list of resources which should be added to the
application blacklistblacklistRemovals
- list of resources which should be removed from the
application blacklistCopyright © 2008–2018 Apache Software Foundation. All rights reserved.