Search in sources :

Example 6 with TaskEventTermination

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));
        }
    }
}
Also used : TaskEventScheduleTask(org.apache.tez.dag.app.dag.event.TaskEventScheduleTask) Task(org.apache.tez.dag.app.dag.Task) TaskAttemptTerminationCause(org.apache.tez.dag.records.TaskAttemptTerminationCause) TaskEventTermination(org.apache.tez.dag.app.dag.event.TaskEventTermination)

Aggregations

TaskEventTermination (org.apache.tez.dag.app.dag.event.TaskEventTermination)6 TezTaskID (org.apache.tez.dag.records.TezTaskID)3 Test (org.junit.Test)3 Task (org.apache.tez.dag.app.dag.Task)1 TaskAttemptEvent (org.apache.tez.dag.app.dag.event.TaskAttemptEvent)1 TaskAttemptEventAttemptKilled (org.apache.tez.dag.app.dag.event.TaskAttemptEventAttemptKilled)1 TaskAttemptEventSchedule (org.apache.tez.dag.app.dag.event.TaskAttemptEventSchedule)1 TaskAttemptEventStartedRemotely (org.apache.tez.dag.app.dag.event.TaskAttemptEventStartedRemotely)1 TaskAttemptEventSubmitted (org.apache.tez.dag.app.dag.event.TaskAttemptEventSubmitted)1 TaskEventScheduleTask (org.apache.tez.dag.app.dag.event.TaskEventScheduleTask)1 TaskEventTAKilled (org.apache.tez.dag.app.dag.event.TaskEventTAKilled)1 TaskAttemptTerminationCause (org.apache.tez.dag.records.TaskAttemptTerminationCause)1