You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zeppelin.apache.org by mo...@apache.org on 2018/11/06 16:54:01 UTC
zeppelin git commit: [ZEPPELIN-3850] Fix run all paragraph behavior
Repository: zeppelin
Updated Branches:
refs/heads/master c82de2f3d -> 9f04c8fcb
[ZEPPELIN-3850] Fix run all paragraph behavior
### What is this PR for?
"Run all paragraphs" button runs only the first paragraph of the note.
This PR fixes the problem.
### What type of PR is it?
Bug Fix
### What is the Jira issue?
https://issues.apache.org/jira/browse/ZEPPELIN-3850
### How should this be tested?
Unittest included
### Questions:
* Does the licenses files need update? no
* Is there breaking changes for older versions? no
* Does this needs documentation? no
Author: Lee moon soo <mo...@apache.org>
Closes #3219 from Leemoonsoo/ZEPPELIN-3850 and squashes the following commits:
6cf5dd859 [Lee moon soo] add test runAllParagraphs
1ea145c22 [Lee moon soo] check condition correctly to run all paragraphs
Project: http://git-wip-us.apache.org/repos/asf/zeppelin/repo
Commit: http://git-wip-us.apache.org/repos/asf/zeppelin/commit/9f04c8fc
Tree: http://git-wip-us.apache.org/repos/asf/zeppelin/tree/9f04c8fc
Diff: http://git-wip-us.apache.org/repos/asf/zeppelin/diff/9f04c8fc
Branch: refs/heads/master
Commit: 9f04c8fcba289c90b0754ce920f9a90dcd15a137
Parents: c82de2f
Author: Lee moon soo <mo...@apache.org>
Authored: Mon Nov 5 10:17:09 2018 -0800
Committer: Lee moon soo <mo...@apache.org>
Committed: Tue Nov 6 08:53:56 2018 -0800
----------------------------------------------------------------------
.../org/apache/zeppelin/service/NotebookService.java | 2 +-
.../apache/zeppelin/service/NotebookServiceTest.java | 13 +++++++++++++
2 files changed, 14 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/zeppelin/blob/9f04c8fc/zeppelin-server/src/main/java/org/apache/zeppelin/service/NotebookService.java
----------------------------------------------------------------------
diff --git a/zeppelin-server/src/main/java/org/apache/zeppelin/service/NotebookService.java b/zeppelin-server/src/main/java/org/apache/zeppelin/service/NotebookService.java
index c2e99d2..4cf3bf6 100644
--- a/zeppelin-server/src/main/java/org/apache/zeppelin/service/NotebookService.java
+++ b/zeppelin-server/src/main/java/org/apache/zeppelin/service/NotebookService.java
@@ -397,7 +397,7 @@ public class NotebookService {
Map<String, Object> params = (Map<String, Object>) raw.get("params");
Map<String, Object> config = (Map<String, Object>) raw.get("config");
- if (runParagraph(noteId, paragraphId, title, text, params, config, false, true,
+ if (!runParagraph(noteId, paragraphId, title, text, params, config, false, true,
context, callback)) {
// stop execution when one paragraph fails.
break;
http://git-wip-us.apache.org/repos/asf/zeppelin/blob/9f04c8fc/zeppelin-server/src/test/java/org/apache/zeppelin/service/NotebookServiceTest.java
----------------------------------------------------------------------
diff --git a/zeppelin-server/src/test/java/org/apache/zeppelin/service/NotebookServiceTest.java b/zeppelin-server/src/test/java/org/apache/zeppelin/service/NotebookServiceTest.java
index 0cfdcc1..9d8a735 100644
--- a/zeppelin-server/src/test/java/org/apache/zeppelin/service/NotebookServiceTest.java
+++ b/zeppelin-server/src/test/java/org/apache/zeppelin/service/NotebookServiceTest.java
@@ -19,6 +19,8 @@
package org.apache.zeppelin.service;
import com.google.common.collect.Maps;
+import com.google.gson.Gson;
+import com.google.gson.reflect.TypeToken;
import org.apache.commons.lang.StringUtils;
import org.apache.zeppelin.conf.ZeppelinConfiguration;
import org.apache.zeppelin.interpreter.Interpreter;
@@ -63,6 +65,7 @@ import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.doCallRealMethod;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.reset;
+import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
@@ -75,6 +78,8 @@ public class NotebookServiceTest {
private ServiceCallback callback = mock(ServiceCallback.class);
+ private Gson gson = new Gson();
+
@Before
public void setUp() throws Exception {
@@ -320,6 +325,14 @@ public class NotebookServiceTest {
assertTrue(runStatus);
verify(callback).onSuccess(p, context);
+ // run all paragraphs
+ reset(callback);
+ notebookService.runAllParagraphs(
+ note1.getId(),
+ gson.fromJson(gson.toJson(note1.getParagraphs()), new TypeToken<List>(){}.getType()),
+ context, callback);
+ verify(callback, times(2)).onSuccess(any(), any());
+
// run paragraph synchronously via invalid code
//TODO(zjffdu) must sleep for a while, otherwise will get wrong status. This should be due to
//bug of job component.