You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zeppelin.apache.org by mi...@apache.org on 2017/01/26 05:03:55 UTC
zeppelin git commit: [ZEPPELIN-2009] Cron job isn't executed after
couple of times
Repository: zeppelin
Updated Branches:
refs/heads/master 045a921e6 -> 81dbf25d2
[ZEPPELIN-2009] Cron job isn't executed after couple of times
### What is this PR for?
This is to solve the problem with cron job scheduling. basically after https://github.com/apache/zeppelin/commit/6177c819b1edb76cfaa8f6249dc9041771ce6da9 all empty paragraphs are skipped when executing, but if the paragraph had status `READY` that status will be stayed same and then the note won't be considered as terminated in [here](https://github.com/apache/zeppelin/blob/master/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/Notebook.java#L866) resulting on keeping cron threads up running. So after all 10 threads in the threadpool are exhausted, new jobs are not scheduled. Here i change the status of paragraph to `FINISHED` when it's empty and skipping run.
### What type of PR is it?
Bug Fix
### Todos
* [x] - set status to `FINISHED`
### What is the Jira issue?
[ZEPPELIN-2009](https://issues.apache.org/jira/browse/ZEPPELIN-2009)
### How should this be tested?
try to schedule note using cron expression (e.g. `0/5 * * * * ?` every 5 secs) before and after this PR
### 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: Khalid Huseynov <kh...@gmail.com>
Closes #1941 from khalidhuseynov/fix/cron-scheduling and squashes the following commits:
b39cb2a [Khalid Huseynov] fix notebook rest api test
48fd94e [Khalid Huseynov] fix test
54e5ce9 [Khalid Huseynov] set status FINISHED on empty paragraph
Project: http://git-wip-us.apache.org/repos/asf/zeppelin/repo
Commit: http://git-wip-us.apache.org/repos/asf/zeppelin/commit/81dbf25d
Tree: http://git-wip-us.apache.org/repos/asf/zeppelin/tree/81dbf25d
Diff: http://git-wip-us.apache.org/repos/asf/zeppelin/diff/81dbf25d
Branch: refs/heads/master
Commit: 81dbf25d2ae31fcff9940afe9d68804f44cee62b
Parents: 045a921
Author: Khalid Huseynov <kh...@gmail.com>
Authored: Wed Jan 25 01:00:03 2017 -0800
Committer: Mina Lee <mi...@apache.org>
Committed: Thu Jan 26 14:03:48 2017 +0900
----------------------------------------------------------------------
.../test/java/org/apache/zeppelin/rest/NotebookRestApiTest.java | 2 +-
.../src/main/java/org/apache/zeppelin/notebook/Note.java | 5 +++--
.../test/java/org/apache/zeppelin/notebook/NotebookTest.java | 2 +-
3 files changed, 5 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/zeppelin/blob/81dbf25d/zeppelin-server/src/test/java/org/apache/zeppelin/rest/NotebookRestApiTest.java
----------------------------------------------------------------------
diff --git a/zeppelin-server/src/test/java/org/apache/zeppelin/rest/NotebookRestApiTest.java b/zeppelin-server/src/test/java/org/apache/zeppelin/rest/NotebookRestApiTest.java
index d69339c..c8b06d1 100644
--- a/zeppelin-server/src/test/java/org/apache/zeppelin/rest/NotebookRestApiTest.java
+++ b/zeppelin-server/src/test/java/org/apache/zeppelin/rest/NotebookRestApiTest.java
@@ -105,7 +105,7 @@ public class NotebookRestApiTest extends AbstractTestRestApi {
}.getType());
assertEquals(resp.get("status"), "OK");
post.releaseConnection();
- assertEquals(p.getStatus(), Job.Status.READY);
+ assertEquals(p.getStatus(), Job.Status.FINISHED);
// run non-blank paragraph
p.setText("test");
http://git-wip-us.apache.org/repos/asf/zeppelin/blob/81dbf25d/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 f0eae73..26f4e1a 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
@@ -555,13 +555,14 @@ public class Note implements Serializable, ParagraphJobListener {
*/
public void run(String paragraphId) {
Paragraph p = getParagraph(paragraphId);
-
+ p.setListener(jobListenerFactory.getParagraphJobListener(this));
+
if (p.isBlankParagraph()) {
logger.info("skip to run blank paragraph. {}", p.getId());
+ p.setStatus(Job.Status.FINISHED);
return;
}
- p.setListener(jobListenerFactory.getParagraphJobListener(this));
String requiredReplName = p.getRequiredReplName();
Interpreter intp = factory.getInterpreter(p.getUser(), getId(), requiredReplName);
http://git-wip-us.apache.org/repos/asf/zeppelin/blob/81dbf25d/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/NotebookTest.java
----------------------------------------------------------------------
diff --git a/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/NotebookTest.java b/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/NotebookTest.java
index 82d280e..dd54258 100644
--- a/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/NotebookTest.java
+++ b/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/NotebookTest.java
@@ -282,7 +282,7 @@ public class NotebookTest implements JobListenerFactory{
note.run(p1.getId());
Thread.sleep(2 * 1000);
- assertEquals(p1.getStatus(), Status.READY);
+ assertEquals(p1.getStatus(), Status.FINISHED);
assertNull(p1.getDateStarted());
notebook.removeNote(note.getId(), anonymous);
}