Search in sources :

Example 1 with VertexEventSourceVertexStarted

use of org.apache.tez.dag.app.dag.event.VertexEventSourceVertexStarted in project tez by apache.

the class VertexImpl method startVertex.

private VertexState startVertex() {
    Preconditions.checkState(getState() == VertexState.INITED, "Vertex must be inited " + logIdentifier);
    if (recoveryData != null && recoveryData.isVertexStarted()) {
        VertexStartedEvent vertexStartedEvent = recoveryData.getVertexStartedEvent();
        this.startedTime = vertexStartedEvent.getStartTime();
    } else {
        this.startedTime = clock.getTime();
    }
    try {
        vertexManager.onVertexStarted(getTaskAttemptIdentifiers(dag, pendingReportedSrcCompletions));
    } catch (AMUserCodeException e) {
        String msg = "Exception in " + e.getSource() + ", vertex=" + logIdentifier;
        LOG.error(msg, e);
        addDiagnostic(msg + "," + ExceptionUtils.getStackTrace(e.getCause()));
        tryEnactKill(VertexTerminationCause.AM_USERCODE_FAILURE, TaskTerminationCause.AM_USERCODE_FAILURE);
        return VertexState.TERMINATING;
    }
    pendingReportedSrcCompletions.clear();
    logJobHistoryVertexStartedEvent();
    // the vertex is fully configured by the time it starts. Always notify completely configured
    // unless the vertex manager has told us that it is going to reconfigure it further.
    // If the vertex was pre-configured then the event would have been sent out earlier. Calling again
    // would be a no-op. If the vertex was not fully configured and waiting for that to complete then
    // we would start immediately after that. Either parallelism updated (now) or IPO changed (future)
    // or vertex added (future). Simplify these cases by sending the event now automatically for the
    // user as if they had invoked the planned()/done() API's.
    maybeSendConfiguredEvent();
    // when we are ready
    if (targetVertices != null) {
        for (Vertex targetVertex : targetVertices.keySet()) {
            eventHandler.handle(new VertexEventSourceVertexStarted(targetVertex.getVertexId(), getVertexId(), distanceFromRoot));
        }
    }
    // If we have no tasks, just transition to vertex completed
    if (this.numTasks == 0) {
        eventHandler.handle(new VertexEvent(this.vertexId, VertexEventType.V_COMPLETED));
    }
    return VertexState.RUNNING;
}
Also used : VertexEventRecoverVertex(org.apache.tez.dag.app.dag.event.VertexEventRecoverVertex) Vertex(org.apache.tez.dag.app.dag.Vertex) VertexEventSourceVertexStarted(org.apache.tez.dag.app.dag.event.VertexEventSourceVertexStarted) VertexStartedEvent(org.apache.tez.dag.history.events.VertexStartedEvent) VertexEvent(org.apache.tez.dag.app.dag.event.VertexEvent)

Aggregations

Vertex (org.apache.tez.dag.app.dag.Vertex)1 VertexEvent (org.apache.tez.dag.app.dag.event.VertexEvent)1 VertexEventRecoverVertex (org.apache.tez.dag.app.dag.event.VertexEventRecoverVertex)1 VertexEventSourceVertexStarted (org.apache.tez.dag.app.dag.event.VertexEventSourceVertexStarted)1 VertexStartedEvent (org.apache.tez.dag.history.events.VertexStartedEvent)1