Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 555A5200C28 for ; Mon, 13 Feb 2017 06:33:05 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 53D70160B6E; Mon, 13 Feb 2017 05:33:05 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 9C989160B6B for ; Mon, 13 Feb 2017 06:33:04 +0100 (CET) Received: (qmail 50750 invoked by uid 500); 13 Feb 2017 05:33:03 -0000 Mailing-List: contact commits-help@hive.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: hive-dev@hive.apache.org Delivered-To: mailing list commits@hive.apache.org Received: (qmail 50739 invoked by uid 99); 13 Feb 2017 05:33:02 -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; Mon, 13 Feb 2017 05:33:02 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 9EC9FDFE41; Mon, 13 Feb 2017 05:33:02 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: lirui@apache.org To: commits@hive.apache.org Message-Id: <1588b7ce9e7047058445f84038d4a198@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: hive git commit: HIVE-15860: RemoteSparkJobMonitor may hang when RemoteDriver exits abnormally (Rui reviewed by Xuefu) Date: Mon, 13 Feb 2017 05:33:02 +0000 (UTC) archived-at: Mon, 13 Feb 2017 05:33:05 -0000 Repository: hive Updated Branches: refs/heads/master c67a6f49d -> 791066178 HIVE-15860: RemoteSparkJobMonitor may hang when RemoteDriver exits abnormally (Rui reviewed by Xuefu) Project: http://git-wip-us.apache.org/repos/asf/hive/repo Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/79106617 Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/79106617 Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/79106617 Branch: refs/heads/master Commit: 7910661781393e8cc0992ab6c135a18fa1a68912 Parents: c67a6f4 Author: Rui Li Authored: Mon Feb 13 13:32:28 2017 +0800 Committer: Rui Li Committed: Mon Feb 13 13:32:28 2017 +0800 ---------------------------------------------------------------------- .../hive/ql/exec/spark/status/RemoteSparkJobMonitor.java | 7 ++++++- .../hive/ql/exec/spark/status/impl/RemoteSparkJobStatus.java | 8 ++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hive/blob/79106617/ql/src/java/org/apache/hadoop/hive/ql/exec/spark/status/RemoteSparkJobMonitor.java ---------------------------------------------------------------------- diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/spark/status/RemoteSparkJobMonitor.java b/ql/src/java/org/apache/hadoop/hive/ql/exec/spark/status/RemoteSparkJobMonitor.java index ef3d8f8..dd73f3e 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/exec/spark/status/RemoteSparkJobMonitor.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/spark/status/RemoteSparkJobMonitor.java @@ -21,6 +21,7 @@ package org.apache.hadoop.hive.ql.exec.spark.status; import java.util.Arrays; import java.util.Map; +import com.google.common.base.Preconditions; import org.apache.hadoop.hive.conf.HiveConf; import org.apache.hadoop.hive.ql.exec.Utilities; import org.apache.hadoop.hive.ql.exec.spark.status.impl.RemoteSparkJobStatus; @@ -103,6 +104,10 @@ public class RemoteSparkJobMonitor extends SparkJobMonitor { printStatus(progressMap, lastProgressMap); lastProgressMap = progressMap; + } else if (sparkJobState == null) { + // in case the remote context crashes between JobStarted and JobSubmitted + Preconditions.checkState(sparkJobStatus.isRemoteActive(), + "Remote context becomes inactive."); } break; case SUCCEEDED: @@ -150,7 +155,7 @@ public class RemoteSparkJobMonitor extends SparkJobMonitor { } } catch (Exception e) { String msg = " with exception '" + Utilities.getNameMessage(e) + "'"; - msg = "Failed to monitor Job[ " + sparkJobStatus.getJobId() + "]" + msg; + msg = "Failed to monitor Job[" + sparkJobStatus.getJobId() + "]" + msg; // Has to use full name to make sure it does not conflict with // org.apache.commons.lang.StringUtils http://git-wip-us.apache.org/repos/asf/hive/blob/79106617/ql/src/java/org/apache/hadoop/hive/ql/exec/spark/status/impl/RemoteSparkJobStatus.java ---------------------------------------------------------------------- diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/spark/status/impl/RemoteSparkJobStatus.java b/ql/src/java/org/apache/hadoop/hive/ql/exec/spark/status/impl/RemoteSparkJobStatus.java index 0e3e541..951dbb4 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/exec/spark/status/impl/RemoteSparkJobStatus.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/spark/status/impl/RemoteSparkJobStatus.java @@ -151,6 +151,14 @@ public class RemoteSparkJobStatus implements SparkJobStatus { this.error = e; } + /** + * Indicates whether the remote context is active. SparkJobMonitor can use this to decide whether + * to stop monitoring. + */ + public boolean isRemoteActive() { + return sparkClient.isActive(); + } + private SparkJobInfo getSparkJobInfo() throws HiveException { Integer sparkJobId = jobHandle.getSparkJobIds().size() == 1 ? jobHandle.getSparkJobIds().get(0) : null;