public class TaskAttemptListenerImpl extends CompositeService implements TaskUmbilicalProtocol, TaskAttemptListener
CompositeService.CompositeServiceShutdownHook
Service.STATE
Modifier and Type | Field and Description |
---|---|
protected TaskHeartbeatHandler |
taskHeartbeatHandler |
STOP_ONLY_STARTED_SERVICES
versionID
Constructor and Description |
---|
TaskAttemptListenerImpl(AppContext context,
JobTokenSecretManager jobTokenSecretManager,
RMHeartbeatHandler rmHeartbeatHandler) |
Modifier and Type | Method and Description |
---|---|
boolean |
canCommit(TaskAttemptID taskAttemptID)
Child checking whether it can commit.
|
void |
commitPending(TaskAttemptID taskAttemptID,
TaskStatus taskStatsu)
TaskAttempt is reporting that it is in commit_pending and it is waiting for
the commit Response
Commit it a two-phased protocol. |
void |
done(TaskAttemptID taskAttemptID)
Report that the task is successfully completed.
|
void |
fatalError(TaskAttemptID taskAttemptID,
String msg)
Report that the task encounted a fatal error.
|
void |
fsError(TaskAttemptID taskAttemptID,
String message)
Report that the task encounted a local filesystem error.
|
InetSocketAddress |
getAddress() |
MapTaskCompletionEventsUpdate |
getMapCompletionEvents(JobID jobIdentifier,
int startIndex,
int maxEvents,
TaskAttemptID taskAttemptID)
Called by a reduce task to get the map output locations for finished maps.
|
ProtocolSignature |
getProtocolSignature(String protocol,
long clientVersion,
int clientMethodsHash)
Return protocol version corresponding to protocol interface.
|
long |
getProtocolVersion(String arg0,
long arg1)
Return protocol version corresponding to protocol interface.
|
JvmTask |
getTask(org.apache.hadoop.mapred.JvmContext context)
Called when a child task process starts, to get its task.
|
boolean |
ping(TaskAttemptID taskAttemptID)
Periodically called by child to check if parent is still alive.
|
protected void |
registerHeartbeatHandler(Configuration conf) |
void |
registerLaunchedTask(TaskAttemptId attemptID,
WrappedJvmID jvmId)
Register task attempt.
|
void |
registerPendingTask(Task task,
WrappedJvmID jvmID)
Register a JVM with the listener.
|
void |
reportDiagnosticInfo(TaskAttemptID taskAttemptID,
String diagnosticInfo)
Report error messages back to parent.
|
void |
reportNextRecordRange(TaskAttemptID taskAttemptID,
org.apache.hadoop.mapred.SortedRanges.Range range)
Report the record range which is going to process next by the Task.
|
protected void |
serviceInit(Configuration conf)
All initialization code needed by a service.
|
protected void |
serviceStart()
Actions called during the INITED to STARTED transition.
|
protected void |
serviceStop()
Actions called during the transition to the STOPPED state.
|
void |
shuffleError(TaskAttemptID taskAttemptID,
String message)
Report that a reduce-task couldn't shuffle map-outputs.
|
protected void |
startRpcServer() |
boolean |
statusUpdate(TaskAttemptID taskAttemptID,
TaskStatus taskStatus)
Report child's progress to parent.
|
protected void |
stopRpcServer() |
void |
unregister(TaskAttemptId attemptID,
WrappedJvmID jvmID)
Unregister the JVM and the attempt associated with it.
|
addIfService, addService, getServices, removeService
close, getBlockers, getConfig, getFailureCause, getFailureState, getLifecycleHistory, getName, getServiceState, getStartTime, init, isInState, noteFailure, putBlocker, registerGlobalListener, registerServiceListener, removeBlocker, setConfig, start, stop, toString, unregisterGlobalListener, unregisterServiceListener, waitForServiceToStop
protected TaskHeartbeatHandler taskHeartbeatHandler
public TaskAttemptListenerImpl(AppContext context, JobTokenSecretManager jobTokenSecretManager, RMHeartbeatHandler rmHeartbeatHandler)
protected void serviceInit(Configuration conf) throws Exception
AbstractService
AbstractService.init(Configuration)
prevents re-entrancy.
The base implementation checks to see if the subclass has created
a new configuration instance, and if so, updates the base class valueserviceInit
in class CompositeService
conf
- configurationException
- on a failure -these will be caught,
possibly wrapped, and wil; trigger a service stopprotected void serviceStart() throws Exception
AbstractService
AbstractService.start()
prevents re-entrancy.serviceStart
in class CompositeService
Exception
- if needed -these will be caught,
wrapped, and trigger a service stopprotected void registerHeartbeatHandler(Configuration conf)
protected void startRpcServer()
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 CompositeService
Exception
- if needed -these will be caught and logged.protected void stopRpcServer()
public InetSocketAddress getAddress()
getAddress
in interface TaskAttemptListener
public boolean canCommit(TaskAttemptID taskAttemptID) throws IOException
commitPending(TaskAttemptID, TaskStatus)
. Then it repeatedly polls
the ApplicationMaster whether it canCommit(TaskAttemptID)
This is
a legacy from the centralized commit protocol handling by the JobTracker.canCommit
in interface TaskUmbilicalProtocol
IOException
public void commitPending(TaskAttemptID taskAttemptID, TaskStatus taskStatsu) throws IOException, InterruptedException
commitPending(TaskAttemptID, TaskStatus)
. Then it repeatedly polls
the ApplicationMaster whether it canCommit(TaskAttemptID)
This is
a legacy from the centralized commit protocol handling by the JobTracker.commitPending
in interface TaskUmbilicalProtocol
taskAttemptID
- task's idtaskStatsu
- status of the childIOException
InterruptedException
public void done(TaskAttemptID taskAttemptID) throws IOException
TaskUmbilicalProtocol
done
in interface TaskUmbilicalProtocol
taskAttemptID
- task's idIOException
public void fatalError(TaskAttemptID taskAttemptID, String msg) throws IOException
TaskUmbilicalProtocol
fatalError
in interface TaskUmbilicalProtocol
IOException
public void fsError(TaskAttemptID taskAttemptID, String message) throws IOException
TaskUmbilicalProtocol
fsError
in interface TaskUmbilicalProtocol
IOException
public void shuffleError(TaskAttemptID taskAttemptID, String message) throws IOException
TaskUmbilicalProtocol
shuffleError
in interface TaskUmbilicalProtocol
IOException
public MapTaskCompletionEventsUpdate getMapCompletionEvents(JobID jobIdentifier, int startIndex, int maxEvents, TaskAttemptID taskAttemptID) throws IOException
TaskUmbilicalProtocol
getMapCompletionEvents
in interface TaskUmbilicalProtocol
startIndex
- the index starting from which the locations should be
fetchedmaxEvents
- the max number of locations to fetchtaskAttemptID
- The attempt id of the task that is trying to communicateMapTaskCompletionEventsUpdate
IOException
public boolean ping(TaskAttemptID taskAttemptID) throws IOException
TaskUmbilicalProtocol
ping
in interface TaskUmbilicalProtocol
IOException
public void reportDiagnosticInfo(TaskAttemptID taskAttemptID, String diagnosticInfo) throws IOException
TaskUmbilicalProtocol
reportDiagnosticInfo
in interface TaskUmbilicalProtocol
taskAttemptID
- the id of the task involveddiagnosticInfo
- the text to reportIOException
public boolean statusUpdate(TaskAttemptID taskAttemptID, TaskStatus taskStatus) throws IOException, InterruptedException
TaskUmbilicalProtocol
statusUpdate
in interface TaskUmbilicalProtocol
taskAttemptID
- task-id of the childtaskStatus
- status of the childIOException
InterruptedException
public long getProtocolVersion(String arg0, long arg1) throws IOException
VersionedProtocol
getProtocolVersion
in interface VersionedProtocol
arg0
- The classname of the protocol interfacearg1
- The version of the protocol that the client speaksIOException
- if any IO error occurspublic void reportNextRecordRange(TaskAttemptID taskAttemptID, org.apache.hadoop.mapred.SortedRanges.Range range) throws IOException
TaskUmbilicalProtocol
reportNextRecordRange
in interface TaskUmbilicalProtocol
taskAttemptID
- the id of the task involvedrange
- the range of record sequence nosIOException
public JvmTask getTask(org.apache.hadoop.mapred.JvmContext context) throws IOException
TaskUmbilicalProtocol
getTask
in interface TaskUmbilicalProtocol
context
- the JvmContext of the JVM w.r.t the TaskTracker that
launched itIOException
public void registerPendingTask(Task task, WrappedJvmID jvmID)
TaskAttemptListener
registerPendingTask
in interface TaskAttemptListener
task
- the task itself for this JVM.jvmID
- The ID of the JVM .public void registerLaunchedTask(TaskAttemptId attemptID, WrappedJvmID jvmId)
TaskAttemptListener
registerLaunchedTask
in interface TaskAttemptListener
attemptID
- the id of the attempt for this JVM.jvmId
- the ID of the JVM.public void unregister(TaskAttemptId attemptID, WrappedJvmID jvmID)
TaskAttemptListener
unregister
in interface TaskAttemptListener
attemptID
- the ID of the attempt.jvmID
- the ID of the JVM for that attempt.public ProtocolSignature getProtocolSignature(String protocol, long clientVersion, int clientMethodsHash) throws IOException
VersionedProtocol
getProtocolSignature
in interface VersionedProtocol
protocol
- The classname of the protocol interfaceclientVersion
- The version of the protocol that the client speaksclientMethodsHash
- the hashcode of client protocol methodsIOException
for a default implementation
Copyright © 2013 Apache Software Foundation. All rights reserved.