Skip to content

Commit

Permalink
[FLINK-14305] Transfer ownership of JobManagerMetricGroup to Dispatcher
Browse files Browse the repository at this point in the history
With this commit the Dispatcher is now responsible for managing the lifecycle of
the JobManagerMetricGroup.
  • Loading branch information
tillrohrmann committed Oct 2, 2019
1 parent d886509 commit 5c23b74
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,7 @@ public DispatcherResourceManagerComponent<T> create(
resourceManager,
dispatcherLeaderRetrievalService,
resourceManagerRetrievalService,
webMonitorEndpoint,
jobManagerMetricGroup);
webMonitorEndpoint);

} catch (Exception exception) {
// clean up all started components
Expand Down Expand Up @@ -272,6 +271,5 @@ protected abstract DispatcherResourceManagerComponent<T> createDispatcherResourc
ResourceManager<?> resourceManager,
LeaderRetrievalService dispatcherLeaderRetrievalService,
LeaderRetrievalService resourceManagerRetrievalService,
WebMonitorEndpoint<?> webMonitorEndpoint,
JobManagerMetricGroup jobManagerMetricGroup);
WebMonitorEndpoint<?> webMonitorEndpoint);
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import org.apache.flink.runtime.concurrent.FutureUtils;
import org.apache.flink.runtime.dispatcher.Dispatcher;
import org.apache.flink.runtime.leaderretrieval.LeaderRetrievalService;
import org.apache.flink.runtime.metrics.groups.JobManagerMetricGroup;
import org.apache.flink.runtime.resourcemanager.ResourceManager;
import org.apache.flink.runtime.resourcemanager.ResourceManagerGateway;
import org.apache.flink.runtime.webmonitor.WebMonitorEndpoint;
Expand Down Expand Up @@ -58,9 +57,6 @@ public class DispatcherResourceManagerComponent<T extends Dispatcher> implements
@Nonnull
private final WebMonitorEndpoint<?> webMonitorEndpoint;

@Nonnull
private final JobManagerMetricGroup jobManagerMetricGroup;

private final CompletableFuture<Void> terminationFuture;

