zjffdu commented on a change in pull request #3654: [ZEPPELIN-4619] Run a note 
from the commandline
URL: https://github.com/apache/zeppelin/pull/3654#discussion_r381711537
 
 

 ##########
 File path: 
zeppelin-server/src/main/java/org/apache/zeppelin/service/NotebookService.java
 ##########
 @@ -344,19 +349,42 @@ public boolean runParagraph(String noteId,
     }
   }
 
-  public void runAllParagraphs(String noteId,
+  public boolean runAllParagraphs(String noteId,
+                      ServiceContext context,
+                      ServiceCallback<Paragraph> callback) throws IOException {
+    Note note = notebook.getNote(noteId);
+    if (note == null) {
+      callback.onFailure(new NoteNotFoundException(noteId), context);
+      return false;
+    }
+
+    List<Paragraph> paragraphs = note.getParagraphs();
+    List<Map<String, Object>> rawParagraphs = paragraphs.stream()
+            .map(p ->
+                    (Map<String, Object>) gson.fromJson(gson.toJson(p), new 
TypeToken<Map<String, Object>>(){}.getType()))
+            .collect(Collectors.toList());
+
+    return runAllParagraphs(
+            noteId,
+            rawParagraphs,
+            context,
+            callback
+    );
+  }
+
+  public boolean runAllParagraphs(String noteId,
 
 Review comment:
   How about using the existing runAllParagraphs, and check whether 
`paragraphs` is empty, then use the paragraph in backend, otherwise use the 
paragraphs from frontend.  

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to