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));
}
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));
}
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));
}
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;
}
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();
}
}
Aggregations