YARN-5747. Application timeline metric aggregation in timeline v2 will lose last round aggregation when an application finishes (Li Lu via Varun Saxena)
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/44eb2bd7 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/44eb2bd7 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/44eb2bd7 Branch: refs/heads/YARN-3368 Commit: 44eb2bd7ae39cca77fc8c7ad493b52ea1bb43530 Parents: f63cd78 Author: Varun Saxena <varunsax...@apache.org> Authored: Sat Oct 22 01:14:49 2016 +0530 Committer: Varun Saxena <varunsax...@apache.org> Committed: Sat Oct 22 01:14:49 2016 +0530 ---------------------------------------------------------------------- .../collector/AppLevelTimelineCollector.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/44eb2bd7/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/collector/AppLevelTimelineCollector.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/collector/AppLevelTimelineCollector.java b/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 d276269..e62a436 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/collector/AppLevelTimelineCollector.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/collector/AppLevelTimelineCollector.java @@ -58,6 +58,7 @@ public class AppLevelTimelineCollector extends TimelineCollector { private final ApplicationId appId; private final TimelineCollectorContext context; private ScheduledThreadPoolExecutor appAggregationExecutor; + private AppLevelAggregator appAggregator; public AppLevelTimelineCollector(ApplicationId appId) { super(AppLevelTimelineCollector.class.getName() + " - " + appId.toString()); @@ -94,7 +95,8 @@ public class AppLevelTimelineCollector extends TimelineCollector { new ThreadFactoryBuilder() .setNameFormat("TimelineCollector Aggregation thread #%d") .build()); - appAggregationExecutor.scheduleAtFixedRate(new AppLevelAggregator(), + appAggregator = new AppLevelAggregator(); + appAggregationExecutor.scheduleAtFixedRate(appAggregator, AppLevelTimelineCollector.AGGREGATION_EXECUTOR_EXEC_INTERVAL_SECS, AppLevelTimelineCollector.AGGREGATION_EXECUTOR_EXEC_INTERVAL_SECS, TimeUnit.SECONDS); @@ -108,6 +110,8 @@ public class AppLevelTimelineCollector extends TimelineCollector { LOG.info("App-level aggregator shutdown timed out, shutdown now. "); appAggregationExecutor.shutdownNow(); } + // Perform one round of aggregation after the aggregation executor is done. + appAggregator.aggregate(); super.serviceStop(); } @@ -123,8 +127,7 @@ public class AppLevelTimelineCollector extends TimelineCollector { private class AppLevelAggregator implements Runnable { - @Override - public void run() { + private void aggregate() { if (LOG.isDebugEnabled()) { LOG.debug("App-level real-time aggregating"); } @@ -156,6 +159,11 @@ public class AppLevelTimelineCollector extends TimelineCollector { LOG.debug("App-level real-time aggregation complete"); } } + + @Override + public void run() { + aggregate(); + } } } --------------------------------------------------------------------- To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-commits-h...@hadoop.apache.org