From commits-return-4337-archive-asf-public=cust-asf.ponee.io@zeppelin.apache.org Tue Apr 17 04:11:50 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 1B302180608 for ; Tue, 17 Apr 2018 04:11:49 +0200 (CEST) Received: (qmail 66823 invoked by uid 500); 17 Apr 2018 02:11:49 -0000 Mailing-List: contact commits-help@zeppelin.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@zeppelin.apache.org Delivered-To: mailing list commits@zeppelin.apache.org Received: (qmail 66814 invoked by uid 99); 17 Apr 2018 02:11:49 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 17 Apr 2018 02:11:49 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id A96F4F3602; Tue, 17 Apr 2018 02:11:48 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: zjffdu@apache.org To: commits@zeppelin.apache.org Message-Id: <01622543c5e5435b96bd6f7a15ea558f@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: zeppelin git commit: ZEPPELIN-3391. Incorrect status shown for '%livy2.conf' and %spark2.conf' interpreters Date: Tue, 17 Apr 2018 02:11:48 +0000 (UTC) Repository: zeppelin Updated Branches: refs/heads/master aa3ea6869 -> 0e82a5712 ZEPPELIN-3391. Incorrect status shown for '%livy2.conf' and %spark2.conf' interpreters ### What is this PR for? The root cause of this bug is that the final status of paragraph is not only determined by interpreter, but also by its scheduler. Here the bug is in FIFOScheduler. I just fix it as a quick solution in this PR. But for a long term solution, I think we may need to do code refactoring in the scheduler component. ### What type of PR is it? [Bug Fix] ### Todos * [ ] - Task ### What is the Jira issue? * https://issues.apache.org/jira/browse/ZEPPELIN-3391 ### How should this be tested? * Manually tested ### 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: Jeff Zhang Closes #2926 from zjffdu/ZEPPELIN-3391 and squashes the following commits: 09441ad [Jeff Zhang] ZEPPELIN-3391. Incorrect status shown for '%livy2.conf' and %spark2.conf' interpreters Project: http://git-wip-us.apache.org/repos/asf/zeppelin/repo Commit: http://git-wip-us.apache.org/repos/asf/zeppelin/commit/0e82a571 Tree: http://git-wip-us.apache.org/repos/asf/zeppelin/tree/0e82a571 Diff: http://git-wip-us.apache.org/repos/asf/zeppelin/diff/0e82a571 Branch: refs/heads/master Commit: 0e82a5712ea6229925b7b9663d492b54d3c29b59 Parents: aa3ea68 Author: Jeff Zhang Authored: Wed Apr 11 22:53:48 2018 +0800 Committer: Jeff Zhang Committed: Tue Apr 17 10:11:42 2018 +0800 ---------------------------------------------------------------------- .../remote/RemoteInterpreterServer.java | 14 ++++--------- .../zeppelin/scheduler/FIFOScheduler.java | 22 +++++++++++++++----- 2 files changed, 21 insertions(+), 15 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/zeppelin/blob/0e82a571/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterServer.java ---------------------------------------------------------------------- diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterServer.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterServer.java index b5c7aef..401be36 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterServer.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterServer.java @@ -453,16 +453,10 @@ public class RemoteInterpreterServer extends Thread progressMap.remove(interpreterContext.getParagraphId()); - InterpreterResult result; - if (job.getStatus() == Status.ERROR) { - result = new InterpreterResult(Code.ERROR, Job.getStack(job.getException())); - } else { - result = (InterpreterResult) job.getReturn(); - - // in case of job abort in PENDING status, result can be null - if (result == null) { - result = new InterpreterResult(Code.KEEP_PREVIOUS_RESULT); - } + InterpreterResult result = (InterpreterResult) job.getReturn(); + // in case of job abort in PENDING status, result can be null + if (result == null) { + result = new InterpreterResult(Code.KEEP_PREVIOUS_RESULT); } return convert(result, context.getConfig(), http://git-wip-us.apache.org/repos/asf/zeppelin/blob/0e82a571/zeppelin-interpreter/src/main/java/org/apache/zeppelin/scheduler/FIFOScheduler.java ---------------------------------------------------------------------- diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/scheduler/FIFOScheduler.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/scheduler/FIFOScheduler.java index 7ca4a0e..fd467b6 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/scheduler/FIFOScheduler.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/scheduler/FIFOScheduler.java @@ -23,6 +23,7 @@ import java.util.LinkedList; import java.util.List; import java.util.concurrent.ExecutorService; +import org.apache.zeppelin.interpreter.InterpreterResult; import org.apache.zeppelin.scheduler.Job.Status; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -137,15 +138,26 @@ public class FIFOScheduler implements Scheduler { listener.jobStarted(scheduler, runningJob); } runningJob.run(); + Object jobResult = runningJob.getReturn(); if (runningJob.isAborted()) { runningJob.setStatus(Status.ABORT); + LOGGER.debug("Job Aborted, " + runningJob.getId() + ", " + + runningJob.getErrorMessage()); + } else if (runningJob.getException() != null) { + LOGGER.debug("Job Error, " + runningJob.getId() + ", " + + runningJob.getReturn()); + runningJob.setStatus(Status.ERROR); + } else if (jobResult != null && jobResult instanceof InterpreterResult + && ((InterpreterResult) jobResult).code() == InterpreterResult.Code.ERROR) { + LOGGER.debug("Job Error, " + runningJob.getId() + ", " + + runningJob.getReturn()); + runningJob.setStatus(Status.ERROR); } else { - if (runningJob.getException() != null) { - runningJob.setStatus(Status.ERROR); - } else { - runningJob.setStatus(Status.FINISHED); - } + LOGGER.debug("Job Finished, " + runningJob.getId() + ", Result: " + + runningJob.getReturn()); + runningJob.setStatus(Status.FINISHED); } + if (listener != null) { listener.jobFinished(scheduler, runningJob); }