From eed9e3e8f4724ca42e0140754b8fe598b6472747 Mon Sep 17 00:00:00 2001 From: Jian He Date: Mon, 4 Sep 2017 22:07:24 -0700 Subject: [PATCH] Rebase onto trunk - fix some issues. Contributed by Rohith Sharma K S --- .../hadoop-yarn-services-api/pom.xml | 2 +- .../hadoop-yarn-services-core/pom.xml | 2 +- .../ServiceTimelinePublisher.java | 32 +++++++++++-------- .../TestServiceTimelinePublisher.java | 2 -- .../hadoop-yarn-services/pom.xml | 2 +- .../main/webapp/app/routes/yarn-services.js | 2 +- 6 files changed, 23 insertions(+), 19 deletions(-) diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/pom.xml b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/pom.xml index 1077ccda82..74d9681bee 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/pom.xml +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/pom.xml @@ -19,7 +19,7 @@ org.apache.hadoop hadoop-yarn-applications - 3.0.0-beta1-SNAPSHOT + 3.1.0-SNAPSHOT hadoop-yarn-services-api Apache Hadoop YARN Services API diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/pom.xml b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/pom.xml index d9b7adb753..fb07edc908 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/pom.xml +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/pom.xml @@ -19,7 +19,7 @@ org.apache.hadoop hadoop-yarn-services - 3.0.0-beta1-SNAPSHOT + 3.1.0-SNAPSHOT hadoop-yarn-services-core jar diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/timelineservice/ServiceTimelinePublisher.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/timelineservice/ServiceTimelinePublisher.java index 5e65ad9842..9e7d8e8f32 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/timelineservice/ServiceTimelinePublisher.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/timelineservice/ServiceTimelinePublisher.java @@ -66,6 +66,7 @@ public class ServiceTimelinePublisher extends CompositeService { protected void serviceInit(org.apache.hadoop.conf.Configuration configuration) throws Exception { addService(timelineClient); + super.serviceInit(configuration); } @@ -95,8 +96,8 @@ public void serviceAttemptRegistered(Service service, // create info keys Map entityInfos = new HashMap(); entityInfos.put(ServiceTimelineMetricsConstants.NAME, service.getName()); - entityInfos.put(ServiceTimelineMetricsConstants.STATE, - service.getState().toString()); +// entityInfos.put(ServiceTimelineMetricsConstants.STATE, +// service.getState().toString()); entityInfos.put(ServiceTimelineMetricsConstants.LAUNCH_TIME, currentTimeMillis); entity.addInfo(ServiceTimelineMetricsConstants.QUICK_LINKS, @@ -232,18 +233,23 @@ private void publishComponents(List components) { // create info keys Map entityInfos = new HashMap(); - entityInfos.put(ServiceTimelineMetricsConstants.ARTIFACT_ID, - component.getArtifact().getId()); - entityInfos.put(ServiceTimelineMetricsConstants.ARTIFACT_TYPE, - component.getArtifact().getType().toString()); - if (component.getResource().getProfile() != null) { - entityInfos.put(ServiceTimelineMetricsConstants.RESOURCE_PROFILE, - component.getResource().getProfile()); + if (component.getArtifact() != null) { + entityInfos.put(ServiceTimelineMetricsConstants.ARTIFACT_ID, + component.getArtifact().getId()); + entityInfos.put(ServiceTimelineMetricsConstants.ARTIFACT_TYPE, + component.getArtifact().getType().toString()); + } + + if (component.getResource() != null) { + entityInfos.put(ServiceTimelineMetricsConstants.RESOURCE_CPU, + component.getResource().getCpus()); + entityInfos.put(ServiceTimelineMetricsConstants.RESOURCE_MEMORY, + component.getResource().getMemory()); + if (component.getResource().getProfile() != null) { + entityInfos.put(ServiceTimelineMetricsConstants.RESOURCE_PROFILE, + component.getResource().getProfile()); + } } - entityInfos.put(ServiceTimelineMetricsConstants.RESOURCE_CPU, - component.getResource().getCpus()); - entityInfos.put(ServiceTimelineMetricsConstants.RESOURCE_MEMORY, - component.getResource().getMemory()); if (component.getLaunchCommand() != null) { entityInfos.put(ServiceTimelineMetricsConstants.LAUNCH_COMMAND, diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/test/java/org/apache/hadoop/yarn/service/timelineservice/TestServiceTimelinePublisher.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/test/java/org/apache/hadoop/yarn/service/timelineservice/TestServiceTimelinePublisher.java index b742553a5a..e7c76000c5 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/test/java/org/apache/hadoop/yarn/service/timelineservice/TestServiceTimelinePublisher.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/test/java/org/apache/hadoop/yarn/service/timelineservice/TestServiceTimelinePublisher.java @@ -82,9 +82,7 @@ public void setUp() throws Exception { timelineClient = new DummyTimelineClient(ApplicationId.fromString(SERVICEID)); serviceTimelinePublisher = new ServiceTimelinePublisher(timelineClient); - timelineClient.init(config); serviceTimelinePublisher.init(config); - timelineClient.start(); serviceTimelinePublisher.start(); } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/pom.xml b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/pom.xml index 1233804709..716fdb70cf 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/pom.xml +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/pom.xml @@ -19,7 +19,7 @@ hadoop-yarn-applications org.apache.hadoop - 3.0.0-beta1-SNAPSHOT + 3.1.0-SNAPSHOT 4.0.0 hadoop-yarn-services diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-services.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-services.js index 0f74f2f3af..a6535aec1e 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-services.js +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-services.js @@ -23,7 +23,7 @@ export default AbstractRoute.extend({ model() { return Ember.RSVP.hash({ apps: this.store.query('yarn-app', { - applicationTypes: "yarn-native-service" + applicationTypes: "yarn-service" }), }); },