You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zeppelin.apache.org by fe...@apache.org on 2017/02/19 18:21:02 UTC
zeppelin git commit: ZEPPELIN-2108. Livy interpreter job cancellation
throws NPE
Repository: zeppelin
Updated Branches:
refs/heads/master d55058b05 -> eb88b0b9e
ZEPPELIN-2108. Livy interpreter job cancellation throws NPE
### What is this PR for?
It happens in some corner cases where output is null when statement is cancelled.
### What type of PR is it?
[Bug Fix]
### Todos
* [ ] - Task
### What is the Jira issue?
* https://issues.apache.org/jira/browse/ZEPPELIN-2108
### How should this be tested?
Tested manually
![livy_cancelled](https://cloud.githubusercontent.com/assets/164491/23003509/2fb0fc9c-f42c-11e6-8cba-ae654a4e5c08.png)
.
### Questions:
* Does the licenses files need update? No
* Is there breaking changes for older versions? No
* Does this needs documentation? No
Author: Jeff Zhang <zj...@apache.org>
Closes #2025 from zjffdu/ZEPPELIN-2108 and squashes the following commits:
191b18a [Jeff Zhang] ZEPPELIN-2108. Livy interpreter job cancellation throws NPE
Project: http://git-wip-us.apache.org/repos/asf/zeppelin/repo
Commit: http://git-wip-us.apache.org/repos/asf/zeppelin/commit/eb88b0b9
Tree: http://git-wip-us.apache.org/repos/asf/zeppelin/tree/eb88b0b9
Diff: http://git-wip-us.apache.org/repos/asf/zeppelin/diff/eb88b0b9
Branch: refs/heads/master
Commit: eb88b0b9e7b711c1a2003fe4a91164976fc61fcd
Parents: d55058b
Author: Jeff Zhang <zj...@apache.org>
Authored: Tue Feb 14 13:34:38 2017 +0800
Committer: Felix Cheung <fe...@apache.org>
Committed: Sun Feb 19 10:20:58 2017 -0800
----------------------------------------------------------------------
.../org/apache/zeppelin/livy/BaseLivyInterprereter.java | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/zeppelin/blob/eb88b0b9/livy/src/main/java/org/apache/zeppelin/livy/BaseLivyInterprereter.java
----------------------------------------------------------------------
diff --git a/livy/src/main/java/org/apache/zeppelin/livy/BaseLivyInterprereter.java b/livy/src/main/java/org/apache/zeppelin/livy/BaseLivyInterprereter.java
index fd533ab..27e8aaf 100644
--- a/livy/src/main/java/org/apache/zeppelin/livy/BaseLivyInterprereter.java
+++ b/livy/src/main/java/org/apache/zeppelin/livy/BaseLivyInterprereter.java
@@ -299,8 +299,14 @@ public abstract class BaseLivyInterprereter extends Interpreter {
private InterpreterResult getResultFromStatementInfo(StatementInfo stmtInfo,
boolean displayAppInfo) {
- if (stmtInfo.output.isError()) {
+ if (stmtInfo.output != null && stmtInfo.output.isError()) {
return new InterpreterResult(InterpreterResult.Code.ERROR, stmtInfo.output.evalue);
+ } else if (stmtInfo.isCancelled()) {
+ // corner case, output might be null if it is cancelled.
+ return new InterpreterResult(InterpreterResult.Code.ERROR, "Job is cancelled");
+ } else if (stmtInfo.output == null) {
+ // This case should never happen, just in case
+ return new InterpreterResult(InterpreterResult.Code.ERROR, "Empty output");
} else {
//TODO(zjffdu) support other types of data (like json, image and etc)
String result = stmtInfo.output.data.plain_text;
@@ -533,6 +539,10 @@ public abstract class BaseLivyInterprereter extends Interpreter {
return state.equals("available") || state.equals("cancelled");
}
+ public boolean isCancelled() {
+ return state.equals("cancelled");
+ }
+
private static class StatementOutput {
public String status;
public String execution_count;