Repository: zeppelin Updated Branches: refs/heads/master c3b708746 -> f12bc26bb
ZEPPELIN-2555: Run all paragraphs API does not run all paragraph as front-end user. ### What is this PR for? Run all paragraphs API (http://zeppelin.apache.org/docs/0.8.0-SNAPSHOT/rest-api/rest-notebook.html#run-all-paragraphs) does not run all paragraph as front-end user. ### What type of PR is it? [Bug Fix] ### Todos * [ ] - Task ### What is the Jira issue? * [ZEPPELIN-2555](https://issues.apache.org/jira/browse/ZEPPELIN-2555) ### How should this be tested? Testing steps in screenshot ### Screenshots (if appropriate) Before:  After:  ### 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: Prabhjyot Singh <[email protected]> Closes #2348 from prabhjyotsingh/ZEPPELIN-2555 and squashes the following commits: 13350c2f9 [Prabhjyot Singh] add runAll(AuthenticationInfo authenticationInfo) methond Project: http://git-wip-us.apache.org/repos/asf/zeppelin/repo Commit: http://git-wip-us.apache.org/repos/asf/zeppelin/commit/f12bc26b Tree: http://git-wip-us.apache.org/repos/asf/zeppelin/tree/f12bc26b Diff: http://git-wip-us.apache.org/repos/asf/zeppelin/diff/f12bc26b Branch: refs/heads/master Commit: f12bc26bb7dc2011181350cf6ac39fc5f316e949 Parents: c3b7087 Author: Prabhjyot Singh <[email protected]> Authored: Tue May 16 23:18:56 2017 +0530 Committer: Prabhjyot Singh <[email protected]> Committed: Mon May 22 12:14:39 2017 +0530 ---------------------------------------------------------------------- .../main/java/org/apache/zeppelin/rest/NotebookRestApi.java | 4 ++-- .../src/main/java/org/apache/zeppelin/notebook/Note.java | 8 ++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/zeppelin/blob/f12bc26b/zeppelin-server/src/main/java/org/apache/zeppelin/rest/NotebookRestApi.java ---------------------------------------------------------------------- diff --git a/zeppelin-server/src/main/java/org/apache/zeppelin/rest/NotebookRestApi.java b/zeppelin-server/src/main/java/org/apache/zeppelin/rest/NotebookRestApi.java index 8ca0476..9c511d4 100644 --- a/zeppelin-server/src/main/java/org/apache/zeppelin/rest/NotebookRestApi.java +++ b/zeppelin-server/src/main/java/org/apache/zeppelin/rest/NotebookRestApi.java @@ -588,17 +588,17 @@ public class NotebookRestApi { throws IOException, IllegalArgumentException { LOG.info("run note jobs {} ", noteId); Note note = notebook.getNote(noteId); + AuthenticationInfo subject = new AuthenticationInfo(SecurityUtils.getPrincipal()); checkIfNoteIsNotNull(note); checkIfUserCanWrite(noteId, "Insufficient privileges you cannot run job for this note"); try { - note.runAll(); + note.runAll(subject); } catch (Exception ex) { LOG.error("Exception from run", ex); return new JsonResponse<>(Status.PRECONDITION_FAILED, ex.getMessage() + "- Not selected or Invalid Interpreter bind").build(); } - return new JsonResponse<>(Status.OK).build(); } http://git-wip-us.apache.org/repos/asf/zeppelin/blob/f12bc26b/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/Note.java ---------------------------------------------------------------------- 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 b23048a..6255727 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 @@ -588,12 +588,16 @@ public class Note implements Serializable, ParagraphJobListener { if (null == cronExecutingUser) { cronExecutingUser = "anonymous"; } + AuthenticationInfo authenticationInfo = new AuthenticationInfo(); + authenticationInfo.setUser(cronExecutingUser); + runAll(authenticationInfo); + } + + public void runAll(AuthenticationInfo authenticationInfo) { for (Paragraph p : getParagraphs()) { if (!p.isEnabled()) { continue; } - AuthenticationInfo authenticationInfo = new AuthenticationInfo(); - authenticationInfo.setUser(cronExecutingUser); p.setAuthenticationInfo(authenticationInfo); run(p.getId()); }
