Search in sources :

Example 71 with DAGHistoryEvent

use of org.apache.tez.dag.history.DAGHistoryEvent in project tez by apache.

the class ContainerLauncherContextImpl method containerLaunched.

@Override
public void containerLaunched(ContainerId containerId) {
    context.getEventHandler().handle(new AMContainerEventLaunched(containerId));
    ContainerLaunchedEvent lEvt = new ContainerLaunchedEvent(containerId, context.getClock().getTime(), context.getApplicationAttemptId());
    context.getHistoryHandler().handle(new DAGHistoryEvent(null, lEvt));
}
Also used : ContainerLaunchedEvent(org.apache.tez.dag.history.events.ContainerLaunchedEvent) DAGHistoryEvent(org.apache.tez.dag.history.DAGHistoryEvent) AMContainerEventLaunched(org.apache.tez.dag.app.rm.container.AMContainerEventLaunched)

Example 72 with DAGHistoryEvent

use of org.apache.tez.dag.history.DAGHistoryEvent in project tez by apache.

the class TaskAttemptImpl method logJobHistoryAttemptStarted.

protected void logJobHistoryAttemptStarted() {
    Preconditions.checkArgument(recoveryData == null);
    String inProgressLogsUrl = getInProgressLogsUrl();
    String completedLogsUrl = getCompletedLogsUrl();
    TaskAttemptStartedEvent startEvt = new TaskAttemptStartedEvent(attemptId, getVertex().getName(), launchTime, containerId, containerNodeId, inProgressLogsUrl, completedLogsUrl, nodeHttpAddress);
    this.appContext.getHistoryHandler().handle(new DAGHistoryEvent(getDAGID(), startEvt));
}
Also used : DAGHistoryEvent(org.apache.tez.dag.history.DAGHistoryEvent) TaskAttemptStartedEvent(org.apache.tez.dag.history.events.TaskAttemptStartedEvent)

Example 73 with DAGHistoryEvent

use of org.apache.tez.dag.history.DAGHistoryEvent in project tez by apache.

the class TaskAttemptImpl method logJobHistoryAttemptFinishedEvent.

protected void logJobHistoryAttemptFinishedEvent(TaskAttemptStateInternal state) {
    Preconditions.checkArgument(recoveryData == null || recoveryData.getTaskAttemptFinishedEvent() == null, "log TaskAttemptFinishedEvent again in recovery when there's already another TaskAtttemptFinishedEvent");
    if (getLaunchTime() == 0)
        return;
    TaskAttemptFinishedEvent finishEvt = new TaskAttemptFinishedEvent(attemptId, getVertex().getName(), getLaunchTime(), getFinishTime(), TaskAttemptState.SUCCEEDED, null, null, "", getCounters(), lastDataEvents, taGeneratedEvents, creationTime, creationCausalTA, allocationTime, null, null, null, null, null);
    // FIXME how do we store information regd completion events
    this.appContext.getHistoryHandler().handle(new DAGHistoryEvent(getDAGID(), finishEvt));
}
Also used : DAGHistoryEvent(org.apache.tez.dag.history.DAGHistoryEvent) TaskAttemptFinishedEvent(org.apache.tez.dag.history.events.TaskAttemptFinishedEvent)

Example 74 with DAGHistoryEvent

use of org.apache.tez.dag.history.DAGHistoryEvent in project tez by apache.

the class DAGAppMaster method startDAG.

