You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@slider.apache.org by sm...@apache.org on 2014/10/12 02:58:38 UTC

[50/50] git commit: SLIDER-478 agent ZK bindings to move to YARN registry

SLIDER-478 agent ZK bindings to move to YARN registry


Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/eba79a4d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/eba79a4d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/eba79a4d

Branch: refs/heads/feature/SLIDER-481_allow_dedicated_handling_of_exports
Commit: eba79a4de4adaeee087cb1012ee05bf7ce3b87fb
Parents: 6f0d9cb
Author: Gour Saha <go...@apache.org>
Authored: Fri Oct 10 18:39:23 2014 -0700
Committer: Gour Saha <go...@apache.org>
Committed: Fri Oct 10 18:41:02 2014 -0700

----------------------------------------------------------------------
 slider-agent/src/main/python/agent/Registry.py | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/eba79a4d/slider-agent/src/main/python/agent/Registry.py
----------------------------------------------------------------------
diff --git a/slider-agent/src/main/python/agent/Registry.py b/slider-agent/src/main/python/agent/Registry.py
index 453be10..ad84053 100644
--- a/slider-agent/src/main/python/agent/Registry.py
+++ b/slider-agent/src/main/python/agent/Registry.py
@@ -39,16 +39,21 @@ class Registry:
       zk = KazooClient(hosts=self.zk_quorum, read_only=True)
       zk.start()
       data, stat = zk.get(self.zk_reg_path)
+      data = data.lstrip("jsonservicerec")
       logger.debug("Registry Data: %s" % (data.decode("utf-8")))
       sliderRegistry = json.loads(data)
-      amUrl = sliderRegistry["payload"]["internalView"]["endpoints"]["org.apache.slider.agents.secure"]["address"]
-      amHost = amUrl.split("/")[2].split(":")[0]
-      amSecuredPort = amUrl.split(":")[2].split("/")[0]
+      internalAttr = sliderRegistry["internal"]
+      for internal in internalAttr:
+        if internal["api"] == "org.apache.slider.agents.secure":
+          amUrl = internal["addresses"][0][0]
+          amHost = amUrl.split("/")[2].split(":")[0]
+          amSecuredPort = amUrl.split(":")[2].split("/")[0]
+        if internal["api"] == "org.apache.slider.agents.oneway":
+          amUnsecureUrl = internal["addresses"][0][0]
+          amHost = amUnsecureUrl.split("/")[2].split(":")[0]
+          amUnsecuredPort = amUnsecureUrl.split(":")[2].split("/")[0]
 
-      amUnsecureUrl = sliderRegistry["payload"]["internalView"]["endpoints"]["org.apache.slider.agents.oneway"]["address"]
-      amUnsecuredPort = amUnsecureUrl.split(":")[2].split("/")[0]
-
-      # the port needs to be utf-8 encoded
+      # the ports needs to be utf-8 encoded
       amSecuredPort = amSecuredPort.encode('utf8', 'ignore')
       amUnsecuredPort = amUnsecuredPort.encode('utf8', 'ignore')
     except Exception, e: