From issues-return-195091-archive-asf-public=cust-asf.ponee.io@flink.apache.org Tue Oct 16 21:57:12 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 405C618067C for ; Tue, 16 Oct 2018 21:57:12 +0200 (CEST) Received: (qmail 54101 invoked by uid 500); 16 Oct 2018 19:57:11 -0000 Mailing-List: contact issues-help@flink.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@flink.apache.org Delivered-To: mailing list issues@flink.apache.org Received: (qmail 54092 invoked by uid 99); 16 Oct 2018 19:57:11 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 16 Oct 2018 19:57:11 +0000 From: GitBox To: issues@flink.apache.org Subject: [GitHub] zentol closed pull request #5648: [FLINK-8887][flip-6] ClusterClient.getJobStatus can throw FencingTokenException Message-ID: <153971983082.9690.13503482014204705245.gitbox@gitbox.apache.org> Date: Tue, 16 Oct 2018 19:57:10 -0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit zentol closed pull request #5648: [FLINK-8887][flip-6] ClusterClient.getJobStatus can throw FencingTokenException URL: https://github.com/apache/flink/pull/5648 This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/dispatcher/Dispatcher.java b/flink-runtime/src/main/java/org/apache/flink/runtime/dispatcher/Dispatcher.java index 9b2411c66b7..1789758a6f1 100644 --- a/flink-runtime/src/main/java/org/apache/flink/runtime/dispatcher/Dispatcher.java +++ b/flink-runtime/src/main/java/org/apache/flink/runtime/dispatcher/Dispatcher.java @@ -57,6 +57,7 @@ import org.apache.flink.runtime.rpc.FencedRpcEndpoint; import org.apache.flink.runtime.rpc.RpcService; import org.apache.flink.runtime.rpc.RpcUtils; +import org.apache.flink.runtime.rpc.exceptions.FencingTokenException; import org.apache.flink.util.ExceptionUtils; import org.apache.flink.util.FlinkException; import org.apache.flink.util.Preconditions; @@ -74,6 +75,7 @@ import java.util.Map; import java.util.UUID; import java.util.concurrent.CompletableFuture; +import java.util.concurrent.CompletionException; import java.util.stream.Collectors; /** @@ -404,7 +406,29 @@ public void start() throws Exception { final JobManagerRunner jobManagerRunner = jobManagerRunners.get(jobId); if (jobManagerRunner != null) { - return jobManagerRunner.getJobManagerGateway().requestJobStatus(timeout); + CompletableFuture statusFuture = jobManagerRunner.getJobManagerGateway().requestJobStatus(timeout); + statusFuture.handle((JobStatus status, Throwable throwable) -> { + if (throwable != null) { + Throwable error = ExceptionUtils.stripCompletionException(throwable); + + if (error instanceof FencingTokenException) { + log.warn("It occurs FencingTokenException may be the job manager runner has no leadership or" + + " the job has finished, so we would try to get it from archived execution graph store."); + final JobDetails jobDetails = archivedExecutionGraphStore.getAvailableJobDetails(jobId); + + if (jobDetails != null) { + return jobDetails.getStatus(); + } else { + throw new CompletionException(new FlinkJobNotFoundException(jobId)); + } + } + + } + + return status; + }); + + return statusFuture; } else { final JobDetails jobDetails = archivedExecutionGraphStore.getAvailableJobDetails(jobId); ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org With regards, Apache Git Services