zeppelin-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zjf...@apache.org
Subject zeppelin git commit: ZEPPELIN-3345. Don't load interpreter setting when it exist interpreter.json but no interpreter-setting.json found
Date Sat, 17 Mar 2018 13:30:45 GMT
Repository: zeppelin
Updated Branches:
  refs/heads/branch-0.8 b08bf5ebd -> cc2894c38


ZEPPELIN-3345. Don't load interpreter setting when it exist interpreter.json but no interpreter-setting.json
found

### What is this PR for?
It usually happens in dev enviroment. e.g. I have livy interpreter in interpreter.json due
to history testing but no livy folder under `{ZEPPELIN_HOME}/interpreter` after I rebuilt
the project without building livy module. This PR would just remove that invalid interpreter
setting when loading from interpreter.json

### What type of PR is it?
[Bug Fix]

### Todos
* [ ] - Task

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

### How should this be tested?
* CI pass

### Screenshots (if appropriate)

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

Author: Jeff Zhang <zjffdu@apache.org>

Closes #2877 from zjffdu/ZEPPELIN-3345 and squashes the following commits:

bf72ead [Jeff Zhang] ZEPPELIN-3345. Don't load interpreter setting when it exist interpreter.json
but no interpreter-setting.json found

(cherry picked from commit a63f041477737c67177de292c90109f4b8ce2b1c)
Signed-off-by: Jeff Zhang <zjffdu@apache.org>


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

Branch: refs/heads/branch-0.8
Commit: cc2894c38ed8eaf5c0fb9c1da04fedcc588fb564
Parents: b08bf5e
Author: Jeff Zhang <zjffdu@apache.org>
Authored: Sat Mar 17 11:34:14 2018 +0800
Committer: Jeff Zhang <zjffdu@apache.org>
Committed: Sat Mar 17 21:30:40 2018 +0800

----------------------------------------------------------------------
 .../interpreter/InterpreterSettingManager.java    | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zeppelin/blob/cc2894c3/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterSettingManager.java
----------------------------------------------------------------------
diff --git a/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterSettingManager.java
b/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterSettingManager.java
index 9587a88..23d086d 100644
--- a/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterSettingManager.java
+++ b/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterSettingManager.java
@@ -215,7 +215,9 @@ public class InterpreterSettingManager {
       List<String> oldSettingIdList = entry.getValue();
       List<String> newSettingIdList = new ArrayList<>();
       for (String oldId : oldSettingIdList) {
-        newSettingIdList.add(infoSaving.interpreterSettings.get(oldId).getName());
+        if (infoSaving.interpreterSettings.containsKey(oldId)) {
+          newSettingIdList.add(infoSaving.interpreterSettings.get(oldId).getName());
+        };
       }
       newBindingMap.put(noteId, newSettingIdList);
     }
@@ -256,7 +258,19 @@ public class InterpreterSettingManager {
             interpreterSettingTemplate.getInterpreterRunner());
       } else {
         LOGGER.warn("No InterpreterSetting Template found for InterpreterSetting: "
-            + savedInterpreterSetting.getGroup());
+            + savedInterpreterSetting.getGroup() + ", but it is found in interpreter.json,
"
+            + "it would be skipped.");
+        // also delete its binding
+        for (Map.Entry<String, List<String>> entry : interpreterBindings.entrySet())
{
+          List<String> ids = entry.getValue();
+          Iterator<String> iter = ids.iterator();
+          while(iter.hasNext()) {
+            if (iter.next().equals(savedInterpreterSetting.getId())) {
+              iter.remove();
+            }
+          }
+        }
+        continue;
       }
 
       // Overwrite the default InterpreterSetting we registered from InterpreterSetting Templates


Mime
View raw message