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 sh...@apache.org on 2018/05/02 19:22:15 UTC
[40/50] [abbrv] hadoop git commit: YARN-8215. ATS v2 returns invalid
YARN_CONTAINER_ALLOCATED_HOST_HTTP_ADDRESS from NM. Contributed by Rohith
Sharma K S.
YARN-8215. ATS v2 returns invalid YARN_CONTAINER_ALLOCATED_HOST_HTTP_ADDRESS from NM. Contributed by Rohith Sharma K S.
(cherry picked from commit 7fc09c4f7255645025ddf902dff70a17092ea039)
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/a91d5c7e
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/a91d5c7e
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/a91d5c7e
Branch: refs/heads/YARN-8200
Commit: a91d5c7e2c044391dc97a555c8d1269578f48410
Parents: ab2b429
Author: Sunil G <su...@apache.org>
Authored: Fri Apr 27 10:33:42 2018 +0530
Committer: Rohith Sharma K S <ro...@apache.org>
Committed: Fri Apr 27 11:19:12 2018 +0530
----------------------------------------------------------------------
.../timelineservice/NMTimelinePublisher.java | 15 ++++++++++-----
.../timelineservice/TestNMTimelinePublisher.java | 1 -
2 files changed, 10 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hadoop/blob/a91d5c7e/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/timelineservice/NMTimelinePublisher.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/timelineservice/NMTimelinePublisher.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/timelineservice/NMTimelinePublisher.java
index 52895c4..94b7025 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/timelineservice/NMTimelinePublisher.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/timelineservice/NMTimelinePublisher.java
@@ -24,6 +24,8 @@ import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
+import org.apache.hadoop.yarn.webapp.util.WebAppUtils;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.conf.Configuration;
@@ -79,6 +81,7 @@ public class NMTimelinePublisher extends CompositeService {
private NodeId nodeId;
private String httpAddress;
+ private String httpPort;
private UserGroupInformation nmLoginUGI;
@@ -100,6 +103,12 @@ public class NMTimelinePublisher extends CompositeService {
UserGroupInformation.getLoginUser() :
UserGroupInformation.getCurrentUser();
LOG.info("Initialized NMTimelinePublisher UGI to " + nmLoginUGI);
+
+ String webAppURLWithoutScheme =
+ WebAppUtils.getNMWebAppURLWithoutScheme(conf);
+ if (webAppURLWithoutScheme.contains(":")) {
+ httpPort = webAppURLWithoutScheme.split(":")[1];
+ }
super.serviceInit(conf);
}
@@ -109,6 +118,7 @@ public class NMTimelinePublisher extends CompositeService {
// context will be updated after containerManagerImpl is started
// hence NMMetricsPublisher is added subservice of containerManagerImpl
this.nodeId = context.getNodeId();
+ this.httpAddress = nodeId.getHost() + ":" + httpPort;
}
@Override
@@ -330,11 +340,6 @@ public class NMTimelinePublisher extends CompositeService {
public void publishContainerEvent(ContainerEvent event) {
// publish only when the desired event is received
- if (this.httpAddress == null) {
- // update httpAddress for first time. When this service started,
- // web server will not be started.
- this.httpAddress = nodeId.getHost() + ":" + context.getHttpPort();
- }
switch (event.getType()) {
case INIT_CONTAINER:
publishContainerCreatedEvent(event);
http://git-wip-us.apache.org/repos/asf/hadoop/blob/a91d5c7e/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/timelineservice/TestNMTimelinePublisher.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/timelineservice/TestNMTimelinePublisher.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/timelineservice/TestNMTimelinePublisher.java
index 50f9e8b..5e97158 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/timelineservice/TestNMTimelinePublisher.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/timelineservice/TestNMTimelinePublisher.java
@@ -59,7 +59,6 @@ public class TestNMTimelinePublisher {
@SuppressWarnings("unchecked")
final DummyTimelineClient timelineClient = new DummyTimelineClient(null);
when(context.getNodeId()).thenReturn(NodeId.newInstance("localhost", 0));
- when(context.getHttpPort()).thenReturn(0);
Configuration conf = new Configuration();
conf.setBoolean(YarnConfiguration.TIMELINE_SERVICE_ENABLED, true);
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org