@InterfaceAudience.Private @InterfaceStability.Unstable public class AMRMClientImpl<T extends AMRMClient.ContainerRequest> extends AMRMClient<T>
AMRMClient.ContainerRequestService.STATE| Modifier and Type | Field and Description |
|---|---|
protected String |
appHostName |
protected int |
appHostPort |
protected String |
appTrackingUrl |
protected Set<ResourceRequest> |
ask |
protected Set<String> |
blacklistAdditions |
protected Set<String> |
blacklistedNodes |
protected Set<String> |
blacklistRemovals |
protected Resource |
clusterAvailableResources |
protected int |
clusterNodeCount |
protected Set<ContainerId> |
pendingRelease |
protected Set<ContainerId> |
release |
protected Map<Priority,Map<String,TreeMap<Resource,org.apache.hadoop.yarn.client.api.impl.AMRMClientImpl.ResourceRequestInfo>>> |
remoteRequestsTable |
protected ApplicationMasterProtocol |
rmClient |
| Constructor and Description |
|---|
AMRMClientImpl() |
| Modifier and Type | Method and Description |
|---|---|
void |
addContainerRequest(T req)
Request containers for resources before calling
allocate |
AllocateResponse |
allocate(float progressIndicator)
Request additional containers and receive new container allocations.
|
Resource |
getAvailableResources()
Get the currently available resources in the cluster.
|
int |
getClusterNodeCount()
Get the current number of nodes in the cluster.
|
List<? extends Collection<T>> |
getMatchingRequests(Priority priority,
String resourceName,
Resource capability)
Get outstanding
ContainerRequests matching the given
parameters. |
protected void |
populateNMTokens(List<NMToken> nmTokens) |
RegisterApplicationMasterResponse |
registerApplicationMaster(String appHostName,
int appHostPort,
String appTrackingUrl)
Register the application master.
|
void |
releaseAssignedContainer(ContainerId containerId)
Release containers assigned by the Resource Manager.
|
void |
removeContainerRequest(T req)
Remove previous container request.
|
protected void |
removePendingReleaseRequests(List<ContainerStatus> completedContainersStatuses) |
protected void |
serviceInit(Configuration conf) |
protected void |
serviceStart() |
protected void |
serviceStop() |
void |
unregisterApplicationMaster(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, setNMTokenCache, waitFor, waitFor, waitForclose, getBlockers, getConfig, getFailureCause, getFailureState, getLifecycleHistory, getName, getServiceState, getStartTime, init, isInState, noteFailure, putBlocker, registerGlobalListener, registerServiceListener, removeBlocker, setConfig, start, stop, toString, unregisterGlobalListener, unregisterServiceListener, waitForServiceToStopprotected String appHostName
protected int appHostPort
protected String appTrackingUrl
protected ApplicationMasterProtocol rmClient
protected Resource clusterAvailableResources
protected int clusterNodeCount
protected final Map<Priority,Map<String,TreeMap<Resource,org.apache.hadoop.yarn.client.api.impl.AMRMClientImpl.ResourceRequestInfo>>> remoteRequestsTable
protected final Set<ResourceRequest> ask
protected final Set<ContainerId> release
protected Set<ContainerId> pendingRelease
protected void serviceInit(Configuration conf) throws Exception
serviceInit in class AbstractServiceExceptionprotected void serviceStart()
throws Exception
serviceStart in class AbstractServiceExceptionprotected void serviceStop()
throws Exception
serviceStop in class AbstractServiceExceptionpublic RegisterApplicationMasterResponse registerApplicationMaster(String appHostName, int appHostPort, String appTrackingUrl) throws YarnException, IOException
AMRMClientregisterApplicationMaster 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 seenRegisterApplicationMasterResponseYarnExceptionIOExceptionpublic AllocateResponse allocate(float progressIndicator) throws YarnException, IOException
AMRMClientaddContainerRequest 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 masterYarnExceptionIOExceptionprotected void removePendingReleaseRequests(List<ContainerStatus> completedContainersStatuses)
@InterfaceAudience.Private protected void populateNMTokens(List<NMToken> nmTokens)
public void unregisterApplicationMaster(FinalApplicationStatus appStatus, String appMessage, String appTrackingUrl) throws YarnException, IOException
AMRMClientunregisterApplicationMaster in class AMRMClient<T extends AMRMClient.ContainerRequest>appStatus - Success/Failure status of the masterappMessage - Diagnostics message on failureappTrackingUrl - New URL to get master infoYarnExceptionIOExceptionpublic void addContainerRequest(T req)
AMRMClientallocateaddContainerRequest in class AMRMClient<T extends AMRMClient.ContainerRequest>req - Resource requestpublic void removeContainerRequest(T req)
AMRMClientremoveContainerRequest in class AMRMClient<T extends AMRMClient.ContainerRequest>req - Resource requestpublic void releaseAssignedContainer(ContainerId containerId)
AMRMClientreleaseAssignedContainer in class AMRMClient<T extends AMRMClient.ContainerRequest>public Resource getAvailableResources()
AMRMClientgetAvailableResources in class AMRMClient<T extends AMRMClient.ContainerRequest>public int getClusterNodeCount()
AMRMClientgetClusterNodeCount in class AMRMClient<T extends AMRMClient.ContainerRequest>public List<? extends Collection<T>> getMatchingRequests(Priority priority, String resourceName, Resource capability)
AMRMClientContainerRequests 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.getMatchingRequests in class AMRMClient<T extends AMRMClient.ContainerRequest>public void updateBlacklist(List<String> blacklistAdditions, List<String> blacklistRemovals)
AMRMClientupdateBlacklist 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 © 2018 CERN. All Rights Reserved.