@Override public TimelinePutResponse run() throws Exception { timelineV2Client.putEntitiesAsync(entity); return null; } });
@Override public TimelinePutResponse run() throws Exception { timelineV2Client.putEntitiesAsync(entity); return null; } });
@Override public TimelinePutResponse run() throws Exception { timelineV2Client.putEntitiesAsync(entity); return null; } });
private void publishContainerStartFailedEventOnTimelineServiceV2( final ContainerId containerId, String diagnostics) { final org.apache.hadoop.yarn.api.records.timelineservice.TimelineEntity entity = new org.apache.hadoop.yarn.api.records.timelineservice. TimelineEntity(); entity.setId(containerId.toString()); entity.setType(DSEntity.DS_CONTAINER.toString()); entity.addInfo("user", appSubmitterUgi.getShortUserName()); org.apache.hadoop.yarn.api.records.timelineservice.TimelineEvent event = new org.apache.hadoop.yarn.api.records.timelineservice .TimelineEvent(); event.setTimestamp(System.currentTimeMillis()); event.setId(DSEvent.DS_CONTAINER_END.toString()); event.addInfo(DIAGNOSTICS, diagnostics); entity.addEvent(event); try { appSubmitterUgi.doAs((PrivilegedExceptionAction<Object>) () -> { timelineV2Client.putEntitiesAsync(entity); return null; }); } catch (Exception e) { LOG.error("Container start failed event could not be published for {}", containerId, e instanceof UndeclaredThrowableException ? e.getCause() : e); } }
timelineClient.putEntitiesAsync(entity); } else { LOG.error("Seems like client has been removed before the event could be"
timelineClient.putEntitiesAsync(entity); } else { LOG.error("Seems like client has been removed before the container"
private void publishAndVerifyEntity(ApplicationId appId, File entityTypeDir, String entityType, int numEntities) throws Exception { TimelineV2Client client = createTimelineClientForUGI(appId); try { // Sync call. Results available immediately. client.putEntities(createEntity("entity1", entityType)); assertEquals(numEntities, entityTypeDir.listFiles().length); verifyEntity(entityTypeDir, "entity1", entityType); // Async call. client.putEntitiesAsync(createEntity("entity2", entityType)); } finally { client.stop(); } }
client.putEntities(cluster, flow, app, appAttempt, container, user, queue); client.putEntitiesAsync(cluster, flow, app, appAttempt, container, user, queue); } finally {
@Test public void testPutEntities() throws Exception { TimelineV2Client client = TimelineV2Client.createTimelineClient(ApplicationId.newInstance(0, 1)); try { // Set the timeline service address manually. client.setTimelineCollectorInfo(CollectorInfo.newInstance( collectorManager.getRestServerBindAddress())); client.init(conf); client.start(); TimelineEntity entity = new TimelineEntity(); entity.setType("test entity type"); entity.setId("test entity id"); TimelineMetric metric = new TimelineMetric(TimelineMetric.Type.TIME_SERIES); metric.setId("test metric id"); metric.addValue(1L, 1.0D); metric.addValue(2L, 2.0D); entity.addMetric(metric); client.putEntities(entity); client.putEntitiesAsync(entity); } finally { client.stop(); } }
timelineV2Client.putEntitiesAsync(tEntity); } else { timelineV2Client.putEntities(tEntity, appEntityWithJobMetrics);