ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pallav...@apache.org
Subject ambari git commit: AMBARI-16772. Zeppelin restart with Ambari fails - according to Ambari (Renjith Kamath via pallavkul)
Date Wed, 25 May 2016 10:52:46 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.4 7e26652ba -> 89f6994c3


AMBARI-16772. Zeppelin restart with Ambari fails - according to Ambari (Renjith Kamath via
pallavkul)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/89f6994c
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/89f6994c
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/89f6994c

Branch: refs/heads/branch-2.4
Commit: 89f6994c3ae1b960895a6be4fd890e54cd66f977
Parents: 7e26652
Author: Pallav Kulshreshtha <pallav.kul@gmail.com>
Authored: Wed May 25 16:21:11 2016 +0530
Committer: Pallav Kulshreshtha <pallav.kul@gmail.com>
Committed: Wed May 25 16:22:24 2016 +0530

----------------------------------------------------------------------
 .../0.6.0.2.5/package/scripts/master.py         | 65 +++++++-------------
 1 file changed, 23 insertions(+), 42 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/89f6994c/ambari-server/src/main/resources/common-services/ZEPPELIN/0.6.0.2.5/package/scripts/master.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/ZEPPELIN/0.6.0.2.5/package/scripts/master.py
b/ambari-server/src/main/resources/common-services/ZEPPELIN/0.6.0.2.5/package/scripts/master.py
index 21b9947..7d365ec 100644
--- a/ambari-server/src/main/resources/common-services/ZEPPELIN/0.6.0.2.5/package/scripts/master.py
+++ b/ambari-server/src/main/resources/common-services/ZEPPELIN/0.6.0.2.5/package/scripts/master.py
@@ -190,48 +190,29 @@ class Master(Script):
 
   def update_zeppelin_interpreter(self):
     import params
-    import json, urllib2
-    zeppelin_int_url = 'http://' + params.zeppelin_host + ':' + str(
-      params.zeppelin_port) + '/api/interpreter/setting/'
-
-    # fetch current interpreter settings for spark, hive, phoenix
-    data = json.load(urllib2.urlopen(zeppelin_int_url))
-    print data
-    for body in data['body']:
-      if body['group'] == 'spark':
-        sparkbody = body
-      elif body['group'] == 'hive':
-        hivebody = body
-      elif body['group'] == 'phoenix':
-        phoenixbody = body
-
-    # if hive installed, update hive settings and post to hive interpreter
-    if (params.hive_server_host):
-      hivebody['properties']['hive.hiveserver2.url'] = 'jdbc:hive2://' \
-                                                       + params.hive_server_host \
-                                                       + ':' + params.hive_server_port
-      self.post_request(zeppelin_int_url + hivebody['id'], hivebody)
-
-    # if hbase installed, update hbase settings and post to phoenix interpreter
-    if (params.zookeeper_znode_parent and params.hbase_zookeeper_quorum):
-      phoenixbody['properties'][
-        'phoenix.jdbc.url'] = "jdbc:phoenix:" + params.hbase_zookeeper_quorum + ':' \
-                              + params.zookeeper_znode_parent
-      self.post_request(zeppelin_int_url + phoenixbody['id'], phoenixbody)
-
-  def post_request(self, url, body):
-    import json, urllib2
-    encoded_body = json.dumps(body)
-    req = urllib2.Request(str(url), encoded_body)
-    req.get_method = lambda: 'PUT'
-    try:
-      response = urllib2.urlopen(req, encoded_body).read()
-    except urllib2.HTTPError, error:
-      print 'Exception: ' + error.read()
-
-    jsonresp = json.loads(response.decode('utf-8'))
-    print jsonresp['status']
-
+    import json
+
+    interpreter_config = params.conf_dir + "/interpreter.json"
+    interpreter_config_file = open(interpreter_config, "r")
+    config_data = json.load(interpreter_config_file)
+    interpreter_config_file.close()
+    interpreter_settings = config_data['interpreterSettings']
+
+    for notebooks in interpreter_settings:
+        notebook = interpreter_settings[notebooks]
+        if notebook['group'] == 'hive' and params.hive_server_host:
+            notebook['properties']['hive.hiveserver2.url'] = 'jdbc:hive2://' +\
+                                                             params.hive_server_host +\
+                                                             ':' + params.hive_server_port
+        elif notebook['group'] == 'phoenix' and params.zookeeper_znode_parent \
+                and params.hbase_zookeeper_quorum:
+            notebook['properties']['phoenix.jdbc.url'] = "jdbc:phoenix:" +\
+                                                         params.hbase_zookeeper_quorum +
':' +\
+                                                         params.zookeeper_znode_parent
+
+    interpreter_config_file = open(interpreter_config, "w+")
+    interpreter_config_file.write(json.dumps(config_data, indent=2))
+    interpreter_config_file.close()
 
 if __name__ == "__main__":
   Master().execute()


Mime
View raw message