zeppelin-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From prabhjyotsi...@apache.org
Subject zeppelin git commit: ZEPPELIN-1130 Make Livy create session retries configurable
Date Tue, 12 Jul 2016 07:02:05 GMT
Repository: zeppelin
Updated Branches:
  refs/heads/master a2f998174 -> ffa7fa6e8


ZEPPELIN-1130 Make Livy create session retries configurable

### What is this PR for?
Make Livy create session retires configurable

### What type of PR is it?
Improvement

### What is the Jira issue?
https://issues.apache.org/jira/browse/ZEPPELIN-1130

### How should this be tested?
- Add/Edit `zeppelin.livy.create.session.retries` property in Livy interpreter settings
- Run a paragraph with `%livy sc.version`
- Verify the retries count in logs

### Questions:
* Does the licenses files need update? n/a
* Is there breaking changes for older versions? n/a
* Does this needs documentation? n/a

Author: Renjith Kamath <renjith.kamath@gmail.com>

Closes #1147 from r-kamath/ZEPPELIN-1130 and squashes the following commits:

525a1a2 [Renjith Kamath] ZEPPELIN-1130 update log message
19e556e [Renjith Kamath] ZEPPELIN-1130 revert livy create session retry count to 60
6fb59e8 [Renjith Kamath] ZEPPELIN-1130 fix logging and message
0e29217 [Renjith Kamath] ZEPPELIN-1130 Make Livy create session retries configurable


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

Branch: refs/heads/master
Commit: ffa7fa6e83a65e3465ea28f610a5e027b475f714
Parents: a2f9981
Author: Renjith Kamath <renjith.kamath@gmail.com>
Authored: Sat Jul 9 11:54:43 2016 +0530
Committer: Prabhjyot Singh <prabhjyotsingh@gmail.com>
Committed: Tue Jul 12 12:31:57 2016 +0530

----------------------------------------------------------------------
 .../org/apache/zeppelin/livy/LivyHelper.java     | 19 +++++++++++++------
 livy/src/main/resources/interpreter-setting.json |  6 ++++++
 2 files changed, 19 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zeppelin/blob/ffa7fa6e/livy/src/main/java/org/apache/zeppelin/livy/LivyHelper.java
----------------------------------------------------------------------
diff --git a/livy/src/main/java/org/apache/zeppelin/livy/LivyHelper.java b/livy/src/main/java/org/apache/zeppelin/livy/LivyHelper.java
index ec77f1a..fb83003 100644
--- a/livy/src/main/java/org/apache/zeppelin/livy/LivyHelper.java
+++ b/livy/src/main/java/org/apache/zeppelin/livy/LivyHelper.java
@@ -48,7 +48,6 @@ public class LivyHelper {
   Gson gson = new GsonBuilder().setPrettyPrinting().create();
   HashMap<String, Object> paragraphHttpMap = new HashMap<>();
   Properties property;
-  Integer MAX_NOS_RETRY = 60;
 
   LivyHelper(Properties property) {
     this.property = property;
@@ -83,9 +82,17 @@ public class LivyHelper {
           }.getType());
       Integer sessionId = ((Double) jsonMap.get("id")).intValue();
       if (!jsonMap.get("state").equals("idle")) {
-        Integer nosRetry = MAX_NOS_RETRY;
+        Integer retryCount = 60;
 
-        while (nosRetry >= 0) {
+        try {
+          retryCount = Integer.valueOf(
+              property.getProperty("zeppelin.livy.create.session.retries"));
+        } catch (Exception e) {
+          LOGGER.info("zeppelin.livy.create.session.retries property is not configured."
+
+              " Using default retry count.");
+        }
+
+        while (retryCount >= 0) {
           LOGGER.error(String.format("sessionId:%s state is %s",
               jsonMap.get("id"), jsonMap.get("state")));
           Thread.sleep(1000);
@@ -108,10 +115,10 @@ public class LivyHelper {
             LOGGER.error(String.format("Cannot start  %s.\n%s", kind, logs));
             throw new Exception(String.format("Cannot start  %s.\n%s", kind, logs));
           }
-          nosRetry--;
+          retryCount--;
         }
-        if (nosRetry <= 0) {
-          LOGGER.error("Error getting session for user within 60Sec.");
+        if (retryCount <= 0) {
+          LOGGER.error("Error getting session for user within the configured number of retries.");
           throw new Exception(String.format("Cannot start  %s.", kind));
         }
       }

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/ffa7fa6e/livy/src/main/resources/interpreter-setting.json
----------------------------------------------------------------------
diff --git a/livy/src/main/resources/interpreter-setting.json b/livy/src/main/resources/interpreter-setting.json
index 468e9d9..2c1a0be 100644
--- a/livy/src/main/resources/interpreter-setting.json
+++ b/livy/src/main/resources/interpreter-setting.json
@@ -11,6 +11,12 @@
         "defaultValue": "http://localhost:8998",
         "description": "The URL for Livy Server."
       },
+      "zeppelin.livy.create.session.retries": {
+        "envName": "ZEPPELIN_LIVY_CREATE_SESSION_RETRIES",
+        "propertyName": "zeppelin.livy.create.session.retries",
+        "defaultValue": "120",
+        "description": "Livy Server create session retry count."
+      },
       "livy.spark.master": {
         "propertyName": "livy.spark.master",
         "defaultValue": "local[*]",


Mime
View raw message