@InterfaceAudience.Private public class ApplicationMasterService extends AbstractService implements ApplicationMasterProtocol
Service.STATE
Constructor and Description |
---|
ApplicationMasterService(RMContext rmContext,
YarnScheduler scheduler) |
Modifier and Type | Method and Description |
---|---|
AllocateResponse |
allocate(AllocateRequest request)
The main interface between an
ApplicationMaster and the
ResourceManager . |
FinishApplicationMasterResponse |
finishApplicationMaster(FinishApplicationMasterRequest request)
The interface used by an
ApplicationMaster to notify the
ResourceManager about its completion (success or failed). |
InetSocketAddress |
getBindAddress() |
boolean |
hasApplicationMasterRegistered(ApplicationAttemptId appAttemptId) |
void |
refreshServiceAcls(Configuration configuration,
PolicyProvider policyProvider) |
void |
registerAppAttempt(ApplicationAttemptId attemptId) |
RegisterApplicationMasterResponse |
registerApplicationMaster(RegisterApplicationMasterRequest request)
The interface used by a new
ApplicationMaster to register with
the ResourceManager . |
protected void |
serviceStart()
Actions called during the INITED to STARTED transition.
|
protected void |
serviceStop()
Actions called during the transition to the STOPPED state.
|
void |
unregisterAttempt(ApplicationAttemptId attemptId) |
close, getBlockers, getConfig, getFailureCause, getFailureState, getLifecycleHistory, getName, getServiceState, getStartTime, init, isInState, noteFailure, putBlocker, registerGlobalListener, registerServiceListener, removeBlocker, serviceInit, setConfig, start, stop, toString, unregisterGlobalListener, unregisterServiceListener, waitForServiceToStop
public ApplicationMasterService(RMContext rmContext, YarnScheduler scheduler)
protected void serviceStart() throws Exception
AbstractService
AbstractService.start()
prevents re-entrancy.serviceStart
in class AbstractService
Exception
- if needed -these will be caught,
wrapped, and trigger a service stop@InterfaceAudience.Private public InetSocketAddress getBindAddress()
public RegisterApplicationMasterResponse registerApplicationMaster(RegisterApplicationMasterRequest request) throws YarnException, IOException
ApplicationMasterProtocol
The interface used by a new ApplicationMaster
to register with
the ResourceManager
.
The ApplicationMaster
needs to provide details such as RPC
Port, HTTP tracking url etc. as specified in
RegisterApplicationMasterRequest
.
The ResourceManager
responds with critical details such as
maximum resource capabilities in the cluster as specified in
RegisterApplicationMasterResponse
.
registerApplicationMaster
in interface ApplicationMasterProtocol
request
- registration requestYarnException
InvalidApplicationMasterRequestException
- The exception is thrown when an ApplicationMaster tries to
register more then once.IOException
RegisterApplicationMasterRequest
,
RegisterApplicationMasterResponse
public FinishApplicationMasterResponse finishApplicationMaster(FinishApplicationMasterRequest request) throws YarnException, IOException
ApplicationMasterProtocol
The interface used by an ApplicationMaster
to notify the
ResourceManager
about its completion (success or failed).
The ApplicationMaster
has to provide details such as
final state, diagnostics (in case of failures) etc. as specified in
FinishApplicationMasterRequest
.
The ResourceManager
responds with
FinishApplicationMasterResponse
.
finishApplicationMaster
in interface ApplicationMasterProtocol
request
- completion requestYarnException
IOException
FinishApplicationMasterRequest
,
FinishApplicationMasterResponse
public boolean hasApplicationMasterRegistered(ApplicationAttemptId appAttemptId)
appAttemptId
- public AllocateResponse allocate(AllocateRequest request) throws YarnException, IOException
ApplicationMasterProtocol
The main interface between an ApplicationMaster
and the
ResourceManager
.
The ApplicationMaster
uses this interface to provide a list of
ResourceRequest
and returns unused Container
allocated to
it via AllocateRequest
. Optionally, the
ApplicationMaster
can also blacklist resources which
it doesn't want to use.
This also doubles up as a heartbeat to let the
ResourceManager
know that the ApplicationMaster
is alive. Thus, applications should periodically make this call to be kept
alive. The frequency depends on
YarnConfiguration.RM_AM_EXPIRY_INTERVAL_MS
which defaults to
YarnConfiguration.DEFAULT_RM_AM_EXPIRY_INTERVAL_MS
.
The ResourceManager
responds with list of allocated
Container
, status of completed containers and headroom information
for the application.
The ApplicationMaster
can use the available headroom
(resources) to decide how to utilized allocated resources and make informed
decisions about future resource requests.
allocate
in interface ApplicationMasterProtocol
request
- allocation requestYarnException
InvalidApplicationMasterRequestException
- This exception is thrown when an ApplicationMaster calls allocate
without registering first.InvalidResourceBlacklistRequestException
- This exception is thrown when an application provides an invalid
specification for blacklist of resources.InvalidResourceRequestException
- This exception is thrown when a ResourceRequest
is out of
the range of the configured lower and upper limits on the
resources.IOException
AllocateRequest
,
AllocateResponse
public void registerAppAttempt(ApplicationAttemptId attemptId)
public void unregisterAttempt(ApplicationAttemptId attemptId)
public void refreshServiceAcls(Configuration configuration, PolicyProvider policyProvider)
protected void serviceStop() throws Exception
AbstractService
AbstractService.stop()
prevents re-entrancy.
Implementations MUST write this to be robust against failures, including
checks for null references -and for the first failure to not stop other
attempts to shut down parts of the service.serviceStop
in class AbstractService
Exception
- if needed -these will be caught and logged.Copyright © 2013 Apache Software Foundation. All rights reserved.