private void startDAG(DAGPlan dagPlan, Map<String, LocalResource> additionalAMResources) throws TezException {
    long submitTime = this.clock.getTime();
    this.appName = dagPlan.getName();
    // /////////////////// Create the job itself.
    final DAG newDAG = createDAG(dagPlan);
    _updateLoggers(newDAG, "");
    if (LOG.isDebugEnabled()) {
        LOG.debug("Running a DAG with " + dagPlan.getVertexCount() + " vertices ");
        for (VertexPlan v : dagPlan.getVertexList()) {
            LOG.debug("DAG has vertex " + v.getName());
        }
    }
    Map<String, LocalResource> lrDiff = getAdditionalLocalResourceDiff(newDAG, additionalAMResources);
    if (lrDiff != null) {
        amResources.putAll(lrDiff);
        cumulativeAdditionalResources.putAll(lrDiff);
    }
    String callerContextStr = "";
    if (dagPlan.hasCallerContext()) {
        CallerContext callerContext = DagTypeConverters.convertCallerContextFromProto(dagPlan.getCallerContext());
        callerContextStr = ", callerContext=" + callerContext.contextAsSimpleString();
    }
    LOG.info("Running DAG: " + dagPlan.getName() + callerContextStr);
    String timeStamp = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(Calendar.getInstance().getTime());
    System.err.println(timeStamp + " Running Dag: " + newDAG.getID());
    System.out.println(timeStamp + " Running Dag: " + newDAG.getID());
    // Job name is the same as the app name until we support multiple dags
    // for an app later
    final DAGSubmittedEvent submittedEvent = new DAGSubmittedEvent(newDAG.getID(), submitTime, dagPlan, this.appAttemptID, cumulativeAdditionalResources, newDAG.getUserName(), newDAG.getConf(), containerLogs, getContext().getQueueName());
    boolean dagLoggingEnabled = newDAG.getConf().getBoolean(TezConfiguration.TEZ_DAG_HISTORY_LOGGING_ENABLED, TezConfiguration.TEZ_DAG_HISTORY_LOGGING_ENABLED_DEFAULT);
    submittedEvent.setHistoryLoggingEnabled(dagLoggingEnabled);
    try {
        appMasterUgi.doAs(new PrivilegedExceptionAction<Void>() {

            @Override
            public Void run() throws Exception {
                historyEventHandler.handleCriticalEvent(new DAGHistoryEvent(newDAG.getID(), submittedEvent));
                return null;
            }
        });
    } catch (IOException e) {
        throw new TezUncheckedException(e);
    } catch (InterruptedException e) {
        throw new TezUncheckedException(e);
    }
    startDAGExecution(newDAG, lrDiff);
    // set state after curDag is set
    this.state = DAGAppMasterState.RUNNING;
}
Also used : CallerContext(org.apache.tez.client.CallerContext) TezUncheckedException(org.apache.tez.dag.api.TezUncheckedException) DAGHistoryEvent(org.apache.tez.dag.history.DAGHistoryEvent) DAG(org.apache.tez.dag.app.dag.DAG) IOException(java.io.IOException) TezUncheckedException(org.apache.tez.dag.api.TezUncheckedException) IOException(java.io.IOException) UnknownHostException(java.net.UnknownHostException) JSONException(org.codehaus.jettison.json.JSONException) URISyntaxException(java.net.URISyntaxException) FileNotFoundException(java.io.FileNotFoundException) TezException(org.apache.tez.dag.api.TezException) ServiceStateException(org.apache.hadoop.service.ServiceStateException) LocalResource(org.apache.hadoop.yarn.api.records.LocalResource) VertexPlan(org.apache.tez.dag.api.records.DAGProtos.VertexPlan) SimpleDateFormat(java.text.SimpleDateFormat) DAGSubmittedEvent(org.apache.tez.dag.history.events.DAGSubmittedEvent)

Example 75 with DAGHistoryEvent

use of org.apache.tez.dag.history.DAGHistoryEvent in project tez by apache.

the class TestATSHistoryV15 method testGetGroupId.