private final CompletableFuture<ApplicationStatus> shutDownFuture;
Expand All @@ -72,14 +68,12 @@ public class DispatcherResourceManagerComponent<T extends Dispatcher> implements
@Nonnull ResourceManager<?> resourceManager,
@Nonnull LeaderRetrievalService dispatcherLeaderRetrievalService,
@Nonnull LeaderRetrievalService resourceManagerRetrievalService,
@Nonnull WebMonitorEndpoint<?> webMonitorEndpoint,
@Nonnull JobManagerMetricGroup jobManagerMetricGroup) {
@Nonnull WebMonitorEndpoint<?> webMonitorEndpoint) {
this.resourceManager = resourceManager;
this.dispatcher = dispatcher;
this.dispatcherLeaderRetrievalService = dispatcherLeaderRetrievalService;
this.resourceManagerRetrievalService = resourceManagerRetrievalService;
this.webMonitorEndpoint = webMonitorEndpoint;
this.jobManagerMetricGroup = jobManagerMetricGroup;
this.terminationFuture = new CompletableFuture<>();
this.shutDownFuture = new CompletableFuture<>();

Expand Down Expand Up @@ -179,11 +173,7 @@ private CompletableFuture<Void> closeAsyncInternal() {

final CompletableFuture<Void> componentTerminationFuture = FutureUtils.completeAll(terminationFutures);

final CompletableFuture<Void> metricGroupTerminationFuture = FutureUtils.runAfterwards(
componentTerminationFuture,
jobManagerMetricGroup::close);

metricGroupTerminationFuture.whenComplete((aVoid, throwable) -> {
componentTerminationFuture.whenComplete((aVoid, throwable) -> {
if (throwable != null) {
terminationFuture.completeExceptionally(throwable);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import org.apache.flink.runtime.clusterframework.ApplicationStatus;
import org.apache.flink.runtime.dispatcher.MiniDispatcher;
import org.apache.flink.runtime.leaderretrieval.LeaderRetrievalService;
import org.apache.flink.runtime.metrics.groups.JobManagerMetricGroup;
import org.apache.flink.runtime.resourcemanager.ResourceManager;
import org.apache.flink.runtime.webmonitor.WebMonitorEndpoint;

Expand All @@ -38,9 +37,8 @@ class JobDispatcherResourceManagerComponent extends DispatcherResourceManagerCom
ResourceManager<?> resourceManager,
LeaderRetrievalService dispatcherLeaderRetrievalService,
LeaderRetrievalService resourceManagerRetrievalService,
WebMonitorEndpoint<?> webMonitorEndpoint,
JobManagerMetricGroup jobManagerMetricGroup) {
super(dispatcher, resourceManager, dispatcherLeaderRetrievalService, resourceManagerRetrievalService, webMonitorEndpoint, jobManagerMetricGroup);
WebMonitorEndpoint<?> webMonitorEndpoint) {
super(dispatcher, resourceManager, dispatcherLeaderRetrievalService, resourceManagerRetrievalService, webMonitorEndpoint);

final CompletableFuture<ApplicationStatus> shutDownFuture = getShutDownFuture();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import org.apache.flink.runtime.dispatcher.JobDispatcherFactory;
import org.apache.flink.runtime.dispatcher.MiniDispatcher;
import org.apache.flink.runtime.leaderretrieval.LeaderRetrievalService;
import org.apache.flink.runtime.metrics.groups.JobManagerMetricGroup;
import org.apache.flink.runtime.resourcemanager.ResourceManager;
import org.apache.flink.runtime.resourcemanager.ResourceManagerFactory;
import org.apache.flink.runtime.rest.JobRestEndpointFactory;
Expand All @@ -45,14 +44,12 @@ protected DispatcherResourceManagerComponent<MiniDispatcher> createDispatcherRes
ResourceManager<?> resourceManager,
LeaderRetrievalService dispatcherLeaderRetrievalService,
LeaderRetrievalService resourceManagerRetrievalService,
WebMonitorEndpoint<?> webMonitorEndpoint,
JobManagerMetricGroup jobManagerMetricGroup) {
WebMonitorEndpoint<?> webMonitorEndpoint) {
return new JobDispatcherResourceManagerComponent(
dispatcher,
resourceManager,
dispatcherLeaderRetrievalService,
resourceManagerRetrievalService,
webMonitorEndpoint,
jobManagerMetricGroup);
webMonitorEndpoint);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

import org.apache.flink.runtime.dispatcher.Dispatcher;
import org.apache.flink.runtime.leaderretrieval.LeaderRetrievalService;
import org.apache.flink.runtime.metrics.groups.JobManagerMetricGroup;
import org.apache.flink.runtime.resourcemanager.ResourceManager;
import org.apache.flink.runtime.webmonitor.WebMonitorEndpoint;

Expand All @@ -33,8 +32,7 @@ class SessionDispatcherResourceManagerComponent extends DispatcherResourceManage
ResourceManager<?> resourceManager,
LeaderRetrievalService dispatcherLeaderRetrievalService,
LeaderRetrievalService resourceManagerRetrievalService,
WebMonitorEndpoint<?> webMonitorEndpoint,
JobManagerMetricGroup jobManagerMetricGroup) {
super(dispatcher, resourceManager, dispatcherLeaderRetrievalService, resourceManagerRetrievalService, webMonitorEndpoint, jobManagerMetricGroup);
WebMonitorEndpoint<?> webMonitorEndpoint) {
super(dispatcher, resourceManager, dispatcherLeaderRetrievalService, resourceManagerRetrievalService, webMonitorEndpoint);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import org.apache.flink.runtime.dispatcher.DispatcherGateway;
import org.apache.flink.runtime.dispatcher.SessionDispatcherFactory;
import org.apache.flink.runtime.leaderretrieval.LeaderRetrievalService;
import org.apache.flink.runtime.metrics.groups.JobManagerMetricGroup;
import org.apache.flink.runtime.resourcemanager.ResourceManager;
import org.apache.flink.runtime.resourcemanager.ResourceManagerFactory;
import org.apache.flink.runtime.rest.SessionRestEndpointFactory;
Expand Down Expand Up @@ -54,14 +53,12 @@ protected DispatcherResourceManagerComponent<Dispatcher> createDispatcherResourc
ResourceManager<?> resourceManager,
LeaderRetrievalService dispatcherLeaderRetrievalService,
LeaderRetrievalService resourceManagerRetrievalService,
WebMonitorEndpoint<?> webMonitorEndpoint,
JobManagerMetricGroup jobManagerMetricGroup) {
WebMonitorEndpoint<?> webMonitorEndpoint) {
return new SessionDispatcherResourceManagerComponent(
dispatcher,
resourceManager,
dispatcherLeaderRetrievalService,
resourceManagerRetrievalService,
webMonitorEndpoint,
jobManagerMetricGroup);
webMonitorEndpoint);
}
}

0 comments on commit 5c23b74

Please sign in to comment.