use of org.apache.tez.dag.app.AppContext in project tez by apache.
the class LocalClient method getApplicationReport.
@Override
public ApplicationReport getApplicationReport(ApplicationId appId) {
ApplicationReport report = Records.newRecord(ApplicationReport.class);
report.setApplicationId(appId);
report.setCurrentApplicationAttemptId(dagAppMaster.getAttemptID());
AppContext runningAppContext = dagAppMaster.getContext();
if (runningAppContext != null) {
DAG dag = runningAppContext.getCurrentDAG();
if (dag != null) {
report.setUser(runningAppContext.getUser());
}
report.setName(runningAppContext.getApplicationName());
report.setStartTime(runningAppContext.getStartTime());
}
report.setHost(dagAppMaster.getAppNMHost());
report.setRpcPort(dagAppMaster.getRpcPort());
report.setClientToAMToken(null);
report.setYarnApplicationState(convertDAGAppMasterState(dagAppMaster.getState()));
report.setFinalApplicationStatus(convertDAGAppMasterStateToFinalYARNState(dagAppMaster.getState()));
List<String> diagnostics = dagAppMaster.getDiagnostics();
if (diagnostics != null) {
report.setDiagnostics(diagnostics.toString());
}
report.setTrackingUrl("N/A");
report.setFinishTime(0);
report.setApplicationResourceUsageReport(null);
report.setOriginalTrackingUrl("N/A");
report.setProgress(dagAppMaster.getProgress());
report.setAMRMToken(null);
return report;
}
use of org.apache.tez.dag.app.AppContext 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