Java Code Examples for org.apache.hadoop.yarn.api.records.timeline.TimelineEntity#addPrimaryFilter()
The following examples show how to use
org.apache.hadoop.yarn.api.records.timeline.TimelineEntity#addPrimaryFilter() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HistoryEventTimelineConversion.java From incubator-tez with Apache License 2.0 | 6 votes |
private static TimelineEntity convertTaskFinishedEvent(TaskFinishedEvent event) { TimelineEntity atsEntity = new TimelineEntity(); atsEntity.setEntityId(event.getTaskID().toString()); atsEntity.setEntityType(EntityTypes.TEZ_TASK_ID.name()); atsEntity.addPrimaryFilter(EntityTypes.TEZ_DAG_ID.name(), event.getTaskID().getVertexID().getDAGId().toString()); atsEntity.addPrimaryFilter(EntityTypes.TEZ_VERTEX_ID.name(), event.getTaskID().getVertexID().toString()); TimelineEvent finishEvt = new TimelineEvent(); finishEvt.setEventType(HistoryEventType.TASK_FINISHED.name()); finishEvt.setTimestamp(event.getFinishTime()); atsEntity.addEvent(finishEvt); atsEntity.addOtherInfo(ATSConstants.FINISH_TIME, event.getFinishTime()); atsEntity.addOtherInfo(ATSConstants.TIME_TAKEN, (event.getFinishTime() - event.getStartTime())); atsEntity.addOtherInfo(ATSConstants.STATUS, event.getState().name()); atsEntity.addOtherInfo(ATSConstants.DIAGNOSTICS, event.getDiagnostics()); atsEntity.addOtherInfo(ATSConstants.COUNTERS, DAGUtils.convertCountersToATSMap(event.getTezCounters())); return atsEntity; }
Example 2
Source File: HistoryEventTimelineConversion.java From incubator-tez with Apache License 2.0 | 6 votes |
private static TimelineEntity convertDAGInitializedEvent(DAGInitializedEvent event) { TimelineEntity atsEntity = new TimelineEntity(); atsEntity.setEntityId(event.getDagID().toString()); atsEntity.setEntityType(EntityTypes.TEZ_DAG_ID.name()); TimelineEvent finishEvt = new TimelineEvent(); finishEvt.setEventType(HistoryEventType.DAG_INITIALIZED.name()); finishEvt.setTimestamp(event.getInitTime()); atsEntity.addEvent(finishEvt); atsEntity.addPrimaryFilter(ATSConstants.USER, event.getUser()); atsEntity.addPrimaryFilter(ATSConstants.DAG_NAME, event.getDagName()); atsEntity.addOtherInfo(ATSConstants.INIT_TIME, event.getInitTime()); return atsEntity; }
Example 3
Source File: HistoryEventTimelineConversion.java From incubator-tez with Apache License 2.0 | 6 votes |
private static TimelineEntity convertAMLaunchedEvent(AMLaunchedEvent event) { TimelineEntity atsEntity = new TimelineEntity(); atsEntity.setEntityId("tez_" + event.getApplicationAttemptId().toString()); atsEntity.setEntityType(EntityTypes.TEZ_APPLICATION_ATTEMPT.name()); atsEntity.addRelatedEntity(ATSConstants.APPLICATION_ID, event.getApplicationAttemptId().getApplicationId().toString()); atsEntity.addRelatedEntity(ATSConstants.APPLICATION_ATTEMPT_ID, event.getApplicationAttemptId().toString()); atsEntity.addRelatedEntity(ATSConstants.USER, event.getUser()); atsEntity.addPrimaryFilter(ATSConstants.USER, event.getUser()); atsEntity.setStartTime(event.getLaunchTime()); TimelineEvent launchEvt = new TimelineEvent(); launchEvt.setEventType(HistoryEventType.AM_LAUNCHED.name()); launchEvt.setTimestamp(event.getLaunchTime()); atsEntity.addEvent(launchEvt); atsEntity.addOtherInfo(ATSConstants.APP_SUBMIT_TIME, event.getAppSubmitTime()); return atsEntity; }
Example 4
Source File: ApplicationMaster.java From big-c with Apache License 2.0 | 6 votes |
private static void publishContainerEndEvent( final TimelineClient timelineClient, ContainerStatus container, String domainId, UserGroupInformation ugi) { final TimelineEntity entity = new TimelineEntity(); entity.setEntityId(container.getContainerId().toString()); entity.setEntityType(DSEntity.DS_CONTAINER.toString()); entity.setDomainId(domainId); entity.addPrimaryFilter("user", ugi.getShortUserName()); TimelineEvent event = new TimelineEvent(); event.setTimestamp(System.currentTimeMillis()); event.setEventType(DSEvent.DS_CONTAINER_END.toString()); event.addEventInfo("State", container.getState().name()); event.addEventInfo("Exit Status", container.getExitStatus()); entity.addEvent(event); try { timelineClient.putEntities(entity); } catch (YarnException | IOException e) { LOG.error("Container end event could not be published for " + container.getContainerId().toString(), e); } }
Example 5
Source File: HistoryEventTimelineConversion.java From incubator-tez with Apache License 2.0 | 6 votes |
private static TimelineEntity convertVertexInitializedEvent(VertexInitializedEvent event) { TimelineEntity atsEntity = new TimelineEntity(); atsEntity.setEntityId(event.getVertexID().toString()); atsEntity.setEntityType(EntityTypes.TEZ_VERTEX_ID.name()); atsEntity.addRelatedEntity(EntityTypes.TEZ_DAG_ID.name(), event.getVertexID().getDAGId().toString()); atsEntity.addPrimaryFilter(EntityTypes.TEZ_DAG_ID.name(), event.getVertexID().getDAGId().toString()); TimelineEvent initEvt = new TimelineEvent(); initEvt.setEventType(HistoryEventType.VERTEX_INITIALIZED.name()); initEvt.setTimestamp(event.getInitedTime()); atsEntity.addEvent(initEvt); atsEntity.addOtherInfo(ATSConstants.VERTEX_NAME, event.getVertexName()); atsEntity.addOtherInfo(ATSConstants.INIT_REQUESTED_TIME, event.getInitRequestedTime()); atsEntity.addOtherInfo(ATSConstants.INIT_TIME, event.getInitedTime()); atsEntity.addOtherInfo(ATSConstants.NUM_TASKS, event.getNumTasks()); atsEntity.addOtherInfo(ATSConstants.PROCESSOR_CLASS_NAME, event.getProcessorName()); return atsEntity; }
Example 6
Source File: HistoryEventTimelineConversion.java From tez with Apache License 2.0 | 6 votes |
private static TimelineEntity convertContainerLaunchedEvent(ContainerLaunchedEvent event) { TimelineEntity atsEntity = new TimelineEntity(); atsEntity.setEntityId("tez_" + event.getContainerId().toString()); atsEntity.setEntityType(EntityTypes.TEZ_CONTAINER_ID.name()); atsEntity.addRelatedEntity(EntityTypes.TEZ_APPLICATION_ATTEMPT.name(), "tez_" + event.getApplicationAttemptId().toString()); atsEntity.addPrimaryFilter(ATSConstants.APPLICATION_ID, event.getApplicationAttemptId().getApplicationId().toString()); atsEntity.addOtherInfo(ATSConstants.CONTAINER_ID, event.getContainerId().toString()); atsEntity.setStartTime(event.getLaunchTime()); TimelineEvent launchEvt = new TimelineEvent(); launchEvt.setEventType(HistoryEventType.CONTAINER_LAUNCHED.name()); launchEvt.setTimestamp(event.getLaunchTime()); atsEntity.addEvent(launchEvt); return atsEntity; }
Example 7
Source File: HistoryEventTimelineConversion.java From incubator-tez with Apache License 2.0 | 6 votes |
private static TimelineEntity convertTaskAttemptFinishedEvent(TaskAttemptFinishedEvent event) { TimelineEntity atsEntity = new TimelineEntity(); atsEntity.setEntityId(event.getTaskAttemptID().toString()); atsEntity.setEntityType(EntityTypes.TEZ_TASK_ATTEMPT_ID.name()); atsEntity.addPrimaryFilter(EntityTypes.TEZ_DAG_ID.name(), event.getTaskAttemptID().getTaskID().getVertexID().getDAGId().toString()); atsEntity.addPrimaryFilter(EntityTypes.TEZ_VERTEX_ID.name(), event.getTaskAttemptID().getTaskID().getVertexID().toString()); atsEntity.addPrimaryFilter(EntityTypes.TEZ_TASK_ID.name(), event.getTaskAttemptID().getTaskID().toString()); TimelineEvent finishEvt = new TimelineEvent(); finishEvt.setEventType(HistoryEventType.TASK_ATTEMPT_FINISHED.name()); finishEvt.setTimestamp(event.getFinishTime()); atsEntity.addEvent(finishEvt); atsEntity.addOtherInfo(ATSConstants.FINISH_TIME, event.getFinishTime()); atsEntity.addOtherInfo(ATSConstants.TIME_TAKEN, (event.getFinishTime() - event.getStartTime())); atsEntity.addOtherInfo(ATSConstants.STATUS, event.getState().name()); atsEntity.addOtherInfo(ATSConstants.DIAGNOSTICS, event.getDiagnostics()); atsEntity.addOtherInfo(ATSConstants.COUNTERS, DAGUtils.convertCountersToATSMap(event.getCounters())); return atsEntity; }
Example 8
Source File: ApplicationMaster.java From hadoop with Apache License 2.0 | 6 votes |
private static void publishContainerEndEvent( final TimelineClient timelineClient, ContainerStatus container, String domainId, UserGroupInformation ugi) { final TimelineEntity entity = new TimelineEntity(); entity.setEntityId(container.getContainerId().toString()); entity.setEntityType(DSEntity.DS_CONTAINER.toString()); entity.setDomainId(domainId); entity.addPrimaryFilter("user", ugi.getShortUserName()); TimelineEvent event = new TimelineEvent(); event.setTimestamp(System.currentTimeMillis()); event.setEventType(DSEvent.DS_CONTAINER_END.toString()); event.addEventInfo("State", container.getState().name()); event.addEventInfo("Exit Status", container.getExitStatus()); entity.addEvent(event); try { timelineClient.putEntities(entity); } catch (YarnException | IOException e) { LOG.error("Container end event could not be published for " + container.getContainerId().toString(), e); } }
Example 9
Source File: HistoryEventTimelineConversion.java From tez with Apache License 2.0 | 6 votes |
private static TimelineEntity convertAMStartedEvent(AMStartedEvent event) { TimelineEntity atsEntity = new TimelineEntity(); atsEntity.setEntityId("tez_" + event.getApplicationAttemptId().toString()); atsEntity.setEntityType(EntityTypes.TEZ_APPLICATION_ATTEMPT.name()); atsEntity.addPrimaryFilter(ATSConstants.USER, event.getUser()); atsEntity.addPrimaryFilter(ATSConstants.APPLICATION_ID, event.getApplicationAttemptId().getApplicationId().toString()); TimelineEvent startEvt = new TimelineEvent(); startEvt.setEventType(HistoryEventType.AM_STARTED.name()); startEvt.setTimestamp(event.getStartTime()); atsEntity.addEvent(startEvt); return atsEntity; }
Example 10
Source File: TestTimelineACLsManager.java From hadoop with Apache License 2.0 | 6 votes |
@Test public void testYarnACLsNotEnabledForEntity() throws Exception { Configuration conf = new YarnConfiguration(); conf.setBoolean(YarnConfiguration.YARN_ACL_ENABLE, false); TimelineACLsManager timelineACLsManager = new TimelineACLsManager(conf); timelineACLsManager.setTimelineStore(new TestTimelineStore()); TimelineEntity entity = new TimelineEntity(); entity.addPrimaryFilter( TimelineStore.SystemFilter.ENTITY_OWNER .toString(), "owner"); entity.setDomainId("domain_id_1"); Assert.assertTrue( "Always true when ACLs are not enabled", timelineACLsManager.checkAccess( UserGroupInformation.createRemoteUser("user"), ApplicationAccessType.VIEW_APP, entity)); Assert.assertTrue( "Always true when ACLs are not enabled", timelineACLsManager.checkAccess( UserGroupInformation.createRemoteUser("user"), ApplicationAccessType.MODIFY_APP, entity)); }
Example 11
Source File: HistoryEventTimelineConversion.java From incubator-tez with Apache License 2.0 | 6 votes |
private static TimelineEntity convertDAGStartedEvent(DAGStartedEvent event) { TimelineEntity atsEntity = new TimelineEntity(); atsEntity.setEntityId(event.getDagID().toString()); atsEntity.setEntityType(EntityTypes.TEZ_DAG_ID.name()); TimelineEvent startEvt = new TimelineEvent(); startEvt.setEventType(HistoryEventType.DAG_STARTED.name()); startEvt.setTimestamp(event.getStartTime()); atsEntity.addEvent(startEvt); atsEntity.addPrimaryFilter(ATSConstants.USER, event.getUser()); atsEntity.addPrimaryFilter(ATSConstants.DAG_NAME, event.getDagName()); atsEntity.addOtherInfo(ATSConstants.START_TIME, event.getStartTime()); return atsEntity; }
Example 12
Source File: ApplicationMaster.java From hadoop with Apache License 2.0 | 5 votes |
private static void publishContainerStartEvent( final TimelineClient timelineClient, Container container, String domainId, UserGroupInformation ugi) { final TimelineEntity entity = new TimelineEntity(); entity.setEntityId(container.getId().toString()); entity.setEntityType(DSEntity.DS_CONTAINER.toString()); entity.setDomainId(domainId); entity.addPrimaryFilter("user", ugi.getShortUserName()); TimelineEvent event = new TimelineEvent(); event.setTimestamp(System.currentTimeMillis()); event.setEventType(DSEvent.DS_CONTAINER_START.toString()); event.addEventInfo("Node", container.getNodeId().toString()); event.addEventInfo("Resources", container.getResource().toString()); entity.addEvent(event); try { ugi.doAs(new PrivilegedExceptionAction<TimelinePutResponse>() { @Override public TimelinePutResponse run() throws Exception { return timelineClient.putEntities(entity); } }); } catch (Exception e) { LOG.error("Container start event could not be published for " + container.getId().toString(), e instanceof UndeclaredThrowableException ? e.getCause() : e); } }
Example 13
Source File: HistoryEventTimelineConversion.java From tez with Apache License 2.0 | 5 votes |
private static TimelineEntity convertVertexInitializedEvent(VertexInitializedEvent event) { TimelineEntity atsEntity = new TimelineEntity(); atsEntity.setEntityId(event.getVertexID().toString()); atsEntity.setEntityType(EntityTypes.TEZ_VERTEX_ID.name()); atsEntity.addRelatedEntity(EntityTypes.TEZ_DAG_ID.name(), event.getVertexID().getDAGId().toString()); atsEntity.addPrimaryFilter(ATSConstants.APPLICATION_ID, event.getVertexID().getDAGId().getApplicationId().toString()); atsEntity.addPrimaryFilter(EntityTypes.TEZ_DAG_ID.name(), event.getVertexID().getDAGId().toString()); TimelineEvent initEvt = new TimelineEvent(); initEvt.setEventType(HistoryEventType.VERTEX_INITIALIZED.name()); initEvt.setTimestamp(event.getInitedTime()); atsEntity.addEvent(initEvt); atsEntity.setStartTime(event.getInitedTime()); atsEntity.addOtherInfo(ATSConstants.VERTEX_NAME, event.getVertexName()); atsEntity.addOtherInfo(ATSConstants.INIT_REQUESTED_TIME, event.getInitRequestedTime()); atsEntity.addOtherInfo(ATSConstants.INIT_TIME, event.getInitedTime()); atsEntity.addOtherInfo(ATSConstants.NUM_TASKS, event.getNumTasks()); atsEntity.addOtherInfo(ATSConstants.PROCESSOR_CLASS_NAME, event.getProcessorName()); if (event.getServicePluginInfo() != null) { atsEntity.addOtherInfo(ATSConstants.SERVICE_PLUGIN, DAGUtils.convertServicePluginToATSMap(event.getServicePluginInfo())); } return atsEntity; }
Example 14
Source File: HistoryEventTimelineConversion.java From tez with Apache License 2.0 | 5 votes |
private static TimelineEntity convertTaskStartedEvent(TaskStartedEvent event) { TimelineEntity atsEntity = new TimelineEntity(); atsEntity.setEntityId(event.getTaskID().toString()); atsEntity.setEntityType(EntityTypes.TEZ_TASK_ID.name()); atsEntity.addRelatedEntity(EntityTypes.TEZ_VERTEX_ID.name(), event.getTaskID().getVertexID().toString()); atsEntity.addPrimaryFilter(ATSConstants.APPLICATION_ID, event.getTaskID().getVertexID().getDAGId().getApplicationId().toString()); atsEntity.addPrimaryFilter(EntityTypes.TEZ_DAG_ID.name(), event.getTaskID().getVertexID().getDAGId().toString()); atsEntity.addPrimaryFilter(EntityTypes.TEZ_VERTEX_ID.name(), event.getTaskID().getVertexID().toString()); TimelineEvent startEvt = new TimelineEvent(); startEvt.setEventType(HistoryEventType.TASK_STARTED.name()); startEvt.setTimestamp(event.getStartTime()); atsEntity.addEvent(startEvt); atsEntity.setStartTime(event.getStartTime()); atsEntity.addOtherInfo(ATSConstants.START_TIME, event.getStartTime()); atsEntity.addOtherInfo(ATSConstants.SCHEDULED_TIME, event.getScheduledTime()); atsEntity.addOtherInfo(ATSConstants.STATUS, event.getState().name()); return atsEntity; }
Example 15
Source File: HistoryEventTimelineConversion.java From tez with Apache License 2.0 | 5 votes |
private static TimelineEntity convertTaskFinishedEvent(TaskFinishedEvent event) { TimelineEntity atsEntity = new TimelineEntity(); atsEntity.setEntityId(event.getTaskID().toString()); atsEntity.setEntityType(EntityTypes.TEZ_TASK_ID.name()); atsEntity.addPrimaryFilter(ATSConstants.APPLICATION_ID, event.getTaskID().getVertexID().getDAGId().getApplicationId().toString()); atsEntity.addPrimaryFilter(EntityTypes.TEZ_DAG_ID.name(), event.getTaskID().getVertexID().getDAGId().toString()); atsEntity.addPrimaryFilter(EntityTypes.TEZ_VERTEX_ID.name(), event.getTaskID().getVertexID().toString()); TimelineEvent finishEvt = new TimelineEvent(); finishEvt.setEventType(HistoryEventType.TASK_FINISHED.name()); finishEvt.setTimestamp(event.getFinishTime()); atsEntity.addEvent(finishEvt); atsEntity.addPrimaryFilter(ATSConstants.STATUS, event.getState().name()); atsEntity.addOtherInfo(ATSConstants.FINISH_TIME, event.getFinishTime()); atsEntity.addOtherInfo(ATSConstants.TIME_TAKEN, (event.getFinishTime() - event.getStartTime())); atsEntity.addOtherInfo(ATSConstants.STATUS, event.getState().name()); atsEntity.addOtherInfo(ATSConstants.NUM_FAILED_TASKS_ATTEMPTS, event.getNumFailedAttempts()); if (event.getSuccessfulAttemptID() != null) { atsEntity.addOtherInfo(ATSConstants.SUCCESSFUL_ATTEMPT_ID, event.getSuccessfulAttemptID().toString()); } atsEntity.addOtherInfo(ATSConstants.DIAGNOSTICS, event.getDiagnostics()); atsEntity.addOtherInfo(ATSConstants.COUNTERS, DAGUtils.convertCountersToATSMap(event.getTezCounters())); return atsEntity; }
Example 16
Source File: SystemMetricsPublisher.java From hadoop with Apache License 2.0 | 5 votes |
private static TimelineEntity createContainerEntity( ContainerId containerId) { TimelineEntity entity = new TimelineEntity(); entity.setEntityType( ContainerMetricsConstants.ENTITY_TYPE); entity.setEntityId(containerId.toString()); entity.addPrimaryFilter(ContainerMetricsConstants.PARENT_PRIMARIY_FILTER, containerId.getApplicationAttemptId().toString()); return entity; }
Example 17
Source File: JstormMaster.java From jstorm with Apache License 2.0 | 5 votes |
private static void publishContainerStartEvent( final TimelineClient timelineClient, Container container, String domainId, UserGroupInformation ugi) { final TimelineEntity entity = new TimelineEntity(); entity.setEntityId(container.getId().toString()); entity.setEntityType(DSEntity.DS_CONTAINER.toString()); entity.setDomainId(domainId); entity.addPrimaryFilter(JOYConstants.USER, ugi.getShortUserName()); TimelineEvent event = new TimelineEvent(); event.setTimestamp(System.currentTimeMillis()); event.setEventType(DSEvent.DS_CONTAINER_START.toString()); event.addEventInfo(JOYConstants.NODE, container.getNodeId().toString()); event.addEventInfo(JOYConstants.RESOURCES, container.getResource().toString()); entity.addEvent(event); try { ugi.doAs(new PrivilegedExceptionAction<TimelinePutResponse>() { @Override public TimelinePutResponse run() throws Exception { return timelineClient.putEntities(entity); } }); } catch (Exception e) { LOG.error("Container start event could not be published for " + container.getId().toString(), e instanceof UndeclaredThrowableException ? e.getCause() : e); } }
Example 18
Source File: HistoryEventTimelineConversion.java From tez with Apache License 2.0 | 5 votes |
private static TimelineEntity convertVertexReconfigureDoneEvent( VertexConfigurationDoneEvent event) { TimelineEntity atsEntity = new TimelineEntity(); atsEntity.setEntityId(event.getVertexID().toString()); atsEntity.setEntityType(EntityTypes.TEZ_VERTEX_ID.name()); atsEntity.addPrimaryFilter(ATSConstants.APPLICATION_ID, event.getVertexID().getDAGId().getApplicationId().toString()); atsEntity.addPrimaryFilter(EntityTypes.TEZ_DAG_ID.name(), event.getVertexID().getDAGId().toString()); TimelineEvent updateEvt = new TimelineEvent(); updateEvt.setEventType(HistoryEventType.VERTEX_CONFIGURE_DONE.name()); updateEvt.setTimestamp(event.getReconfigureDoneTime()); Map<String,Object> eventInfo = new HashMap<String, Object>(); if (event.getSourceEdgeProperties() != null && !event.getSourceEdgeProperties().isEmpty()) { Map<String, Object> updatedEdgeManagers = new HashMap<String, Object>(); for (Entry<String, EdgeProperty> entry : event.getSourceEdgeProperties().entrySet()) { updatedEdgeManagers.put(entry.getKey(), DAGUtils.convertEdgeProperty(entry.getValue())); } eventInfo.put(ATSConstants.UPDATED_EDGE_MANAGERS, updatedEdgeManagers); } eventInfo.put(ATSConstants.NUM_TASKS, event.getNumTasks()); updateEvt.setEventInfo(eventInfo); atsEntity.addEvent(updateEvt); atsEntity.addOtherInfo(ATSConstants.NUM_TASKS, event.getNumTasks()); return atsEntity; }
Example 19
Source File: HistoryEventTimelineConversion.java From tez with Apache License 2.0 | 4 votes |
private static TimelineEntity convertDAGSubmittedEvent(DAGSubmittedEvent event) { TimelineEntity atsEntity = new TimelineEntity(); atsEntity.setEntityId(event.getDagID().toString()); atsEntity.setEntityType(EntityTypes.TEZ_DAG_ID.name()); atsEntity.addRelatedEntity(EntityTypes.TEZ_APPLICATION.name(), "tez_" + event.getApplicationAttemptId().getApplicationId().toString()); atsEntity.addRelatedEntity(EntityTypes.TEZ_APPLICATION_ATTEMPT.name(), "tez_" + event.getApplicationAttemptId().toString()); TimelineEvent submitEvt = new TimelineEvent(); submitEvt.setEventType(HistoryEventType.DAG_SUBMITTED.name()); submitEvt.setTimestamp(event.getSubmitTime()); atsEntity.addEvent(submitEvt); atsEntity.setStartTime(event.getSubmitTime()); atsEntity.addPrimaryFilter(ATSConstants.USER, event.getUser()); atsEntity.addPrimaryFilter(ATSConstants.DAG_NAME, event.getDAGName()); atsEntity.addPrimaryFilter(ATSConstants.APPLICATION_ID, event.getDagID().getApplicationId().toString()); if (event.getDAGPlan().hasCallerContext() && event.getDAGPlan().getCallerContext().hasCallerId()) { CallerContextProto callerContext = event.getDagPlan().getCallerContext(); atsEntity.addPrimaryFilter(ATSConstants.CALLER_CONTEXT_ID, callerContext.getCallerId()); atsEntity.addOtherInfo(ATSConstants.CALLER_CONTEXT_ID, callerContext.getCallerId()); atsEntity.addOtherInfo(ATSConstants.CALLER_CONTEXT, callerContext.getContext()); } if (event.getQueueName() != null) { atsEntity.addPrimaryFilter(ATSConstants.DAG_QUEUE_NAME, event.getQueueName()); } atsEntity.addOtherInfo(ATSConstants.APPLICATION_ID, event.getApplicationAttemptId().getApplicationId().toString()); atsEntity.addOtherInfo(ATSConstants.APPLICATION_ATTEMPT_ID, event.getApplicationAttemptId().toString()); atsEntity.addOtherInfo(ATSConstants.USER, event.getUser()); atsEntity.addOtherInfo(ATSConstants.DAG_AM_WEB_SERVICE_VERSION, AMWebController.VERSION); atsEntity.addOtherInfo(ATSConstants.IN_PROGRESS_LOGS_URL + "_" + event.getApplicationAttemptId().getAttemptId(), event.getContainerLogs()); if (event.getDAGPlan().hasCallerContext() && event.getDAGPlan().getCallerContext().hasCallerId() && event.getDAGPlan().getCallerContext().hasCallerType()) { atsEntity.addOtherInfo(ATSConstants.CALLER_CONTEXT_ID, event.getDAGPlan().getCallerContext().getCallerId()); atsEntity.addOtherInfo(ATSConstants.CALLER_CONTEXT_TYPE, event.getDAGPlan().getCallerContext().getCallerType()); } if (event.getQueueName() != null) { atsEntity.addOtherInfo(ATSConstants.DAG_QUEUE_NAME, event.getQueueName()); } return atsEntity; }
Example 20
Source File: TestTimelineACLsManager.java From big-c with Apache License 2.0 | 4 votes |
@Test public void testYarnACLsEnabledForEntity() throws Exception { Configuration conf = new YarnConfiguration(); conf.setBoolean(YarnConfiguration.YARN_ACL_ENABLE, true); conf.set(YarnConfiguration.YARN_ADMIN_ACL, "admin"); TimelineACLsManager timelineACLsManager = new TimelineACLsManager(conf); timelineACLsManager.setTimelineStore(new TestTimelineStore()); TimelineEntity entity = new TimelineEntity(); entity.addPrimaryFilter( TimelineStore.SystemFilter.ENTITY_OWNER .toString(), "owner"); entity.setDomainId("domain_id_1"); Assert.assertTrue( "Owner should be allowed to view", timelineACLsManager.checkAccess( UserGroupInformation.createRemoteUser("owner"), ApplicationAccessType.VIEW_APP, entity)); Assert.assertTrue( "Reader should be allowed to view", timelineACLsManager.checkAccess( UserGroupInformation.createRemoteUser("reader"), ApplicationAccessType.VIEW_APP, entity)); Assert.assertFalse( "Other shouldn't be allowed to view", timelineACLsManager.checkAccess( UserGroupInformation.createRemoteUser("other"), ApplicationAccessType.VIEW_APP, entity)); Assert.assertTrue( "Admin should be allowed to view", timelineACLsManager.checkAccess( UserGroupInformation.createRemoteUser("admin"), ApplicationAccessType.VIEW_APP, entity)); Assert.assertTrue( "Owner should be allowed to modify", timelineACLsManager.checkAccess( UserGroupInformation.createRemoteUser("owner"), ApplicationAccessType.MODIFY_APP, entity)); Assert.assertTrue( "Writer should be allowed to modify", timelineACLsManager.checkAccess( UserGroupInformation.createRemoteUser("writer"), ApplicationAccessType.MODIFY_APP, entity)); Assert.assertFalse( "Other shouldn't be allowed to modify", timelineACLsManager.checkAccess( UserGroupInformation.createRemoteUser("other"), ApplicationAccessType.MODIFY_APP, entity)); Assert.assertTrue( "Admin should be allowed to modify", timelineACLsManager.checkAccess( UserGroupInformation.createRemoteUser("admin"), ApplicationAccessType.MODIFY_APP, entity)); }