diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/collector/AppLevelTimelineCollector.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/collector/AppLevelTimelineCollector.java index e62a436..0b05309 100644 --- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/collector/AppLevelTimelineCollector.java +++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/collector/AppLevelTimelineCollector.java @@ -59,6 +59,7 @@ private final TimelineCollectorContext context; private ScheduledThreadPoolExecutor appAggregationExecutor; private AppLevelAggregator appAggregator; + private UserGroupInformation currentUser; public AppLevelTimelineCollector(ApplicationId appId) { super(AppLevelTimelineCollector.class.getName() + " - " + appId.toString()); @@ -82,7 +83,8 @@ protected void serviceInit(Configuration conf) throws Exception { // Set the default values, which will be updated with an RPC call to get the // context info from NM. // Current user usually is not the app user, but keep this field non-null - context.setUserId(UserGroupInformation.getCurrentUser().getShortUserName()); + currentUser = UserGroupInformation.getCurrentUser(); + context.setUserId(currentUser.getShortUserName()); context.setAppId(appId.toString()); super.serviceInit(conf); } @@ -149,9 +151,7 @@ private void aggregate() { TimelineEntityType.YARN_APPLICATION.toString()); TimelineEntities entities = new TimelineEntities(); entities.addEntity(resultEntity); - getWriter().write(currContext.getClusterId(), currContext.getUserId(), - currContext.getFlowName(), currContext.getFlowVersion(), - currContext.getFlowRunId(), currContext.getAppId(), entities); + putEntitiesAsync(entities, currentUser); } catch (Exception e) { LOG.error("Error aggregating timeline metrics", e); } diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/collector/TimelineCollector.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/collector/TimelineCollector.java index 4c9e9f8..c94c505 100644 --- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/collector/TimelineCollector.java +++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/collector/TimelineCollector.java @@ -85,10 +85,6 @@ protected void setWriter(TimelineWriter w) { this.writer = w; } - protected TimelineWriter getWriter() { - return writer; - } - protected Map getAggregationGroups() { return aggregationGroups; }