You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by vr...@apache.org on 2019/03/07 05:47:37 UTC
[hadoop] branch trunk updated: YARN-8218 Add application launch
time to ATSV1. Contributed by Abhishek Modi
This is an automated email from the ASF dual-hosted git repository.
vrushali pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/hadoop.git
The following commit(s) were added to refs/heads/trunk by this push:
new 491313a YARN-8218 Add application launch time to ATSV1. Contributed by Abhishek Modi
491313a is described below
commit 491313ab84cc76683d0ef93a1ac17d8ecc8c430c
Author: Vrushali C <vr...@apache.org>
AuthorDate: Wed Mar 6 21:47:29 2019 -0800
YARN-8218 Add application launch time to ATSV1. Contributed by Abhishek Modi
---
.../ApplicationHistoryManagerOnTimelineStore.java | 7 ++++++-
.../resourcemanager/metrics/TimelineServiceV1Publisher.java | 13 +++++++++++++
.../resourcemanager/metrics/TestSystemMetricsPublisher.java | 10 +++++++++-
3 files changed, 28 insertions(+), 2 deletions(-)
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/ApplicationHistoryManagerOnTimelineStore.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/ApplicationHistoryManagerOnTimelineStore.java
index 62d8769..cc277ed 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/ApplicationHistoryManagerOnTimelineStore.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/ApplicationHistoryManagerOnTimelineStore.java
@@ -250,6 +250,7 @@ public class ApplicationHistoryManagerOnTimelineStore extends AbstractService
String type = null;
boolean unmanagedApplication = false;
long createdTime = 0;
+ long launchTime = 0;
long submittedTime = 0;
long finishedTime = 0;
float progress = 0.0f;
@@ -379,6 +380,9 @@ public class ApplicationHistoryManagerOnTimelineStore extends AbstractService
ApplicationMetricsConstants.CREATED_EVENT_TYPE)) {
createdTime = event.getTimestamp();
} else if (event.getEventType().equals(
+ ApplicationMetricsConstants.LAUNCHED_EVENT_TYPE)) {
+ launchTime = event.getTimestamp();
+ } else if (event.getEventType().equals(
ApplicationMetricsConstants.UPDATED_EVENT_TYPE)) {
// This type of events are parsed in time-stamp descending order
// which means the previous event could override the information
@@ -454,7 +458,8 @@ public class ApplicationHistoryManagerOnTimelineStore extends AbstractService
return new ApplicationReportExt(ApplicationReport.newInstance(
ApplicationId.fromString(entity.getEntityId()),
latestApplicationAttemptId, user, queue, name, null, -1, null, state,
- diagnosticsInfo, null, createdTime, submittedTime, 0, finishedTime,
+ diagnosticsInfo, null, createdTime,
+ submittedTime, launchTime, finishedTime,
finalStatus, appResources, null, progress, type, null, appTags,
unmanagedApplication, Priority.newInstance(applicationPriority),
appNodeLabelExpression, amNodeLabelExpression), appViewACLs);
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/metrics/TimelineServiceV1Publisher.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/metrics/TimelineServiceV1Publisher.java
index 7ad826f..5a5fa11 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/metrics/TimelineServiceV1Publisher.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/metrics/TimelineServiceV1Publisher.java
@@ -122,6 +122,19 @@ public class TimelineServiceV1Publisher extends AbstractSystemMetricsPublisher {
}
@Override
+ public void appLaunched(RMApp app, long launchTime) {
+ TimelineEntity entity = createApplicationEntity(app.getApplicationId());
+
+ TimelineEvent tEvent = new TimelineEvent();
+ tEvent.setEventType(ApplicationMetricsConstants.LAUNCHED_EVENT_TYPE);
+ tEvent.setTimestamp(launchTime);
+ entity.addEvent(tEvent);
+
+ getDispatcher().getEventHandler().handle(new TimelineV1PublishEvent(
+ SystemMetricsEventType.PUBLISH_ENTITY, entity, app.getApplicationId()));
+ }
+
+ @Override
public void appFinished(RMApp app, RMAppState state, long finishedTime) {
TimelineEntity entity = createApplicationEntity(app.getApplicationId());
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/metrics/TestSystemMetricsPublisher.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/metrics/TestSystemMetricsPublisher.java
index f2d82e9..64c9063 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/metrics/TestSystemMetricsPublisher.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/metrics/TestSystemMetricsPublisher.java
@@ -115,6 +115,7 @@ public class TestSystemMetricsPublisher {
ApplicationId appId = ApplicationId.newInstance(0, i);
RMApp app = createRMApp(appId);
metricsPublisher.appCreated(app, app.getStartTime());
+ metricsPublisher.appLaunched(app, app.getLaunchTime());
if (i == 1) {
when(app.getQueue()).thenReturn("new test queue");
ApplicationSubmissionContext asc = mock(
@@ -150,7 +151,7 @@ public class TestSystemMetricsPublisher {
ApplicationMetricsConstants.ENTITY_TYPE,
EnumSet.allOf(Field.class));
// ensure Five events are both published before leaving the loop
- } while (entity == null || entity.getEvents().size() < 5);
+ } while (entity == null || entity.getEvents().size() < 6);
// verify all the fields
Assert.assertEquals(ApplicationMetricsConstants.ENTITY_TYPE,
entity.getEntityType());
@@ -240,6 +241,7 @@ public class TestSystemMetricsPublisher {
Assert.assertEquals("context", entity.getOtherInfo()
.get(ApplicationMetricsConstants.YARN_APP_CALLER_CONTEXT));
boolean hasCreatedEvent = false;
+ boolean hasLaunchedEvent = false;
boolean hasUpdatedEvent = false;
boolean hasFinishedEvent = false;
boolean hasACLsUpdatedEvent = false;
@@ -250,6 +252,10 @@ public class TestSystemMetricsPublisher {
hasCreatedEvent = true;
Assert.assertEquals(app.getStartTime(), event.getTimestamp());
} else if (event.getEventType().equals(
+ ApplicationMetricsConstants.LAUNCHED_EVENT_TYPE)) {
+ hasLaunchedEvent = true;
+ Assert.assertEquals(app.getLaunchTime(), event.getTimestamp());
+ } else if (event.getEventType().equals(
ApplicationMetricsConstants.FINISHED_EVENT_TYPE)) {
hasFinishedEvent = true;
Assert.assertEquals(app.getFinishTime(), event.getTimestamp());
@@ -292,6 +298,7 @@ public class TestSystemMetricsPublisher {
}
// Do assertTrue verification separately for easier debug
Assert.assertTrue(hasCreatedEvent);
+ Assert.assertTrue(hasLaunchedEvent);
Assert.assertTrue(hasFinishedEvent);
Assert.assertTrue(hasACLsUpdatedEvent);
Assert.assertTrue(hasUpdatedEvent);
@@ -499,6 +506,7 @@ public class TestSystemMetricsPublisher {
when(app.getQueue()).thenReturn("test queue");
when(app.getSubmitTime()).thenReturn(Integer.MAX_VALUE + 1L);
when(app.getStartTime()).thenReturn(Integer.MAX_VALUE + 2L);
+ when(app.getLaunchTime()).thenReturn(Integer.MAX_VALUE + 2L);
when(app.getFinishTime()).thenReturn(Integer.MAX_VALUE + 3L);
when(app.getDiagnostics()).thenReturn(
new StringBuilder("test diagnostics info"));
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org