use of org.apache.tez.dag.app.dag.event.TaskEventTermination in project tez by apache.
the class VertexImpl method tryEnactKill.
/**
* Set the terminationCause and send a kill-message to all tasks.
* The task-kill messages are only sent once.
*/
void tryEnactKill(VertexTerminationCause trigger, TaskTerminationCause taskterminationCause) {
// In most cases the dag is shutting down due to some error
TaskAttemptTerminationCause errCause = TaskAttemptTerminationCause.TERMINATED_AT_SHUTDOWN;
if (taskterminationCause == TaskTerminationCause.DAG_KILL) {
errCause = TaskAttemptTerminationCause.TERMINATED_BY_CLIENT;
}
if (trySetTerminationCause(trigger)) {
String msg = "Killing tasks in vertex: " + logIdentifier + " due to trigger: " + trigger;
LOG.info(msg);
for (Task task : tasks.values()) {
// attempt was terminated because the vertex is shutting down
eventHandler.handle(new TaskEventTermination(task.getTaskId(), errCause, msg));
}
}
}
Aggregations