org.apache.hadoop.yarn.client
Interface AMRMClient

All Superinterfaces:
org.apache.hadoop.yarn.service.Service

@InterfaceAudience.Public
@InterfaceStability.Unstable
public interface AMRMClient
extends org.apache.hadoop.yarn.service.Service


Field Summary
static String ANY
          Value used to define no locality
 
Method Summary
 void addContainerRequest(org.apache.hadoop.yarn.client.AMRMClient.ContainerRequest req)
          Request containers for resources before calling allocate
 AllocateResponse allocate(float progressIndicator)
          Request additional containers and receive new container allocations.
 Resource getClusterAvailableResources()
          Get the currently available resources in the cluster.
 int getClusterNodeCount()
          Get the current number of nodes in the cluster.
 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(org.apache.hadoop.yarn.client.AMRMClient.ContainerRequest req)
          Remove previous container request.
 void unregisterApplicationMaster(FinalApplicationStatus appStatus, String appMessage, String appTrackingUrl)
          Unregister the application master.
 
Methods inherited from interface org.apache.hadoop.yarn.service.Service
getConfig, getName, getServiceState, getStartTime, init, register, start, stop, unregister
 

Field Detail

ANY

static final String ANY
Value used to define no locality

See Also:
Constant Field Values
Method Detail

registerApplicationMaster

RegisterApplicationMasterResponse registerApplicationMaster(String appHostName,
                                                            int appHostPort,
                                                            String appTrackingUrl)
                                                            throws org.apache.hadoop.yarn.exceptions.YarnRemoteException
Register the application master. This must be called before any other interaction

Parameters:
appHostName - Name of the host on which master is running
appHostPort - Port master is listening on
appTrackingUrl - URL at which the master info can be seen
Returns:
RegisterApplicationMasterResponse
Throws:
org.apache.hadoop.yarn.exceptions.YarnRemoteException

allocate

AllocateResponse allocate(float progressIndicator)
                          throws org.apache.hadoop.yarn.exceptions.YarnRemoteException
Request additional containers and receive new container allocations. Requests made via 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.

Parameters:
progressIndicator - Indicates progress made by the master
Returns:
the response of the allocate request
Throws:
org.apache.hadoop.yarn.exceptions.YarnRemoteException

unregisterApplicationMaster

void unregisterApplicationMaster(FinalApplicationStatus appStatus,
                                 String appMessage,
                                 String appTrackingUrl)
                                 throws org.apache.hadoop.yarn.exceptions.YarnRemoteException
Unregister the application master. This must be called in the end.

Parameters:
appStatus - Success/Failure status of the master
appMessage - Diagnostics message on failure
appTrackingUrl - New URL to get master info
Throws:
org.apache.hadoop.yarn.exceptions.YarnRemoteException

addContainerRequest

void addContainerRequest(org.apache.hadoop.yarn.client.AMRMClient.ContainerRequest req)
Request containers for resources before calling allocate

Parameters:
req - Resource request

removeContainerRequest

void removeContainerRequest(org.apache.hadoop.yarn.client.AMRMClient.ContainerRequest req)
Remove previous container request. The previous container request may have already been sent to the ResourceManager. So even after the remove request the app must be prepared to receive an allocation for the previous request even after the remove request

Parameters:
req - Resource request

releaseAssignedContainer

void releaseAssignedContainer(ContainerId containerId)
Release containers assigned by the Resource Manager. If the app cannot use the container or wants to give up the container then it can release them. The app needs to make new requests for the released resource capability if it still needs it. eg. it released non-local resources

Parameters:
containerId -

getClusterAvailableResources

Resource getClusterAvailableResources()
Get the currently available resources in the cluster. A valid value is available after a call to allocate has been made

Returns:
Currently available resources

getClusterNodeCount

int getClusterNodeCount()
Get the current number of nodes in the cluster. A valid values is available after a call to allocate has been made

Returns:
Current number of nodes in the cluster


Copyright © 2013 Apache Software Foundation. All Rights Reserved.