@Test
public void testGetGroupId() throws Exception {
    ApplicationId appId = ApplicationId.newInstance(1000l, 1);
    TezDAGID dagid = TezDAGID.getInstance(appId, 1);
    for (final HistoryEventType eventType : HistoryEventType.values()) {
        HistoryEvent historyEvent = new HistoryEvent() {

            @Override
            public HistoryEventType getEventType() {
                return eventType;
            }

            @Override
            public boolean isRecoveryEvent() {
                return false;
            }

            @Override
            public boolean isHistoryEvent() {
                return false;
            }

            @Override
            public void toProtoStream(OutputStream outputStream) throws IOException {
            }

            @Override
            public void fromProtoStream(InputStream inputStream) throws IOException {
            }
        };
        DAGHistoryEvent event = new DAGHistoryEvent(dagid, historyEvent);
        ATSV15HistoryLoggingService service = new ATSV15HistoryLoggingService();
        AppContext appContext = mock(AppContext.class);
        when(appContext.getApplicationID()).thenReturn(appId);
        when(appContext.getHadoopShim()).thenReturn(new HadoopShim() {
        });
        service.setAppContext(appContext);
        TimelineEntityGroupId grpId = service.getGroupId(event);
        Assert.assertNotNull(grpId);
        Assert.assertEquals(appId, grpId.getApplicationId());
        switch(eventType) {
            case AM_LAUNCHED:
            case APP_LAUNCHED:
            case AM_STARTED:
            case CONTAINER_LAUNCHED:
            case CONTAINER_STOPPED:
                Assert.assertEquals(appId.toString(), grpId.getTimelineEntityGroupId());
                break;
            default:
                Assert.assertEquals(dagid.toString(), grpId.getTimelineEntityGroupId());
        }
        service.close();
    }
}
Also used : HadoopShim(org.apache.tez.hadoop.shim.HadoopShim) InputStream(java.io.InputStream) OutputStream(java.io.OutputStream) AppContext(org.apache.tez.dag.app.AppContext) TezDAGID(org.apache.tez.dag.records.TezDAGID) DAGHistoryEvent(org.apache.tez.dag.history.DAGHistoryEvent) HistoryEventType(org.apache.tez.dag.history.HistoryEventType) TimelineEntityGroupId(org.apache.hadoop.yarn.api.records.timeline.TimelineEntityGroupId) ApplicationId(org.apache.hadoop.yarn.api.records.ApplicationId) DAGHistoryEvent(org.apache.tez.dag.history.DAGHistoryEvent) HistoryEvent(org.apache.tez.dag.history.HistoryEvent) ATSV15HistoryLoggingService(org.apache.tez.dag.history.logging.ats.ATSV15HistoryLoggingService) Test(org.junit.Test)

Aggregations

DAGHistoryEvent (org.apache.tez.dag.history.DAGHistoryEvent)81 TezDAGID (org.apache.tez.dag.records.TezDAGID)38 Test (org.junit.Test)33 DAGSubmittedEvent (org.apache.tez.dag.history.events.DAGSubmittedEvent)21 IOException (java.io.IOException)18 Configuration (org.apache.hadoop.conf.Configuration)18 DAGPlan (org.apache.tez.dag.api.records.DAGProtos.DAGPlan)18 ApplicationId (org.apache.hadoop.yarn.api.records.ApplicationId)17 Path (org.apache.hadoop.fs.Path)15 SystemClock (org.apache.hadoop.yarn.util.SystemClock)14 DAGRecoveryData (org.apache.tez.dag.app.RecoveryParser.DAGRecoveryData)13 DAGStartedEvent (org.apache.tez.dag.history.events.DAGStartedEvent)11 RecoveryService (org.apache.tez.dag.history.recovery.RecoveryService)11 TezVertexID (org.apache.tez.dag.records.TezVertexID)10 TaskStartedEvent (org.apache.tez.dag.history.events.TaskStartedEvent)7 ApplicationAttemptId (org.apache.hadoop.yarn.api.records.ApplicationAttemptId)6 TimelineEntity (org.apache.hadoop.yarn.api.records.timeline.TimelineEntity)6 TezConfiguration (org.apache.tez.dag.api.TezConfiguration)6 DAGFinishedEvent (org.apache.tez.dag.history.events.DAGFinishedEvent)6 VertexFinishedEvent (org.apache.tez.dag.history.events.VertexFinishedEvent)6