From 4aca4ff759f773135f8a27dbaa9731196fac5233 Mon Sep 17 00:00:00 2001 From: Haibo Chen Date: Fri, 19 Jan 2018 10:27:02 -0800 Subject: [PATCH] YARN-5094. some YARN container events have timestamp of -1. --- .../containermanager/application/ApplicationEvent.java | 2 +- .../containermanager/container/ContainerEvent.java | 2 +- .../containermanager/localizer/event/LocalizationEvent.java | 2 +- .../containermanager/application/TestApplication.java | 6 ++++-- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/application/ApplicationEvent.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/application/ApplicationEvent.java index a52fd72c8e..c14dc996df 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/application/ApplicationEvent.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/application/ApplicationEvent.java @@ -27,7 +27,7 @@ public class ApplicationEvent extends AbstractEvent { public ApplicationEvent(ApplicationId appID, ApplicationEventType appEventType) { - super(appEventType); + super(appEventType, System.currentTimeMillis()); this.applicationID = appID; } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/container/ContainerEvent.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/container/ContainerEvent.java index 46ec2704a3..cfb9c177e5 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/container/ContainerEvent.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/container/ContainerEvent.java @@ -27,7 +27,7 @@ public class ContainerEvent extends AbstractEvent { private final ContainerId containerID; public ContainerEvent(ContainerId cID, ContainerEventType eventType) { - super(eventType); + super(eventType, System.currentTimeMillis()); this.containerID = cID; } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/localizer/event/LocalizationEvent.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/localizer/event/LocalizationEvent.java index 417935e823..549c960975 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/localizer/event/LocalizationEvent.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/localizer/event/LocalizationEvent.java @@ -27,7 +27,7 @@ public class LocalizationEvent extends AbstractEvent { public LocalizationEvent(LocalizationEventType event) { - super(event); + super(event, System.currentTimeMillis()); } } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/application/TestApplication.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/application/TestApplication.java index 65558e937c..c8f28e2ff1 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/application/TestApplication.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/application/TestApplication.java @@ -262,7 +262,8 @@ public void testAppFinishedOnRunningContainers() { verify(wa.localizerBus).handle( refEq(new ApplicationLocalizationEvent( - LocalizationEventType.DESTROY_APPLICATION_RESOURCES, wa.app))); + LocalizationEventType.DESTROY_APPLICATION_RESOURCES, + wa.app), "timestamp")); verify(wa.auxBus).handle( refEq(new AuxServicesEvent( @@ -341,7 +342,8 @@ public void testAppFinishedOnCompletedContainers() { verify(wa.localizerBus).handle( refEq(new ApplicationLocalizationEvent( - LocalizationEventType.DESTROY_APPLICATION_RESOURCES, wa.app))); + LocalizationEventType.DESTROY_APPLICATION_RESOURCES, wa.app), + "timestamp")); wa.appResourcesCleanedup(); for ( Container container : wa.containers) {