@InterfaceAudience.Private public class TaskCommunicatorContextImpl extends Object implements TaskCommunicatorContext, VertexStateUpdateListener
| Constructor and Description |
|---|
TaskCommunicatorContextImpl(AppContext appContext,
TaskCommunicatorManager taskCommunicatorManager,
org.apache.tez.dag.api.UserPayload userPayload,
int taskCommunicatorIndex) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
canCommit(org.apache.tez.dag.records.TezTaskAttemptID taskAttemptId)
Check whether a running attempt can commit.
|
void |
containerAlive(org.apache.hadoop.yarn.api.records.ContainerId containerId)
Inform the framework that a container is alive.
|
void |
dagCompleteEnd() |
void |
dagCompleteStart(DAG dag) |
org.apache.hadoop.security.Credentials |
getAMCredentials()
Get credentials associated with the AppMaster
|
org.apache.hadoop.yarn.api.records.ApplicationAttemptId |
getApplicationAttemptId()
Get the application attempt id for the running application.
|
String |
getCurrentAppIdentifier()
Get an identifier for the executing context of the DAG.
|
org.apache.tez.serviceplugins.api.DagInfo |
getCurrentDagInfo() |
long |
getDagStartTime()
Get the start time for the currently executing DAG
|
long |
getFirstAttemptStartTime(String vertexName,
int taskIndex)
Get the start time for the first attempt of the specified task
|
org.apache.tez.dag.api.UserPayload |
getInitialUserPayload() |
Iterable<String> |
getInputVertexNames(String vertexName)
Get the name of the Input vertices for the specified vertex.
|
int |
getVertexCompletedTaskCount(String vertexName)
Get the number of completed tasks for a given vertex
|
int |
getVertexRunningTaskCount(String vertexName)
Get the number of running tasks for a given vertex
|
int |
getVertexTotalTaskCount(String vertexName)
Get the total number of tasks in the given vertex
|
TaskHeartbeatResponse |
heartbeat(TaskHeartbeatRequest request)
Mechanism for a
TaskCommunicator to provide updates on a running task, as well as
receive new information which may need to be propagated to the task. |
boolean |
isKnownContainer(org.apache.hadoop.yarn.api.records.ContainerId containerId)
Check whether the container is known by the framework.
|
void |
onStateUpdated(org.apache.tez.dag.api.event.VertexStateUpdate event) |
void |
registerForVertexStateUpdates(String vertexName,
Set<org.apache.tez.dag.api.event.VertexState> stateSet)
Register to get notifications on updates to the specified vertex.
|
void |
reportError(org.apache.tez.serviceplugins.api.ServicePluginError servicePluginError,
String message,
org.apache.tez.serviceplugins.api.DagInfo dagInfo) |
void |
taskAlive(org.apache.tez.dag.records.TezTaskAttemptID taskAttemptId)
Inform the framework that a task is alive.
|
void |
taskFailed(org.apache.tez.dag.records.TezTaskAttemptID taskAttemptId,
org.apache.tez.runtime.api.TaskFailureType taskFailureType,
org.apache.tez.serviceplugins.api.TaskAttemptEndReason taskAttemptEndReason,
String diagnostics)
Inform the framework that a task has failed.
|
void |
taskKilled(org.apache.tez.dag.records.TezTaskAttemptID taskAttemptId,
org.apache.tez.serviceplugins.api.TaskAttemptEndReason taskAttemptEndReason,
String diagnostics)
Inform the framework that a task has been killed
|
void |
taskStartedRemotely(org.apache.tez.dag.records.TezTaskAttemptID taskAttemptId)
Inform the framework that the task has started execution
|
void |
taskStartedRemotely(org.apache.tez.dag.records.TezTaskAttemptID taskAttemptId,
org.apache.hadoop.yarn.api.records.ContainerId containerId)
Inform the framework that the task has started execution
Use
TaskCommunicatorContext.taskSubmitted(TezTaskAttemptID, ContainerId)
and TaskCommunicatorContext.taskStartedRemotely(TezTaskAttemptID) instead |
void |
taskSubmitted(org.apache.tez.dag.records.TezTaskAttemptID taskAttemptId,
org.apache.hadoop.yarn.api.records.ContainerId containerId)
Inform the framework that the task has been submitted for execution.
|
public TaskCommunicatorContextImpl(AppContext appContext, TaskCommunicatorManager taskCommunicatorManager, org.apache.tez.dag.api.UserPayload userPayload, int taskCommunicatorIndex)
public org.apache.tez.dag.api.UserPayload getInitialUserPayload()
getInitialUserPayload in interface org.apache.tez.serviceplugins.api.ServicePluginContextBasepublic org.apache.hadoop.yarn.api.records.ApplicationAttemptId getApplicationAttemptId()
TaskCommunicatorContextgetApplicationAttemptId in interface TaskCommunicatorContextpublic org.apache.hadoop.security.Credentials getAMCredentials()
TaskCommunicatorContextgetAMCredentials in interface TaskCommunicatorContextpublic boolean canCommit(org.apache.tez.dag.records.TezTaskAttemptID taskAttemptId)
throws IOException
TaskCommunicatorContextcanCommit in interface TaskCommunicatorContexttaskAttemptId - the associated task attempt idIOExceptionpublic TaskHeartbeatResponse heartbeat(TaskHeartbeatRequest request) throws IOException, org.apache.tez.dag.api.TezException
TaskCommunicatorContextTaskCommunicator to provide updates on a running task, as well as
receive new information which may need to be propagated to the task. This includes events
generated by the task and events which need to be sent to the task
This method must be invoked periodically to receive updates for a running taskheartbeat in interface TaskCommunicatorContextrequest - the update from the running task.IOExceptionorg.apache.tez.dag.api.TezExceptionpublic boolean isKnownContainer(org.apache.hadoop.yarn.api.records.ContainerId containerId)
TaskCommunicatorContextisKnownContainer in interface TaskCommunicatorContextcontainerId - the relevant container idpublic void taskAlive(org.apache.tez.dag.records.TezTaskAttemptID taskAttemptId)
TaskCommunicatorContexttaskAlive in interface TaskCommunicatorContexttaskAttemptId - the relevant task attemptpublic void containerAlive(org.apache.hadoop.yarn.api.records.ContainerId containerId)
TaskCommunicatorContextcontainerAlive in interface TaskCommunicatorContextcontainerId - the relevant container idpublic void taskSubmitted(org.apache.tez.dag.records.TezTaskAttemptID taskAttemptId,
org.apache.hadoop.yarn.api.records.ContainerId containerId)
TaskCommunicatorContexttaskSubmitted in interface TaskCommunicatorContexttaskAttemptId - the relevant task attempt idcontainerId - the containerId in which the task attempt is runningpublic void taskStartedRemotely(org.apache.tez.dag.records.TezTaskAttemptID taskAttemptId)
TaskCommunicatorContexttaskStartedRemotely in interface TaskCommunicatorContexttaskAttemptId - the relevant task attempt idpublic void taskStartedRemotely(org.apache.tez.dag.records.TezTaskAttemptID taskAttemptId,
org.apache.hadoop.yarn.api.records.ContainerId containerId)
TaskCommunicatorContextTaskCommunicatorContext.taskSubmitted(TezTaskAttemptID, ContainerId)
and TaskCommunicatorContext.taskStartedRemotely(TezTaskAttemptID) insteadtaskStartedRemotely in interface TaskCommunicatorContexttaskAttemptId - the relevant task attempt idpublic void taskKilled(org.apache.tez.dag.records.TezTaskAttemptID taskAttemptId,
org.apache.tez.serviceplugins.api.TaskAttemptEndReason taskAttemptEndReason,
@Nullable
String diagnostics)
TaskCommunicatorContexttaskKilled in interface TaskCommunicatorContexttaskAttemptId - the relevant task attempt idtaskAttemptEndReason - the reason for the task attempt being killeddiagnostics - any diagnostics messages which are relevant to the task attempt
killpublic void taskFailed(org.apache.tez.dag.records.TezTaskAttemptID taskAttemptId,
org.apache.tez.runtime.api.TaskFailureType taskFailureType,
org.apache.tez.serviceplugins.api.TaskAttemptEndReason taskAttemptEndReason,
@Nullable
String diagnostics)
TaskCommunicatorContexttaskFailed in interface TaskCommunicatorContexttaskAttemptId - the relevant task attempt idtaskFailureType - the type of the errortaskAttemptEndReason - the reason for the task failurediagnostics - any diagnostics messages which are relevant to the task attempt
failurepublic void registerForVertexStateUpdates(String vertexName, @Nullable Set<org.apache.tez.dag.api.event.VertexState> stateSet)
TaskCommunicatorContextInputInitializer.onVertexStateUpdated(org.apache.tez.dag.api.event.VertexStateUpdate)
This method can only be invoked once. Duplicate invocations will result in an error.registerForVertexStateUpdates in interface TaskCommunicatorContextvertexName - the vertex name for which notifications are required.stateSet - the set of states for which notifications are required. null implies allpublic String getCurrentAppIdentifier()
TaskCommunicatorContextgetCurrentAppIdentifier in interface TaskCommunicatorContext@Nullable public org.apache.tez.serviceplugins.api.DagInfo getCurrentDagInfo()
getCurrentDagInfo in interface org.apache.tez.serviceplugins.api.ServicePluginContextBasepublic Iterable<String> getInputVertexNames(String vertexName)
TaskCommunicatorContextgetInputVertexNames in interface TaskCommunicatorContextvertexName - the vertex for which source vertex names will be returnedpublic int getVertexTotalTaskCount(String vertexName)
TaskCommunicatorContextgetVertexTotalTaskCount in interface TaskCommunicatorContextvertexName - the relevant vertex namepublic int getVertexCompletedTaskCount(String vertexName)
TaskCommunicatorContextgetVertexCompletedTaskCount in interface TaskCommunicatorContextvertexName - the vertex namepublic int getVertexRunningTaskCount(String vertexName)
TaskCommunicatorContextgetVertexRunningTaskCount in interface TaskCommunicatorContextvertexName - the vertex namepublic long getFirstAttemptStartTime(String vertexName, int taskIndex)
TaskCommunicatorContextgetFirstAttemptStartTime in interface TaskCommunicatorContextvertexName - the vertex to which the task belongstaskIndex - the index of the taskpublic long getDagStartTime()
TaskCommunicatorContextgetDagStartTime in interface TaskCommunicatorContextpublic void reportError(@Nonnull org.apache.tez.serviceplugins.api.ServicePluginError servicePluginError, String message, org.apache.tez.serviceplugins.api.DagInfo dagInfo)
reportError in interface org.apache.tez.serviceplugins.api.ServicePluginContextBasepublic void onStateUpdated(org.apache.tez.dag.api.event.VertexStateUpdate event)
onStateUpdated in interface VertexStateUpdateListener@InterfaceAudience.Private public void dagCompleteStart(DAG dag)
public void dagCompleteEnd()
Copyright © 2020 Apache Software Foundation. All rights reserved.