You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zeppelin.apache.org by zj...@apache.org on 2019/11/10 07:56:19 UTC
[zeppelin] branch master updated: [ZEPPELIN-4410] Added exception
handling when converting old notebooks to newer format
This is an automated email from the ASF dual-hosted git repository.
zjffdu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/zeppelin.git
The following commit(s) were added to refs/heads/master by this push:
new 5750a98 [ZEPPELIN-4410] Added exception handling when converting old notebooks to newer format
5750a98 is described below
commit 5750a98d0068e8f7418fa7f1a20af50261ee4980
Author: amakaur <am...@applovin.com>
AuthorDate: Wed Oct 30 16:03:51 2019 -0700
[ZEPPELIN-4410] Added exception handling when converting old notebooks to newer format
### What is this PR for?
Added exception handling when creating a Note object from a json string.
### What type of PR is it?
Bug Fix
### What is the Jira issue?
https://issues.apache.org/jira/browse/ZEPPELIN-4410
### How should this be tested?
- Create a notebook on zeppelin 0.7.3
- Create a spark interpreter
- Run paragraph that creates a runtime exception
- Run upgrade-note.sh on the created notebook
- This will crash the script because it'll not be able to construct a java object from the given note.json
### 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: amakaur <am...@applovin.com>
Closes #3499 from amakaur/add_exception_handling_for_note and squashes the following commits:
e4a9547b0 [amakaur] Added exception handling when converting old notebooks to newer .zpln format
---
.../zeppelin/notebook/repo/OldS3NotebookRepo.java | 4 +++-
.../main/java/org/apache/zeppelin/notebook/Note.java | 18 +++++++++++++-----
2 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/zeppelin-plugins/notebookrepo/s3/src/main/java/org/apache/zeppelin/notebook/repo/OldS3NotebookRepo.java b/zeppelin-plugins/notebookrepo/s3/src/main/java/org/apache/zeppelin/notebook/repo/OldS3NotebookRepo.java
index 8cbd79a..5e4b653 100644
--- a/zeppelin-plugins/notebookrepo/s3/src/main/java/org/apache/zeppelin/notebook/repo/OldS3NotebookRepo.java
+++ b/zeppelin-plugins/notebookrepo/s3/src/main/java/org/apache/zeppelin/notebook/repo/OldS3NotebookRepo.java
@@ -187,6 +187,8 @@ public class OldS3NotebookRepo implements OldNotebookRepo {
info = getNoteInfo(objectSummary.getKey());
if (info != null) {
infos.add(info);
+ } else {
+ LOG.debug("Unable to get notebook info for key: " + objectSummary.getKey());
}
}
}
@@ -215,7 +217,7 @@ public class OldS3NotebookRepo implements OldNotebookRepo {
private OldNoteInfo getNoteInfo(String key) throws IOException {
Note note = getNote(key);
- return new OldNoteInfo(note);
+ return note != null ? new OldNoteInfo(note) : null;
}
@Override
diff --git a/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/Note.java b/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/Note.java
index 9c4138c..3e93038 100644
--- a/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/Note.java
+++ b/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/Note.java
@@ -1029,11 +1029,19 @@ public class Note implements JsonSerializable {
}
public static Note fromJson(String json) {
- Note note = gson.fromJson(json, Note.class);
- convertOldInput(note);
- note.info.remove("isRunning");
- note.postProcessParagraphs();
- return note;
+ try
+ {
+ Note note = gson.fromJson(json, Note.class);
+ convertOldInput(note);
+ note.info.remove("isRunning");
+ note.postProcessParagraphs();
+
+ return note;
+ } catch (Exception e) {
+ logger.error("Unable to parse notebook: " + e.toString());
+
+ return null;
+ }
}
public void postProcessParagraphs() {