You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by tr...@apache.org on 2018/03/02 07:54:33 UTC
[01/12] flink git commit: [FLINK-8808] [flip6] Allow
RestClusterClient to connect to local dispatcher
Repository: flink
Updated Branches:
refs/heads/release-1.5 1fcd516a0 -> 81aa5acee
[FLINK-8808] [flip6] Allow RestClusterClient to connect to local dispatcher
The RestClusterClient resolves a dispatcher address without an explicit host
to 'localhost'. That way we allow the RestClusterClient to talk to a Dispatcher
which runs in a local ActorSystem.
This closes #5599.
Project: http://git-wip-us.apache.org/repos/asf/flink/repo
Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/02cb9e39
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/02cb9e39
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/02cb9e39
Branch: refs/heads/release-1.5
Commit: 02cb9e39cc19ebbf82f06d87035aead20780eb2b
Parents: 1fcd516
Author: Till Rohrmann <tr...@apache.org>
Authored: Wed Feb 28 14:07:12 2018 +0100
Committer: Till Rohrmann <tr...@apache.org>
Committed: Fri Mar 2 08:53:47 2018 +0100
----------------------------------------------------------------------
.../client/program/rest/RestClusterClient.java | 20 +++---
.../apache/flink/runtime/util/ScalaUtils.java | 46 ++++++++++++++
.../flink/runtime/util/ScalaUtilsTest.java | 66 ++++++++++++++++++++
3 files changed, 125 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flink/blob/02cb9e39/flink-clients/src/main/java/org/apache/flink/client/program/rest/RestClusterClient.java
----------------------------------------------------------------------
diff --git a/flink-clients/src/main/java/org/apache/flink/client/program/rest/RestClusterClient.java b/flink-clients/src/main/java/org/apache/flink/client/program/rest/RestClusterClient.java
index 3a377f3..9833296 100644
--- a/flink-clients/src/main/java/org/apache/flink/client/program/rest/RestClusterClient.java
+++ b/flink-clients/src/main/java/org/apache/flink/client/program/rest/RestClusterClient.java
@@ -77,6 +77,7 @@ import org.apache.flink.runtime.rest.util.RestClientException;
import org.apache.flink.runtime.util.ExecutorThreadFactory;
import org.apache.flink.runtime.util.LeaderConnectionInfo;
import org.apache.flink.runtime.util.LeaderRetrievalUtils;
+import org.apache.flink.runtime.util.ScalaUtils;
import org.apache.flink.runtime.webmonitor.retriever.LeaderRetriever;
import org.apache.flink.util.ExceptionUtils;
import org.apache.flink.util.ExecutorUtils;
@@ -97,6 +98,7 @@ import java.net.URL;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
+import java.util.Optional;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionException;
import java.util.concurrent.ExecutorService;
@@ -107,10 +109,6 @@ import java.util.function.Predicate;
import java.util.function.Supplier;
import java.util.stream.Collectors;
-import scala.Option;
-
-import static org.apache.flink.util.Preconditions.checkArgument;
-
/**
* A {@link ClusterClient} implementation that communicates via HTTP REST requests.
*/
@@ -636,9 +634,17 @@ public class RestClusterClient<T> extends ClusterClient<T> {
TimeUnit.MILLISECONDS)
.thenApplyAsync(leaderAddressSessionId -> {
final String address = leaderAddressSessionId.f0;
- final Option<String> host = AddressFromURIString.parse(address).host();
- checkArgument(host.isDefined(), "Could not parse host from %s", address);
- return host.get();
+ final Optional<String> host = ScalaUtils.toJava(AddressFromURIString.parse(address).host());
+
+ return host.orElseGet(() -> {
+ // if the dispatcher address does not contain a host part, then assume it's running
+ // on the same machine as the client
+ log.info("The dispatcher seems to run without remoting enabled. This indicates that we are " +
+ "in a test. This can only work if the RestClusterClient runs on the same machine. " +
+ "Assuming, therefore, 'localhost' as the host.");
+
+ return "localhost";
+ });
}, executorService);
}
http://git-wip-us.apache.org/repos/asf/flink/blob/02cb9e39/flink-runtime/src/main/java/org/apache/flink/runtime/util/ScalaUtils.java
----------------------------------------------------------------------
diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/util/ScalaUtils.java b/flink-runtime/src/main/java/org/apache/flink/runtime/util/ScalaUtils.java
new file mode 100644
index 0000000..fa4260e
--- /dev/null
+++ b/flink-runtime/src/main/java/org/apache/flink/runtime/util/ScalaUtils.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.runtime.util;
+
+import java.util.Optional;
+
+import scala.Option;
+
+/**
+ * Utilities to convert Scala types into Java types.
+ */
+public class ScalaUtils {
+
+ /**
+ * Converts a Scala {@link Option} to a {@link Optional}.
+ *
+ * @param scalaOption to convert into ta Java {@link Optional}
+ * @param <T> type of the optional value
+ * @return Optional of the given option
+ */
+ public static <T> Optional<T> toJava(Option<T> scalaOption) {
+ if (scalaOption.isEmpty()) {
+ return Optional.empty();
+ } else {
+ return Optional.ofNullable(scalaOption.get());
+ }
+ }
+
+ private ScalaUtils() {}
+}
http://git-wip-us.apache.org/repos/asf/flink/blob/02cb9e39/flink-runtime/src/test/java/org/apache/flink/runtime/util/ScalaUtilsTest.java
----------------------------------------------------------------------
diff --git a/flink-runtime/src/test/java/org/apache/flink/runtime/util/ScalaUtilsTest.java b/flink-runtime/src/test/java/org/apache/flink/runtime/util/ScalaUtilsTest.java
new file mode 100644
index 0000000..e5e9896
--- /dev/null
+++ b/flink-runtime/src/test/java/org/apache/flink/runtime/util/ScalaUtilsTest.java
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.runtime.util;
+
+import org.apache.flink.util.TestLogger;
+
+import org.junit.Test;
+
+import java.util.NoSuchElementException;
+import java.util.Optional;
+
+import scala.Option;
+
+import static org.apache.flink.runtime.util.ScalaUtils.toJava;
+import static org.hamcrest.Matchers.is;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.fail;
+
+/**
+ * Tests for {@link ScalaUtils} convenience methods.
+ */
+public class ScalaUtilsTest extends TestLogger {
+
+ @Test
+ public void testOptionToOptional() {
+ final String value = "foobar";
+ final Option<String> option = Option.apply(value);
+ final Optional<String> optional = toJava(option);
+
+ assertThat(optional.isPresent(), is(true));
+ assertThat(optional.get(), is(value));
+
+ final Option<String> nullOption = Option.apply(null);
+ final Optional<String> nullOptional = toJava(nullOption);
+
+ assertThat(nullOptional.isPresent(), is(false));
+
+ try {
+ nullOptional.get();
+ fail("Expected NoSuchElementException");
+ } catch (NoSuchElementException ignored) {
+ // ignored
+ }
+
+ final Option<String> emptyOption = Option.empty();
+ final Optional<String> emptyOptional = toJava(emptyOption);
+
+ assertThat(emptyOptional.isPresent(), is(false));
+ }
+}
[07/12] flink git commit: [hotfix] Unregister job from
JobManagerRunner before completing the result future
Posted by tr...@apache.org.
[hotfix] Unregister job from JobManagerRunner before completing the result future
Project: http://git-wip-us.apache.org/repos/asf/flink/repo
Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/2b693502
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/2b693502
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/2b693502
Branch: refs/heads/release-1.5
Commit: 2b693502318dd3bfdae352b6ae4f4be6e4443bbc
Parents: 4079114
Author: Till Rohrmann <tr...@apache.org>
Authored: Thu Mar 1 17:06:27 2018 +0100
Committer: Till Rohrmann <tr...@apache.org>
Committed: Fri Mar 2 08:53:50 2018 +0100
----------------------------------------------------------------------
.../java/org/apache/flink/runtime/jobmaster/JobManagerRunner.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flink/blob/2b693502/flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/JobManagerRunner.java
----------------------------------------------------------------------
diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/JobManagerRunner.java b/flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/JobManagerRunner.java
index 80aa673..8b64f0d 100644
--- a/flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/JobManagerRunner.java
+++ b/flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/JobManagerRunner.java
@@ -265,8 +265,8 @@ public class JobManagerRunner implements LeaderContender, OnCompletionActions, F
@Override
public void jobReachedGloballyTerminalState(ArchivedExecutionGraph executionGraph) {
// complete the result future with the terminal execution graph
- resultFuture.complete(executionGraph);
unregisterJobFromHighAvailability();
+ resultFuture.complete(executionGraph);
}
/**
[10/12] flink git commit: [hotfix] Correct shutdown order of
RestClusterClient
Posted by tr...@apache.org.
[hotfix] Correct shutdown order of RestClusterClient
Project: http://git-wip-us.apache.org/repos/asf/flink/repo
Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/ea920efc
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/ea920efc
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/ea920efc
Branch: refs/heads/release-1.5
Commit: ea920efc64254b16322bb1d13b5ab1c8633cbda7
Parents: f0d4b3c
Author: Till Rohrmann <tr...@apache.org>
Authored: Thu Mar 1 18:21:19 2018 +0100
Committer: Till Rohrmann <tr...@apache.org>
Committed: Fri Mar 2 08:53:51 2018 +0100
----------------------------------------------------------------------
.../flink/client/program/rest/RestClusterClient.java | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flink/blob/ea920efc/flink-clients/src/main/java/org/apache/flink/client/program/rest/RestClusterClient.java
----------------------------------------------------------------------
diff --git a/flink-clients/src/main/java/org/apache/flink/client/program/rest/RestClusterClient.java b/flink-clients/src/main/java/org/apache/flink/client/program/rest/RestClusterClient.java
index 9833296..976f2a4 100644
--- a/flink-clients/src/main/java/org/apache/flink/client/program/rest/RestClusterClient.java
+++ b/flink-clients/src/main/java/org/apache/flink/client/program/rest/RestClusterClient.java
@@ -192,13 +192,6 @@ public class RestClusterClient<T> extends ClusterClient<T> {
@Override
public void shutdown() {
- try {
- // we only call this for legacy reasons to shutdown components that are started in the ClusterClient constructor
- super.shutdown();
- } catch (Exception e) {
- log.error("An error occurred during the client shutdown.", e);
- }
-
ExecutorUtils.gracefulShutdown(restClusterClientConfiguration.getRetryDelay(), TimeUnit.MILLISECONDS, retryExecutorService);
this.restClient.shutdown(Time.seconds(5));
@@ -215,6 +208,13 @@ public class RestClusterClient<T> extends ClusterClient<T> {
} catch (Exception e) {
log.error("An error occurred during stopping the dispatcherLeaderRetriever", e);
}
+
+ try {
+ // we only call this for legacy reasons to shutdown components that are started in the ClusterClient constructor
+ super.shutdown();
+ } catch (Exception e) {
+ log.error("An error occurred during the client shutdown.", e);
+ }
}
@Override
[08/12] flink git commit: [hotfix] Close ResourceManager
LeaderRetrievalService in TaskExecutor
Posted by tr...@apache.org.
[hotfix] Close ResourceManager LeaderRetrievalService in TaskExecutor
Project: http://git-wip-us.apache.org/repos/asf/flink/repo
Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/f0d4b3c9
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/f0d4b3c9
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/f0d4b3c9
Branch: refs/heads/release-1.5
Commit: f0d4b3c98f71fa15b99e55634bc4d067b48149fc
Parents: 2b69350
Author: Till Rohrmann <tr...@apache.org>
Authored: Thu Mar 1 17:13:44 2018 +0100
Committer: Till Rohrmann <tr...@apache.org>
Committed: Fri Mar 2 08:53:50 2018 +0100
----------------------------------------------------------------------
.../apache/flink/runtime/taskexecutor/TaskExecutor.java | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flink/blob/f0d4b3c9/flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/TaskExecutor.java
----------------------------------------------------------------------
diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/TaskExecutor.java b/flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/TaskExecutor.java
index 927bd11..956a319 100644
--- a/flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/TaskExecutor.java
+++ b/flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/TaskExecutor.java
@@ -56,6 +56,7 @@ import org.apache.flink.runtime.jobmaster.JMTMRegistrationSuccess;
import org.apache.flink.runtime.jobmaster.JobMasterGateway;
import org.apache.flink.runtime.jobmaster.JobMasterId;
import org.apache.flink.runtime.leaderretrieval.LeaderRetrievalListener;
+import org.apache.flink.runtime.leaderretrieval.LeaderRetrievalService;
import org.apache.flink.runtime.messages.Acknowledge;
import org.apache.flink.runtime.messages.StackTraceSampleResponse;
import org.apache.flink.runtime.metrics.groups.TaskManagerMetricGroup;
@@ -176,6 +177,8 @@ public class TaskExecutor extends RpcEndpoint implements TaskExecutorGateway {
private final JobLeaderService jobLeaderService;
+ private final LeaderRetrievalService resourceManagerLeaderRetriever;
+
// ------------------------------------------------------------------------
private final HardwareDescription hardwareDescription;
@@ -207,6 +210,7 @@ public class TaskExecutor extends RpcEndpoint implements TaskExecutorGateway {
this.taskManagerLocation = taskExecutorServices.getTaskManagerLocation();
this.localStateStoresManager = taskExecutorServices.getTaskManagerStateStore();
this.networkEnvironment = taskExecutorServices.getNetworkEnvironment();
+ this.resourceManagerLeaderRetriever = haServices.getResourceManagerLeaderRetriever();
this.jobManagerConnections = new HashMap<>(4);
@@ -238,7 +242,7 @@ public class TaskExecutor extends RpcEndpoint implements TaskExecutorGateway {
// start by connecting to the ResourceManager
try {
- haServices.getResourceManagerLeaderRetriever().start(new ResourceManagerLeaderListener());
+ resourceManagerLeaderRetriever.start(new ResourceManagerLeaderListener());
} catch (Exception e) {
onFatalError(e);
}
@@ -276,6 +280,12 @@ public class TaskExecutor extends RpcEndpoint implements TaskExecutorGateway {
resourceManagerHeartbeatManager.stop();
try {
+ resourceManagerLeaderRetriever.stop();
+ } catch (Exception e) {
+ throwable = ExceptionUtils.firstOrSuppressed(e, throwable);
+ }
+
+ try {
taskExecutorServices.shutDown();
} catch (Throwable t) {
throwable = ExceptionUtils.firstOrSuppressed(t, throwable);
[06/12] flink git commit: [FLINK-8811] [flip6] Implement
MiniClusterClient#cancel
Posted by tr...@apache.org.
[FLINK-8811] [flip6] Implement MiniClusterClient#cancel
Project: http://git-wip-us.apache.org/repos/asf/flink/repo
Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/29b34e22
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/29b34e22
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/29b34e22
Branch: refs/heads/release-1.5
Commit: 29b34e2255c41abc1c7c4af8ab268a39df57f0ff
Parents: 19e4f68
Author: Till Rohrmann <tr...@apache.org>
Authored: Wed Feb 28 17:54:06 2018 +0100
Committer: Till Rohrmann <tr...@apache.org>
Committed: Fri Mar 2 08:53:49 2018 +0100
----------------------------------------------------------------------
.../apache/flink/client/program/MiniClusterClient.java | 2 +-
.../apache/flink/runtime/minicluster/MiniCluster.java | 13 ++++++++++++-
2 files changed, 13 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flink/blob/29b34e22/flink-clients/src/main/java/org/apache/flink/client/program/MiniClusterClient.java
----------------------------------------------------------------------
diff --git a/flink-clients/src/main/java/org/apache/flink/client/program/MiniClusterClient.java b/flink-clients/src/main/java/org/apache/flink/client/program/MiniClusterClient.java
index e99addd..b98e895 100644
--- a/flink-clients/src/main/java/org/apache/flink/client/program/MiniClusterClient.java
+++ b/flink-clients/src/main/java/org/apache/flink/client/program/MiniClusterClient.java
@@ -82,7 +82,7 @@ public class MiniClusterClient extends ClusterClient<MiniClusterClient.MiniClust
@Override
public void cancel(JobID jobId) throws Exception {
- throw new UnsupportedOperationException("MiniClusterClient does not yet support this operation.");
+ miniCluster.cancelJob(jobId);
}
@Override
http://git-wip-us.apache.org/repos/asf/flink/blob/29b34e22/flink-runtime/src/main/java/org/apache/flink/runtime/minicluster/MiniCluster.java
----------------------------------------------------------------------
diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/minicluster/MiniCluster.java b/flink-runtime/src/main/java/org/apache/flink/runtime/minicluster/MiniCluster.java
index 5b086ca..2efdb03 100644
--- a/flink-runtime/src/main/java/org/apache/flink/runtime/minicluster/MiniCluster.java
+++ b/flink-runtime/src/main/java/org/apache/flink/runtime/minicluster/MiniCluster.java
@@ -467,7 +467,18 @@ public class MiniCluster implements JobExecutorService, AutoCloseableAsync {
} catch (LeaderRetrievalException | InterruptedException e) {
return FutureUtils.completedExceptionally(
new FlinkException(
- String.format("Could not retrieve job status for job %s", jobId),
+ String.format("Could not retrieve job status for job %s.", jobId),
+ e));
+ }
+ }
+
+ public CompletableFuture<Acknowledge> cancelJob(JobID jobId) {
+ try {
+ return getDispatcherGateway().cancelJob(jobId, rpcTimeout);
+ } catch (LeaderRetrievalException | InterruptedException e) {
+ return FutureUtils.completedExceptionally(
+ new FlinkException(
+ String.format("Could not cancel job %s.", jobId),
e));
}
}
[03/12] flink git commit: [FLINK-8811] [flip6] Add initial
implementation of the MiniClusterClient
Posted by tr...@apache.org.
[FLINK-8811] [flip6] Add initial implementation of the MiniClusterClient
The MiniClusterClient directly talks to the MiniCluster avoiding polling
latencies of th RestClusterClient.
This closes #5600.
Project: http://git-wip-us.apache.org/repos/asf/flink/repo
Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/f30ca210
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/f30ca210
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/f30ca210
Branch: refs/heads/release-1.5
Commit: f30ca2101f2151214b138f37f472f886fbdfd9f0
Parents: 02cb9e3
Author: Till Rohrmann <tr...@apache.org>
Authored: Wed Feb 28 17:36:39 2018 +0100
Committer: Till Rohrmann <tr...@apache.org>
Committed: Fri Mar 2 08:53:48 2018 +0100
----------------------------------------------------------------------
.../flink/client/program/MiniClusterClient.java | 171 +++++++++++++++++++
.../flink/runtime/minicluster/MiniCluster.java | 7 +
.../flink/test/util/MiniClusterResource.java | 53 ++++--
3 files changed, 216 insertions(+), 15 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flink/blob/f30ca210/flink-clients/src/main/java/org/apache/flink/client/program/MiniClusterClient.java
----------------------------------------------------------------------
diff --git a/flink-clients/src/main/java/org/apache/flink/client/program/MiniClusterClient.java b/flink-clients/src/main/java/org/apache/flink/client/program/MiniClusterClient.java
new file mode 100644
index 0000000..5baae5b
--- /dev/null
+++ b/flink-clients/src/main/java/org/apache/flink/client/program/MiniClusterClient.java
@@ -0,0 +1,171 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.client.program;
+
+import org.apache.flink.api.common.JobID;
+import org.apache.flink.api.common.JobSubmissionResult;
+import org.apache.flink.api.common.time.Time;
+import org.apache.flink.configuration.Configuration;
+import org.apache.flink.runtime.client.JobExecutionException;
+import org.apache.flink.runtime.client.JobStatusMessage;
+import org.apache.flink.runtime.clusterframework.messages.GetClusterStatusResponse;
+import org.apache.flink.runtime.jobgraph.JobGraph;
+import org.apache.flink.runtime.leaderretrieval.LeaderRetrievalException;
+import org.apache.flink.runtime.messages.Acknowledge;
+import org.apache.flink.runtime.minicluster.MiniCluster;
+import org.apache.flink.runtime.util.LeaderConnectionInfo;
+import org.apache.flink.runtime.util.LeaderRetrievalUtils;
+import org.apache.flink.util.FlinkException;
+
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
+import java.net.URL;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.CompletableFuture;
+
+/**
+ * Client to interact with a {@link MiniCluster}.
+ */
+public class MiniClusterClient extends ClusterClient<MiniClusterClient.MiniClusterId> {
+
+ private final MiniCluster miniCluster;
+
+ public MiniClusterClient(@Nonnull Configuration configuration, @Nonnull MiniCluster miniCluster) throws Exception {
+ super(configuration, miniCluster.getHighAvailabilityServices());
+
+ this.miniCluster = miniCluster;
+ }
+
+ @Override
+ protected JobSubmissionResult submitJob(JobGraph jobGraph, ClassLoader classLoader) throws ProgramInvocationException {
+ if (isDetached()) {
+ try {
+ miniCluster.runDetached(jobGraph);
+ } catch (JobExecutionException | InterruptedException e) {
+ throw new ProgramInvocationException(
+ String.format("Could not run job %s in detached mode.", jobGraph.getJobID()),
+ e);
+ }
+
+ return new JobSubmissionResult(jobGraph.getJobID());
+ } else {
+ try {
+ return miniCluster.executeJobBlocking(jobGraph);
+ } catch (JobExecutionException | InterruptedException e) {
+ throw new ProgramInvocationException(
+ String.format("Could not run job %s.", jobGraph.getJobID()),
+ e);
+ }
+ }
+ }
+
+ @Override
+ public void cancel(JobID jobId) throws Exception {
+ throw new UnsupportedOperationException("MiniClusterClient does not yet support this operation.");
+ }
+
+ @Override
+ public String cancelWithSavepoint(JobID jobId, @Nullable String savepointDirectory) throws Exception {
+ throw new UnsupportedOperationException("MiniClusterClient does not yet support this operation.");
+ }
+
+ @Override
+ public void stop(JobID jobId) throws Exception {
+ throw new UnsupportedOperationException("MiniClusterClient does not yet support this operation.");
+ }
+
+ @Override
+ public CompletableFuture<String> triggerSavepoint(JobID jobId, @Nullable String savepointDirectory) throws FlinkException {
+ throw new UnsupportedOperationException("MiniClusterClient does not yet support this operation.");
+ }
+
+ @Override
+ public CompletableFuture<Acknowledge> disposeSavepoint(String savepointPath, Time timeout) throws FlinkException {
+ throw new UnsupportedOperationException("MiniClusterClient does not yet support this operation.");
+ }
+
+ @Override
+ public CompletableFuture<Collection<JobStatusMessage>> listJobs() throws Exception {
+ throw new UnsupportedOperationException("MiniClusterClient does not yet support this operation.");
+ }
+
+ @Override
+ public Map<String, Object> getAccumulators(JobID jobID) throws Exception {
+ throw new UnsupportedOperationException("MiniClusterClient does not yet support this operation.");
+ }
+
+ @Override
+ public Map<String, Object> getAccumulators(JobID jobID, ClassLoader loader) throws Exception {
+ throw new UnsupportedOperationException("MiniClusterClient does not yet support this operation.");
+ }
+
+ @Override
+ public MiniClusterClient.MiniClusterId getClusterId() {
+ return MiniClusterId.INSTANCE;
+ }
+
+ @Override
+ public LeaderConnectionInfo getClusterConnectionInfo() throws LeaderRetrievalException {
+ return LeaderRetrievalUtils.retrieveLeaderConnectionInfo(
+ highAvailabilityServices.getDispatcherLeaderRetriever(),
+ timeout);
+ }
+
+ // ======================================
+ // Legacy methods
+ // ======================================
+
+ @Override
+ public void waitForClusterToBeReady() {
+ // no op
+ }
+
+ @Override
+ public String getWebInterfaceURL() {
+ return miniCluster.getRestAddress().toString();
+ }
+
+ @Override
+ public GetClusterStatusResponse getClusterStatus() {
+ return null;
+ }
+
+ @Override
+ public List<String> getNewMessages() {
+ return Collections.emptyList();
+ }
+
+ @Override
+ public int getMaxSlots() {
+ return 0;
+ }
+
+ @Override
+ public boolean hasUserJarsInClassPath(List<URL> userJarFiles) {
+ return false;
+ }
+
+ enum MiniClusterId {
+ INSTANCE
+ }
+}
http://git-wip-us.apache.org/repos/asf/flink/blob/f30ca210/flink-runtime/src/main/java/org/apache/flink/runtime/minicluster/MiniCluster.java
----------------------------------------------------------------------
diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/minicluster/MiniCluster.java b/flink-runtime/src/main/java/org/apache/flink/runtime/minicluster/MiniCluster.java
index 3bd17d1..cbfb266 100644
--- a/flink-runtime/src/main/java/org/apache/flink/runtime/minicluster/MiniCluster.java
+++ b/flink-runtime/src/main/java/org/apache/flink/runtime/minicluster/MiniCluster.java
@@ -178,6 +178,13 @@ public class MiniCluster implements JobExecutorService, AutoCloseableAsync {
}
}
+ public HighAvailabilityServices getHighAvailabilityServices() {
+ synchronized (lock) {
+ checkState(running, "MiniCluster is not yet running.");
+ return haServices;
+ }
+ }
+
// ------------------------------------------------------------------------
// life cycle
// ------------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flink/blob/f30ca210/flink-test-utils-parent/flink-test-utils/src/main/java/org/apache/flink/test/util/MiniClusterResource.java
----------------------------------------------------------------------
diff --git a/flink-test-utils-parent/flink-test-utils/src/main/java/org/apache/flink/test/util/MiniClusterResource.java b/flink-test-utils-parent/flink-test-utils/src/main/java/org/apache/flink/test/util/MiniClusterResource.java
index 1c5da62..a1ce647 100644
--- a/flink-test-utils-parent/flink-test-utils/src/main/java/org/apache/flink/test/util/MiniClusterResource.java
+++ b/flink-test-utils-parent/flink-test-utils/src/main/java/org/apache/flink/test/util/MiniClusterResource.java
@@ -19,15 +19,20 @@
package org.apache.flink.test.util;
import org.apache.flink.api.common.time.Time;
+import org.apache.flink.client.program.ClusterClient;
+import org.apache.flink.client.program.MiniClusterClient;
+import org.apache.flink.client.program.StandaloneClusterClient;
import org.apache.flink.configuration.ConfigConstants;
import org.apache.flink.configuration.Configuration;
import org.apache.flink.configuration.CoreOptions;
import org.apache.flink.configuration.RestOptions;
import org.apache.flink.runtime.akka.AkkaUtils;
import org.apache.flink.runtime.minicluster.JobExecutorService;
+import org.apache.flink.runtime.minicluster.LocalFlinkMiniCluster;
import org.apache.flink.runtime.minicluster.MiniCluster;
import org.apache.flink.runtime.minicluster.MiniClusterConfiguration;
import org.apache.flink.streaming.util.TestStreamEnvironment;
+import org.apache.flink.util.ExceptionUtils;
import org.apache.flink.util.FlinkRuntimeException;
import org.apache.flink.util.Preconditions;
@@ -35,8 +40,6 @@ import org.junit.rules.ExternalResource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import javax.annotation.Nonnull;
-
import java.util.Objects;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeUnit;
@@ -59,6 +62,8 @@ public class MiniClusterResource extends ExternalResource {
private JobExecutorService jobExecutorService;
+ private ClusterClient<?> clusterClient;
+
private int numberSlots = -1;
private TestEnvironment executionEnvironment;
@@ -80,6 +85,10 @@ public class MiniClusterResource extends ExternalResource {
return numberSlots;
}
+ public ClusterClient<?> getClusterClient() {
+ return clusterClient;
+ }
+
public TestEnvironment getTestEnvironment() {
return executionEnvironment;
}
@@ -87,7 +96,7 @@ public class MiniClusterResource extends ExternalResource {
@Override
public void before() throws Exception {
- jobExecutorService = startJobExecutorService(miniClusterType);
+ startJobExecutorService(miniClusterType);
numberSlots = miniClusterResourceConfiguration.getNumberSlotsPerTaskManager() * miniClusterResourceConfiguration.getNumberTaskManagers();
@@ -102,6 +111,16 @@ public class MiniClusterResource extends ExternalResource {
TestStreamEnvironment.unsetAsContext();
TestEnvironment.unsetAsContext();
+ Exception exception = null;
+
+ try {
+ clusterClient.shutdown();
+ } catch (Exception e) {
+ exception = e;
+ }
+
+ clusterClient = null;
+
final CompletableFuture<?> terminationFuture = jobExecutorService.closeAsync();
try {
@@ -109,40 +128,43 @@ public class MiniClusterResource extends ExternalResource {
miniClusterResourceConfiguration.getShutdownTimeout().toMilliseconds(),
TimeUnit.MILLISECONDS);
} catch (Exception e) {
- LOG.warn("Could not properly shut down the MiniClusterResource.", e);
+ exception = ExceptionUtils.firstOrSuppressed(e, exception);
}
jobExecutorService = null;
+
+ if (exception != null) {
+ LOG.warn("Could not properly shut down the MiniClusterResource.", exception);
+ }
}
- private JobExecutorService startJobExecutorService(MiniClusterType miniClusterType) throws Exception {
- final JobExecutorService jobExecutorService;
+ private void startJobExecutorService(MiniClusterType miniClusterType) throws Exception {
switch (miniClusterType) {
case OLD:
- jobExecutorService = startOldMiniCluster();
+ startOldMiniCluster();
break;
case FLIP6:
- jobExecutorService = startFlip6MiniCluster();
+ startFlip6MiniCluster();
break;
default:
throw new FlinkRuntimeException("Unknown MiniClusterType " + miniClusterType + '.');
}
-
- return jobExecutorService;
}
- private JobExecutorService startOldMiniCluster() throws Exception {
+ private void startOldMiniCluster() throws Exception {
final Configuration configuration = new Configuration(miniClusterResourceConfiguration.getConfiguration());
configuration.setInteger(ConfigConstants.LOCAL_NUMBER_TASK_MANAGER, miniClusterResourceConfiguration.getNumberTaskManagers());
configuration.setInteger(ConfigConstants.TASK_MANAGER_NUM_TASK_SLOTS, miniClusterResourceConfiguration.getNumberSlotsPerTaskManager());
- return TestBaseUtils.startCluster(
+ final LocalFlinkMiniCluster flinkMiniCluster = TestBaseUtils.startCluster(
configuration,
true);
+
+ jobExecutorService = flinkMiniCluster;
+ clusterClient = new StandaloneClusterClient(configuration, flinkMiniCluster.highAvailabilityServices());
}
- @Nonnull
- private JobExecutorService startFlip6MiniCluster() throws Exception {
+ private void startFlip6MiniCluster() throws Exception {
final Configuration configuration = miniClusterResourceConfiguration.getConfiguration();
// we need to set this since a lot of test expect this because TestBaseUtils.startCluster()
@@ -165,7 +187,8 @@ public class MiniClusterResource extends ExternalResource {
// update the port of the rest endpoint
configuration.setInteger(RestOptions.REST_PORT, miniCluster.getRestAddress().getPort());
- return miniCluster;
+ jobExecutorService = miniCluster;
+ clusterClient = new MiniClusterClient(configuration, miniCluster);
}
/**
[09/12] flink git commit: [hotfix] Let
AbstractEventTimeWindowCheckpointingITCase shutdown ZooKeeper after
MiniCluster
Posted by tr...@apache.org.
[hotfix] Let AbstractEventTimeWindowCheckpointingITCase shutdown ZooKeeper after MiniCluster
Project: http://git-wip-us.apache.org/repos/asf/flink/repo
Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/8485912f
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/8485912f
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/8485912f
Branch: refs/heads/release-1.5
Commit: 8485912f807b8bc43c46fe785ec16a56d9253b5a
Parents: ea920ef
Author: Till Rohrmann <tr...@apache.org>
Authored: Thu Mar 1 19:03:35 2018 +0100
Committer: Till Rohrmann <tr...@apache.org>
Committed: Fri Mar 2 08:53:51 2018 +0100
----------------------------------------------------------------------
...AbstractEventTimeWindowCheckpointingITCase.java | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flink/blob/8485912f/flink-tests/src/test/java/org/apache/flink/test/checkpointing/AbstractEventTimeWindowCheckpointingITCase.java
----------------------------------------------------------------------
diff --git a/flink-tests/src/test/java/org/apache/flink/test/checkpointing/AbstractEventTimeWindowCheckpointingITCase.java b/flink-tests/src/test/java/org/apache/flink/test/checkpointing/AbstractEventTimeWindowCheckpointingITCase.java
index f37ba0d..61baefa 100644
--- a/flink-tests/src/test/java/org/apache/flink/test/checkpointing/AbstractEventTimeWindowCheckpointingITCase.java
+++ b/flink-tests/src/test/java/org/apache/flink/test/checkpointing/AbstractEventTimeWindowCheckpointingITCase.java
@@ -51,6 +51,7 @@ import org.apache.flink.util.TestLogger;
import org.apache.curator.test.TestingServer;
import org.junit.After;
+import org.junit.Before;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
@@ -87,6 +88,8 @@ public abstract class AbstractEventTimeWindowCheckpointingITCase extends TestLog
private TestingServer zkServer;
+ public MiniClusterResource miniClusterResource;
+
@ClassRule
public static TemporaryFolder tempFolder = new TemporaryFolder();
@@ -95,9 +98,6 @@ public abstract class AbstractEventTimeWindowCheckpointingITCase extends TestLog
private AbstractStateBackend stateBackend;
- @Rule
- public final MiniClusterResource miniClusterResource = getMiniClusterResource();
-
enum StateBackendEnum {
MEM, FILE, ROCKSDB_FULLY_ASYNC, ROCKSDB_INCREMENTAL, ROCKSDB_INCREMENTAL_ZK, MEM_ASYNC, FILE_ASYNC
}
@@ -201,8 +201,19 @@ public abstract class AbstractEventTimeWindowCheckpointingITCase extends TestLog
return config;
}
+ @Before
+ public void setupTestCluster() throws Exception {
+ miniClusterResource = getMiniClusterResource();
+ miniClusterResource.before();
+ }
+
@After
public void stopTestCluster() throws IOException {
+ if (miniClusterResource != null) {
+ miniClusterResource.after();
+ miniClusterResource = null;
+ }
+
if (zkServer != null) {
zkServer.stop();
zkServer = null;
[11/12] flink git commit: [hotfix] Let JobLeaderService terminate
leader retrieval services
Posted by tr...@apache.org.
[hotfix] Let JobLeaderService terminate leader retrieval services
Project: http://git-wip-us.apache.org/repos/asf/flink/repo
Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/007cf2b2
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/007cf2b2
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/007cf2b2
Branch: refs/heads/release-1.5
Commit: 007cf2b2ae7ac9c31e04e183fbc0dbe527399d63
Parents: 8485912
Author: Till Rohrmann <tr...@apache.org>
Authored: Thu Mar 1 19:04:15 2018 +0100
Committer: Till Rohrmann <tr...@apache.org>
Committed: Fri Mar 2 08:53:51 2018 +0100
----------------------------------------------------------------------
.../apache/flink/runtime/taskexecutor/JobLeaderService.java | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flink/blob/007cf2b2/flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/JobLeaderService.java
----------------------------------------------------------------------
diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/JobLeaderService.java b/flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/JobLeaderService.java
index 5376362..500d7e4 100644
--- a/flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/JobLeaderService.java
+++ b/flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/JobLeaderService.java
@@ -190,7 +190,12 @@ public class JobLeaderService {
JobLeaderService.JobManagerLeaderListener jobManagerLeaderListener = new JobManagerLeaderListener(jobId);
- jobLeaderServices.put(jobId, Tuple2.of(leaderRetrievalService, jobManagerLeaderListener));
+ final Tuple2<LeaderRetrievalService, JobManagerLeaderListener> oldEntry = jobLeaderServices.put(jobId, Tuple2.of(leaderRetrievalService, jobManagerLeaderListener));
+
+ if (oldEntry != null) {
+ oldEntry.f0.stop();
+ oldEntry.f1.stop();
+ }
leaderRetrievalService.start(jobManagerLeaderListener);
}
[02/12] flink git commit: [FLINK-8811] [flip6] Implement
MiniClusterClient#getJobStatus
Posted by tr...@apache.org.
[FLINK-8811] [flip6] Implement MiniClusterClient#getJobStatus
Project: http://git-wip-us.apache.org/repos/asf/flink/repo
Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/19e4f68b
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/19e4f68b
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/19e4f68b
Branch: refs/heads/release-1.5
Commit: 19e4f68ba9cfbf5d0f54b325db4c5d196d262d09
Parents: f30ca21
Author: Till Rohrmann <tr...@apache.org>
Authored: Wed Feb 28 17:49:29 2018 +0100
Committer: Till Rohrmann <tr...@apache.org>
Committed: Fri Mar 2 08:53:48 2018 +0100
----------------------------------------------------------------------
.../flink/client/program/MiniClusterClient.java | 7 ++++++-
.../flink/runtime/minicluster/MiniCluster.java | 18 ++++++++++++++++++
2 files changed, 24 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flink/blob/19e4f68b/flink-clients/src/main/java/org/apache/flink/client/program/MiniClusterClient.java
----------------------------------------------------------------------
diff --git a/flink-clients/src/main/java/org/apache/flink/client/program/MiniClusterClient.java b/flink-clients/src/main/java/org/apache/flink/client/program/MiniClusterClient.java
index 5baae5b..e99addd 100644
--- a/flink-clients/src/main/java/org/apache/flink/client/program/MiniClusterClient.java
+++ b/flink-clients/src/main/java/org/apache/flink/client/program/MiniClusterClient.java
@@ -26,6 +26,7 @@ import org.apache.flink.runtime.client.JobExecutionException;
import org.apache.flink.runtime.client.JobStatusMessage;
import org.apache.flink.runtime.clusterframework.messages.GetClusterStatusResponse;
import org.apache.flink.runtime.jobgraph.JobGraph;
+import org.apache.flink.runtime.jobgraph.JobStatus;
import org.apache.flink.runtime.leaderretrieval.LeaderRetrievalException;
import org.apache.flink.runtime.messages.Acknowledge;
import org.apache.flink.runtime.minicluster.MiniCluster;
@@ -57,7 +58,7 @@ public class MiniClusterClient extends ClusterClient<MiniClusterClient.MiniClust
}
@Override
- protected JobSubmissionResult submitJob(JobGraph jobGraph, ClassLoader classLoader) throws ProgramInvocationException {
+ public JobSubmissionResult submitJob(JobGraph jobGraph, ClassLoader classLoader) throws ProgramInvocationException {
if (isDetached()) {
try {
miniCluster.runDetached(jobGraph);
@@ -119,6 +120,10 @@ public class MiniClusterClient extends ClusterClient<MiniClusterClient.MiniClust
throw new UnsupportedOperationException("MiniClusterClient does not yet support this operation.");
}
+ public CompletableFuture<JobStatus> getJobStatus(JobID jobId) {
+ return miniCluster.getJobStatus(jobId);
+ }
+
@Override
public MiniClusterClient.MiniClusterId getClusterId() {
return MiniClusterId.INSTANCE;
http://git-wip-us.apache.org/repos/asf/flink/blob/19e4f68b/flink-runtime/src/main/java/org/apache/flink/runtime/minicluster/MiniCluster.java
----------------------------------------------------------------------
diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/minicluster/MiniCluster.java b/flink-runtime/src/main/java/org/apache/flink/runtime/minicluster/MiniCluster.java
index cbfb266..5b086ca 100644
--- a/flink-runtime/src/main/java/org/apache/flink/runtime/minicluster/MiniCluster.java
+++ b/flink-runtime/src/main/java/org/apache/flink/runtime/minicluster/MiniCluster.java
@@ -19,6 +19,7 @@
package org.apache.flink.runtime.minicluster;
import org.apache.flink.api.common.JobExecutionResult;
+import org.apache.flink.api.common.JobID;
import org.apache.flink.api.common.io.FileOutputFormat;
import org.apache.flink.api.common.time.Time;
import org.apache.flink.configuration.Configuration;
@@ -41,6 +42,7 @@ import org.apache.flink.runtime.heartbeat.HeartbeatServices;
import org.apache.flink.runtime.highavailability.HighAvailabilityServices;
import org.apache.flink.runtime.highavailability.HighAvailabilityServicesUtils;
import org.apache.flink.runtime.jobgraph.JobGraph;
+import org.apache.flink.runtime.jobgraph.JobStatus;
import org.apache.flink.runtime.jobmaster.JobResult;
import org.apache.flink.runtime.leaderretrieval.LeaderRetrievalException;
import org.apache.flink.runtime.leaderretrieval.LeaderRetrievalService;
@@ -63,6 +65,7 @@ import org.apache.flink.runtime.webmonitor.retriever.impl.AkkaQueryServiceRetrie
import org.apache.flink.runtime.webmonitor.retriever.impl.RpcGatewayRetriever;
import org.apache.flink.util.AutoCloseableAsync;
import org.apache.flink.util.ExceptionUtils;
+import org.apache.flink.util.FlinkException;
import akka.actor.ActorSystem;
import com.typesafe.config.Config;
@@ -455,6 +458,21 @@ public class MiniCluster implements JobExecutorService, AutoCloseableAsync {
}
// ------------------------------------------------------------------------
+ // Accessing jobs
+ // ------------------------------------------------------------------------
+
+ public CompletableFuture<JobStatus> getJobStatus(JobID jobId) {
+ try {
+ return getDispatcherGateway().requestJobStatus(jobId, rpcTimeout);
+ } catch (LeaderRetrievalException | InterruptedException e) {
+ return FutureUtils.completedExceptionally(
+ new FlinkException(
+ String.format("Could not retrieve job status for job %s", jobId),
+ e));
+ }
+ }
+
+ // ------------------------------------------------------------------------
// running jobs
// ------------------------------------------------------------------------
[05/12] flink git commit: [hotfix] Introduce null checks for
SlotManager#suspend
Posted by tr...@apache.org.
[hotfix] Introduce null checks for SlotManager#suspend
Project: http://git-wip-us.apache.org/repos/asf/flink/repo
Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/15847c4d
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/15847c4d
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/15847c4d
Branch: refs/heads/release-1.5
Commit: 15847c4d9c3155aa9a46498d5cf3a6676e0fa08d
Parents: 29b34e2
Author: Till Rohrmann <tr...@apache.org>
Authored: Thu Mar 1 17:02:29 2018 +0100
Committer: Till Rohrmann <tr...@apache.org>
Committed: Fri Mar 2 08:53:49 2018 +0100
----------------------------------------------------------------------
.../resourcemanager/slotmanager/SlotManager.java | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flink/blob/15847c4d/flink-runtime/src/main/java/org/apache/flink/runtime/resourcemanager/slotmanager/SlotManager.java
----------------------------------------------------------------------
diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/resourcemanager/slotmanager/SlotManager.java b/flink-runtime/src/main/java/org/apache/flink/runtime/resourcemanager/slotmanager/SlotManager.java
index f078a28..ca33719 100644
--- a/flink-runtime/src/main/java/org/apache/flink/runtime/resourcemanager/slotmanager/SlotManager.java
+++ b/flink-runtime/src/main/java/org/apache/flink/runtime/resourcemanager/slotmanager/SlotManager.java
@@ -208,11 +208,15 @@ public class SlotManager implements AutoCloseable {
LOG.info("Suspending the SlotManager.");
// stop the timeout checks for the TaskManagers and the SlotRequests
- taskManagerTimeoutCheck.cancel(false);
- slotRequestTimeoutCheck.cancel(false);
+ if (taskManagerTimeoutCheck != null) {
+ taskManagerTimeoutCheck.cancel(false);
+ taskManagerTimeoutCheck = null;
+ }
- taskManagerTimeoutCheck = null;
- slotRequestTimeoutCheck = null;
+ if (slotRequestTimeoutCheck != null) {
+ slotRequestTimeoutCheck.cancel(false);
+ slotRequestTimeoutCheck = null;
+ }
for (PendingSlotRequest pendingSlotRequest : pendingSlotRequests.values()) {
cancelPendingSlotRequest(pendingSlotRequest);
[04/12] flink git commit: [hotfix] Let ClusterClient only shut down
own HaServices
Posted by tr...@apache.org.
[hotfix] Let ClusterClient only shut down own HaServices
Project: http://git-wip-us.apache.org/repos/asf/flink/repo
Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/40791147
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/40791147
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/40791147
Branch: refs/heads/release-1.5
Commit: 40791147efa2f3ca1c8950ed2646a3ac3a844716
Parents: 15847c4
Author: Till Rohrmann <tr...@apache.org>
Authored: Thu Mar 1 17:05:44 2018 +0100
Committer: Till Rohrmann <tr...@apache.org>
Committed: Fri Mar 2 08:53:49 2018 +0100
----------------------------------------------------------------------
.../apache/flink/client/program/ClusterClient.java | 14 ++++++++++----
.../flink/client/program/MiniClusterClient.java | 2 +-
.../flink/client/program/StandaloneClusterClient.java | 4 ++--
.../flink/client/cli/CliFrontendModifyTest.java | 2 +-
.../flink/client/cli/CliFrontendSavepointTest.java | 5 +++--
.../flink/client/program/ClientConnectionTest.java | 2 +-
.../flink/client/program/ClusterClientTest.java | 4 ++--
.../apache/flink/test/util/MiniClusterResource.java | 2 +-
.../checkpointing/AbstractLocalRecoveryITCase.java | 12 ++++++------
.../flink/test/example/client/JobRetrievalITCase.java | 2 +-
10 files changed, 28 insertions(+), 21 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flink/blob/40791147/flink-clients/src/main/java/org/apache/flink/client/program/ClusterClient.java
----------------------------------------------------------------------
diff --git a/flink-clients/src/main/java/org/apache/flink/client/program/ClusterClient.java b/flink-clients/src/main/java/org/apache/flink/client/program/ClusterClient.java
index e2efbac..1cf2bc2 100644
--- a/flink-clients/src/main/java/org/apache/flink/client/program/ClusterClient.java
+++ b/flink-clients/src/main/java/org/apache/flink/client/program/ClusterClient.java
@@ -117,6 +117,8 @@ public abstract class ClusterClient<T> {
/** Service factory for high available. */
protected final HighAvailabilityServices highAvailabilityServices;
+ private final boolean sharedHaServices;
+
/** Flag indicating whether to sysout print execution updates. */
private boolean printStatusDuringExecution = true;
@@ -144,11 +146,13 @@ public abstract class ClusterClient<T> {
* @throws Exception we cannot create the high availability services
*/
public ClusterClient(Configuration flinkConfig) throws Exception {
- this(flinkConfig,
+ this(
+ flinkConfig,
HighAvailabilityServicesUtils.createHighAvailabilityServices(
flinkConfig,
Executors.directExecutor(),
- HighAvailabilityServicesUtils.AddressResolution.TRY_ADDRESS_RESOLUTION));
+ HighAvailabilityServicesUtils.AddressResolution.TRY_ADDRESS_RESOLUTION),
+ false);
}
/**
@@ -158,8 +162,9 @@ public abstract class ClusterClient<T> {
*
* @param flinkConfig The config used to obtain the job-manager's address, and used to configure the optimizer.
* @param highAvailabilityServices HighAvailabilityServices to use for leader retrieval
+ * @param sharedHaServices true if the HighAvailabilityServices are shared and must not be shut down
*/
- public ClusterClient(Configuration flinkConfig, HighAvailabilityServices highAvailabilityServices) {
+ public ClusterClient(Configuration flinkConfig, HighAvailabilityServices highAvailabilityServices, boolean sharedHaServices) {
this.flinkConfig = Preconditions.checkNotNull(flinkConfig);
this.compiler = new Optimizer(new DataStatistics(), new DefaultCostEstimator(), flinkConfig);
@@ -173,6 +178,7 @@ public abstract class ClusterClient<T> {
log);
this.highAvailabilityServices = Preconditions.checkNotNull(highAvailabilityServices);
+ this.sharedHaServices = sharedHaServices;
}
// ------------------------------------------------------------------------
@@ -265,7 +271,7 @@ public abstract class ClusterClient<T> {
synchronized (this) {
actorSystemLoader.shutdown();
- if (highAvailabilityServices != null) {
+ if (!sharedHaServices && highAvailabilityServices != null) {
highAvailabilityServices.close();
}
}
http://git-wip-us.apache.org/repos/asf/flink/blob/40791147/flink-clients/src/main/java/org/apache/flink/client/program/MiniClusterClient.java
----------------------------------------------------------------------
diff --git a/flink-clients/src/main/java/org/apache/flink/client/program/MiniClusterClient.java b/flink-clients/src/main/java/org/apache/flink/client/program/MiniClusterClient.java
index b98e895..aca75e0 100644
--- a/flink-clients/src/main/java/org/apache/flink/client/program/MiniClusterClient.java
+++ b/flink-clients/src/main/java/org/apache/flink/client/program/MiniClusterClient.java
@@ -52,7 +52,7 @@ public class MiniClusterClient extends ClusterClient<MiniClusterClient.MiniClust
private final MiniCluster miniCluster;
public MiniClusterClient(@Nonnull Configuration configuration, @Nonnull MiniCluster miniCluster) throws Exception {
- super(configuration, miniCluster.getHighAvailabilityServices());
+ super(configuration, miniCluster.getHighAvailabilityServices(), true);
this.miniCluster = miniCluster;
}
http://git-wip-us.apache.org/repos/asf/flink/blob/40791147/flink-clients/src/main/java/org/apache/flink/client/program/StandaloneClusterClient.java
----------------------------------------------------------------------
diff --git a/flink-clients/src/main/java/org/apache/flink/client/program/StandaloneClusterClient.java b/flink-clients/src/main/java/org/apache/flink/client/program/StandaloneClusterClient.java
index 0b91ed4..ee8ad44 100644
--- a/flink-clients/src/main/java/org/apache/flink/client/program/StandaloneClusterClient.java
+++ b/flink-clients/src/main/java/org/apache/flink/client/program/StandaloneClusterClient.java
@@ -47,8 +47,8 @@ public class StandaloneClusterClient extends ClusterClient<StandaloneClusterId>
super(config);
}
- public StandaloneClusterClient(Configuration config, HighAvailabilityServices highAvailabilityServices) {
- super(config, highAvailabilityServices);
+ public StandaloneClusterClient(Configuration config, HighAvailabilityServices highAvailabilityServices, boolean sharedHaServices) {
+ super(config, highAvailabilityServices, sharedHaServices);
}
@Override
http://git-wip-us.apache.org/repos/asf/flink/blob/40791147/flink-clients/src/test/java/org/apache/flink/client/cli/CliFrontendModifyTest.java
----------------------------------------------------------------------
diff --git a/flink-clients/src/test/java/org/apache/flink/client/cli/CliFrontendModifyTest.java b/flink-clients/src/test/java/org/apache/flink/client/cli/CliFrontendModifyTest.java
index 50d87ba..00d5241 100644
--- a/flink-clients/src/test/java/org/apache/flink/client/cli/CliFrontendModifyTest.java
+++ b/flink-clients/src/test/java/org/apache/flink/client/cli/CliFrontendModifyTest.java
@@ -121,7 +121,7 @@ public class CliFrontendModifyTest extends TestLogger {
private final CompletableFuture<Tuple2<JobID, Integer>> rescaleJobFuture;
public TestingClusterClient(CompletableFuture<Tuple2<JobID, Integer>> rescaleJobFuture) throws Exception {
- super(new Configuration(), new TestingHighAvailabilityServices());
+ super(new Configuration(), new TestingHighAvailabilityServices(), false);
this.rescaleJobFuture = rescaleJobFuture;
}
http://git-wip-us.apache.org/repos/asf/flink/blob/40791147/flink-clients/src/test/java/org/apache/flink/client/cli/CliFrontendSavepointTest.java
----------------------------------------------------------------------
diff --git a/flink-clients/src/test/java/org/apache/flink/client/cli/CliFrontendSavepointTest.java b/flink-clients/src/test/java/org/apache/flink/client/cli/CliFrontendSavepointTest.java
index d730344..f4c66eb 100644
--- a/flink-clients/src/test/java/org/apache/flink/client/cli/CliFrontendSavepointTest.java
+++ b/flink-clients/src/test/java/org/apache/flink/client/cli/CliFrontendSavepointTest.java
@@ -138,7 +138,8 @@ public class CliFrontendSavepointTest extends TestLogger {
try {
CliFrontend frontend = new MockedCliFrontend(new StandaloneClusterClient(
new Configuration(),
- new TestingHighAvailabilityServices()));
+ new TestingHighAvailabilityServices(),
+ false));
String[] parameters = { "invalid job id" };
try {
@@ -288,7 +289,7 @@ public class CliFrontendSavepointTest extends TestLogger {
private final BiFunction<String, Time, CompletableFuture<Acknowledge>> disposeSavepointFunction;
DisposeSavepointClusterClient(BiFunction<String, Time, CompletableFuture<Acknowledge>> disposeSavepointFunction) throws Exception {
- super(new Configuration(), new TestingHighAvailabilityServices());
+ super(new Configuration(), new TestingHighAvailabilityServices(), false);
this.disposeSavepointFunction = Preconditions.checkNotNull(disposeSavepointFunction);
}
http://git-wip-us.apache.org/repos/asf/flink/blob/40791147/flink-clients/src/test/java/org/apache/flink/client/program/ClientConnectionTest.java
----------------------------------------------------------------------
diff --git a/flink-clients/src/test/java/org/apache/flink/client/program/ClientConnectionTest.java b/flink-clients/src/test/java/org/apache/flink/client/program/ClientConnectionTest.java
index 1dd4787..2b8abb1 100644
--- a/flink-clients/src/test/java/org/apache/flink/client/program/ClientConnectionTest.java
+++ b/flink-clients/src/test/java/org/apache/flink/client/program/ClientConnectionTest.java
@@ -140,7 +140,7 @@ public class ClientConnectionTest extends TestLogger {
highAvailabilityServices.setJobMasterLeaderRetriever(HighAvailabilityServices.DEFAULT_JOB_ID, settableLeaderRetrievalService);
- StandaloneClusterClient client = new StandaloneClusterClient(configuration, highAvailabilityServices);
+ StandaloneClusterClient client = new StandaloneClusterClient(configuration, highAvailabilityServices, true);
ActorGateway gateway = client.getJobManagerGateway();
http://git-wip-us.apache.org/repos/asf/flink/blob/40791147/flink-clients/src/test/java/org/apache/flink/client/program/ClusterClientTest.java
----------------------------------------------------------------------
diff --git a/flink-clients/src/test/java/org/apache/flink/client/program/ClusterClientTest.java b/flink-clients/src/test/java/org/apache/flink/client/program/ClusterClientTest.java
index e2eb88d..f30fd19 100644
--- a/flink-clients/src/test/java/org/apache/flink/client/program/ClusterClientTest.java
+++ b/flink-clients/src/test/java/org/apache/flink/client/program/ClusterClientTest.java
@@ -71,7 +71,7 @@ public class ClusterClientTest extends TestLogger {
Configuration config = new Configuration();
HighAvailabilityServices highAvailabilityServices = mock(HighAvailabilityServices.class);
- StandaloneClusterClient clusterClient = new StandaloneClusterClient(config, highAvailabilityServices);
+ StandaloneClusterClient clusterClient = new StandaloneClusterClient(config, highAvailabilityServices, false);
clusterClient.shutdown();
@@ -333,7 +333,7 @@ public class ClusterClientTest extends TestLogger {
private final ActorGateway jobmanagerGateway;
TestClusterClient(Configuration config, ActorGateway jobmanagerGateway) throws Exception {
- super(config, new TestingHighAvailabilityServices());
+ super(config, new TestingHighAvailabilityServices(), false);
this.jobmanagerGateway = jobmanagerGateway;
}
http://git-wip-us.apache.org/repos/asf/flink/blob/40791147/flink-test-utils-parent/flink-test-utils/src/main/java/org/apache/flink/test/util/MiniClusterResource.java
----------------------------------------------------------------------
diff --git a/flink-test-utils-parent/flink-test-utils/src/main/java/org/apache/flink/test/util/MiniClusterResource.java b/flink-test-utils-parent/flink-test-utils/src/main/java/org/apache/flink/test/util/MiniClusterResource.java
index a1ce647..954b06f 100644
--- a/flink-test-utils-parent/flink-test-utils/src/main/java/org/apache/flink/test/util/MiniClusterResource.java
+++ b/flink-test-utils-parent/flink-test-utils/src/main/java/org/apache/flink/test/util/MiniClusterResource.java
@@ -161,7 +161,7 @@ public class MiniClusterResource extends ExternalResource {
true);
jobExecutorService = flinkMiniCluster;
- clusterClient = new StandaloneClusterClient(configuration, flinkMiniCluster.highAvailabilityServices());
+ clusterClient = new StandaloneClusterClient(configuration, flinkMiniCluster.highAvailabilityServices(), true);
}
private void startFlip6MiniCluster() throws Exception {
http://git-wip-us.apache.org/repos/asf/flink/blob/40791147/flink-tests/src/test/java/org/apache/flink/test/checkpointing/AbstractLocalRecoveryITCase.java
----------------------------------------------------------------------
diff --git a/flink-tests/src/test/java/org/apache/flink/test/checkpointing/AbstractLocalRecoveryITCase.java b/flink-tests/src/test/java/org/apache/flink/test/checkpointing/AbstractLocalRecoveryITCase.java
index a02e902..13040c9 100644
--- a/flink-tests/src/test/java/org/apache/flink/test/checkpointing/AbstractLocalRecoveryITCase.java
+++ b/flink-tests/src/test/java/org/apache/flink/test/checkpointing/AbstractLocalRecoveryITCase.java
@@ -78,20 +78,20 @@ public abstract class AbstractLocalRecoveryITCase extends TestLogger {
private void executeTest(AbstractEventTimeWindowCheckpointingITCase delegate) throws Exception {
delegate.name = testName;
try {
- delegate.miniClusterResource.before();
+ delegate.setupTestCluster();
try {
delegate.testTumblingTimeWindow();
- delegate.miniClusterResource.after();
+ delegate.stopTestCluster();
} catch (Exception e) {
- delegate.miniClusterResource.after();
+ delegate.stopTestCluster();
}
- delegate.miniClusterResource.before();
+ delegate.setupTestCluster();
try {
delegate.testSlidingTimeWindow();
- delegate.miniClusterResource.after();
+ delegate.stopTestCluster();
} catch (Exception e) {
- delegate.miniClusterResource.after();
+ delegate.stopTestCluster();
}
} finally {
delegate.tempFolder.delete();
http://git-wip-us.apache.org/repos/asf/flink/blob/40791147/flink-tests/src/test/java/org/apache/flink/test/example/client/JobRetrievalITCase.java
----------------------------------------------------------------------
diff --git a/flink-tests/src/test/java/org/apache/flink/test/example/client/JobRetrievalITCase.java b/flink-tests/src/test/java/org/apache/flink/test/example/client/JobRetrievalITCase.java
index 221f3fa..d34b6c33 100644
--- a/flink-tests/src/test/java/org/apache/flink/test/example/client/JobRetrievalITCase.java
+++ b/flink-tests/src/test/java/org/apache/flink/test/example/client/JobRetrievalITCase.java
@@ -79,7 +79,7 @@ public class JobRetrievalITCase extends TestLogger {
final JobGraph jobGraph = new JobGraph(jobID, "testjob", imalock);
- final ClusterClient<StandaloneClusterId> client = new StandaloneClusterClient(cluster.configuration(), cluster.highAvailabilityServices());
+ final ClusterClient<StandaloneClusterId> client = new StandaloneClusterClient(cluster.configuration(), cluster.highAvailabilityServices(), true);
// acquire the lock to make sure that the job cannot complete until the job client
// has been attached in resumingThread
[12/12] flink git commit: [hotfix] Improve logging in ZooKeeper
services
Posted by tr...@apache.org.
[hotfix] Improve logging in ZooKeeper services
Project: http://git-wip-us.apache.org/repos/asf/flink/repo
Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/81aa5ace
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/81aa5ace
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/81aa5ace
Branch: refs/heads/release-1.5
Commit: 81aa5aceef45ecb4e07125259f749785eb66a64a
Parents: 007cf2b
Author: Till Rohrmann <tr...@apache.org>
Authored: Thu Mar 1 19:04:53 2018 +0100
Committer: Till Rohrmann <tr...@apache.org>
Committed: Fri Mar 2 08:53:52 2018 +0100
----------------------------------------------------------------------
.../apache/flink/runtime/dispatcher/Dispatcher.java | 2 ++
.../zookeeper/ZooKeeperHaServices.java | 6 ++++++
.../ZooKeeperLeaderRetrievalService.java | 7 +++++--
.../apache/flink/runtime/minicluster/MiniCluster.java | 14 +++++++-------
.../flink/runtime/taskexecutor/TaskExecutor.java | 5 +++--
5 files changed, 23 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flink/blob/81aa5ace/flink-runtime/src/main/java/org/apache/flink/runtime/dispatcher/Dispatcher.java
----------------------------------------------------------------------
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 bb60277..7a11cf0 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
@@ -194,6 +194,8 @@ public abstract class Dispatcher extends FencedRpcEndpoint<DispatcherId> impleme
if (exception != null) {
throw exception;
+ } else {
+ log.info("Stopped dispatcher {}.", getAddress());
}
});
}
http://git-wip-us.apache.org/repos/asf/flink/blob/81aa5ace/flink-runtime/src/main/java/org/apache/flink/runtime/highavailability/zookeeper/ZooKeeperHaServices.java
----------------------------------------------------------------------
diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/highavailability/zookeeper/ZooKeeperHaServices.java b/flink-runtime/src/main/java/org/apache/flink/runtime/highavailability/zookeeper/ZooKeeperHaServices.java
index 6d5c721..3882479 100644
--- a/flink-runtime/src/main/java/org/apache/flink/runtime/highavailability/zookeeper/ZooKeeperHaServices.java
+++ b/flink-runtime/src/main/java/org/apache/flink/runtime/highavailability/zookeeper/ZooKeeperHaServices.java
@@ -34,6 +34,8 @@ import org.apache.flink.runtime.util.ZooKeeperUtils;
import org.apache.flink.util.ExceptionUtils;
import org.apache.curator.framework.CuratorFramework;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.util.concurrent.Executor;
@@ -80,6 +82,8 @@ import static org.apache.flink.util.Preconditions.checkNotNull;
*/
public class ZooKeeperHaServices implements HighAvailabilityServices {
+ private static final Logger LOG = LoggerFactory.getLogger(ZooKeeperHaServices.class);
+
private static final String RESOURCE_MANAGER_LEADER_PATH = "/resource_manager_lock";
private static final String DISPATCHER_LEADER_PATH = "/dispatcher_lock";
@@ -211,6 +215,8 @@ public class ZooKeeperHaServices implements HighAvailabilityServices {
@Override
public void closeAndCleanupAllData() throws Exception {
+ LOG.info("Close and clean up all data for ZooKeeperHaServices.");
+
Throwable exception = null;
try {
http://git-wip-us.apache.org/repos/asf/flink/blob/81aa5ace/flink-runtime/src/main/java/org/apache/flink/runtime/leaderretrieval/ZooKeeperLeaderRetrievalService.java
----------------------------------------------------------------------
diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/leaderretrieval/ZooKeeperLeaderRetrievalService.java b/flink-runtime/src/main/java/org/apache/flink/runtime/leaderretrieval/ZooKeeperLeaderRetrievalService.java
index 00ba66c..fd0ea82 100644
--- a/flink-runtime/src/main/java/org/apache/flink/runtime/leaderretrieval/ZooKeeperLeaderRetrievalService.java
+++ b/flink-runtime/src/main/java/org/apache/flink/runtime/leaderretrieval/ZooKeeperLeaderRetrievalService.java
@@ -55,6 +55,8 @@ public class ZooKeeperLeaderRetrievalService implements LeaderRetrievalService,
/** Curator recipe to watch changes of a specific ZooKeeper node. */
private final NodeCache cache;
+ private final String retrievalPath;
+
/** Listener which will be notified about leader changes. */
private volatile LeaderRetrievalListener leaderListener;
@@ -80,6 +82,7 @@ public class ZooKeeperLeaderRetrievalService implements LeaderRetrievalService,
public ZooKeeperLeaderRetrievalService(CuratorFramework client, String retrievalPath) {
this.client = Preconditions.checkNotNull(client, "CuratorFramework client");
this.cache = new NodeCache(client, retrievalPath);
+ this.retrievalPath = Preconditions.checkNotNull(retrievalPath);
this.leaderListener = null;
this.lastLeaderAddress = null;
@@ -94,7 +97,7 @@ public class ZooKeeperLeaderRetrievalService implements LeaderRetrievalService,
Preconditions.checkState(leaderListener == null, "ZooKeeperLeaderRetrievalService can " +
"only be started once.");
- LOG.info("Starting ZooKeeperLeaderRetrievalService.");
+ LOG.info("Starting ZooKeeperLeaderRetrievalService {}.", retrievalPath);
synchronized (lock) {
leaderListener = listener;
@@ -111,7 +114,7 @@ public class ZooKeeperLeaderRetrievalService implements LeaderRetrievalService,
@Override
public void stop() throws Exception {
- LOG.info("Stopping ZooKeeperLeaderRetrievalService.");
+ LOG.info("Stopping ZooKeeperLeaderRetrievalService {}.", retrievalPath);
synchronized (lock) {
if (!running) {
http://git-wip-us.apache.org/repos/asf/flink/blob/81aa5ace/flink-runtime/src/main/java/org/apache/flink/runtime/minicluster/MiniCluster.java
----------------------------------------------------------------------
diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/minicluster/MiniCluster.java b/flink-runtime/src/main/java/org/apache/flink/runtime/minicluster/MiniCluster.java
index 2efdb03..6b5f9b5 100644
--- a/flink-runtime/src/main/java/org/apache/flink/runtime/minicluster/MiniCluster.java
+++ b/flink-runtime/src/main/java/org/apache/flink/runtime/minicluster/MiniCluster.java
@@ -401,13 +401,6 @@ public class MiniCluster implements JobExecutorService, AutoCloseableAsync {
final int numComponents = 2 + miniClusterConfiguration.getNumTaskManagers();
final Collection<CompletableFuture<Void>> componentTerminationFutures = new ArrayList<>(numComponents);
- componentTerminationFutures.add(shutDownDispatcher());
-
- if (resourceManagerRunner != null) {
- componentTerminationFutures.add(resourceManagerRunner.closeAsync());
- resourceManagerRunner = null;
- }
-
if (taskManagers != null) {
for (TaskExecutor tm : taskManagers) {
if (tm != null) {
@@ -418,6 +411,13 @@ public class MiniCluster implements JobExecutorService, AutoCloseableAsync {
taskManagers = null;
}
+ componentTerminationFutures.add(shutDownDispatcher());
+
+ if (resourceManagerRunner != null) {
+ componentTerminationFutures.add(resourceManagerRunner.closeAsync());
+ resourceManagerRunner = null;
+ }
+
final FutureUtils.ConjunctFuture<Void> componentsTerminationFuture = FutureUtils.completeAll(componentTerminationFutures);
final CompletableFuture<Void> metricRegistryTerminationFuture = FutureUtils.runAfterwards(
http://git-wip-us.apache.org/repos/asf/flink/blob/81aa5ace/flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/TaskExecutor.java
----------------------------------------------------------------------
diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/TaskExecutor.java b/flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/TaskExecutor.java
index 956a319..cab686a 100644
--- a/flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/TaskExecutor.java
+++ b/flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/TaskExecutor.java
@@ -259,7 +259,7 @@ public class TaskExecutor extends RpcEndpoint implements TaskExecutorGateway {
*/
@Override
public CompletableFuture<Void> postStop() {
- log.info("Stopping TaskManager {}.", getAddress());
+ log.info("Stopping TaskExecutor {}.", getAddress());
Throwable throwable = null;
@@ -294,6 +294,7 @@ public class TaskExecutor extends RpcEndpoint implements TaskExecutorGateway {
if (throwable != null) {
return FutureUtils.completedExceptionally(new FlinkException("Error while shutting the TaskExecutor down.", throwable));
} else {
+ log.info("Stopped TaskExecutor {}.", getAddress());
return CompletableFuture.completedFuture(null);
}
}
@@ -1333,7 +1334,7 @@ public class TaskExecutor extends RpcEndpoint implements TaskExecutorGateway {
*/
void onFatalError(final Throwable t) {
try {
- log.error("Fatal error occurred in TaskExecutor.", t);
+ log.error("Fatal error occurred in TaskExecutor {}.", getAddress(), t);
} catch (Throwable ignored) {}
// The fatal error handler implementation should make sure that this call is non-blocking