forked from apache/flink
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[hotfix][tests] Extend TestingMiniCluster to support multiple Dispatc…
…hers and ResourceManagers This commit adds funcationality to the TestingMiniCluster to start multiple Dispatchers and ResourceManagers. This can be used to test HA scenarios.
- Loading branch information
1 parent
a9bcc8b
commit 58d94ae
Showing
14 changed files
with
362 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 75 additions & 0 deletions
75
.../src/test/java/org/apache/flink/runtime/minicluster/SessionDispatcherWithUUIDFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
/* | ||
* 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:https://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.minicluster; | ||
|
||
import org.apache.flink.configuration.Configuration; | ||
import org.apache.flink.runtime.blob.BlobServer; | ||
import org.apache.flink.runtime.dispatcher.ArchivedExecutionGraphStore; | ||
import org.apache.flink.runtime.dispatcher.DefaultJobManagerRunnerFactory; | ||
import org.apache.flink.runtime.dispatcher.Dispatcher; | ||
import org.apache.flink.runtime.dispatcher.DispatcherFactory; | ||
import org.apache.flink.runtime.dispatcher.HistoryServerArchivist; | ||
import org.apache.flink.runtime.dispatcher.StandaloneDispatcher; | ||
import org.apache.flink.runtime.heartbeat.HeartbeatServices; | ||
import org.apache.flink.runtime.highavailability.HighAvailabilityServices; | ||
import org.apache.flink.runtime.metrics.groups.JobManagerMetricGroup; | ||
import org.apache.flink.runtime.resourcemanager.ResourceManagerGateway; | ||
import org.apache.flink.runtime.rpc.FatalErrorHandler; | ||
import org.apache.flink.runtime.rpc.RpcService; | ||
import org.apache.flink.runtime.webmonitor.retriever.GatewayRetriever; | ||
|
||
import javax.annotation.Nullable; | ||
|
||
/** | ||
* {@link DispatcherFactory} which creates a {@link StandaloneDispatcher} which has an | ||
* endpoint id with a random UUID suffix. | ||
*/ | ||
public enum SessionDispatcherWithUUIDFactory implements DispatcherFactory<Dispatcher> { | ||
INSTANCE; | ||
|
||
@Override | ||
public Dispatcher createDispatcher( | ||
Configuration configuration, | ||
RpcService rpcService, | ||
HighAvailabilityServices highAvailabilityServices, | ||
GatewayRetriever<ResourceManagerGateway> resourceManagerGatewayRetriever, | ||
BlobServer blobServer, | ||
HeartbeatServices heartbeatServices, | ||
JobManagerMetricGroup jobManagerMetricGroup, | ||
@Nullable String metricQueryServicePath, | ||
ArchivedExecutionGraphStore archivedExecutionGraphStore, | ||
FatalErrorHandler fatalErrorHandler, | ||
HistoryServerArchivist historyServerArchivist) throws Exception { | ||
// create the default dispatcher | ||
return new StandaloneDispatcher( | ||
rpcService, | ||
generateEndpointIdWithUUID(), | ||
configuration, | ||
highAvailabilityServices, | ||
resourceManagerGatewayRetriever, | ||
blobServer, | ||
heartbeatServices, | ||
jobManagerMetricGroup, | ||
metricQueryServicePath, | ||
archivedExecutionGraphStore, | ||
DefaultJobManagerRunnerFactory.INSTANCE, | ||
fatalErrorHandler, | ||
historyServerArchivist); | ||
} | ||
} |
76 changes: 76 additions & 0 deletions
76
...t/java/org/apache/flink/runtime/minicluster/StandaloneResourceManagerWithUUIDFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/* | ||
* 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:https://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.minicluster; | ||
|
||
import org.apache.flink.configuration.Configuration; | ||
import org.apache.flink.runtime.clusterframework.types.ResourceID; | ||
import org.apache.flink.runtime.entrypoint.ClusterInformation; | ||
import org.apache.flink.runtime.heartbeat.HeartbeatServices; | ||
import org.apache.flink.runtime.highavailability.HighAvailabilityServices; | ||
import org.apache.flink.runtime.metrics.MetricRegistry; | ||
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.resourcemanager.ResourceManagerRuntimeServices; | ||
import org.apache.flink.runtime.resourcemanager.ResourceManagerRuntimeServicesConfiguration; | ||
import org.apache.flink.runtime.resourcemanager.StandaloneResourceManager; | ||
import org.apache.flink.runtime.rpc.FatalErrorHandler; | ||
import org.apache.flink.runtime.rpc.RpcService; | ||
|
||
import javax.annotation.Nullable; | ||
|
||
/** | ||
* {@link ResourceManagerFactory} which starts the {@link ResourceManager} with an endpoint id which | ||
* has a random UUID suffix. | ||
*/ | ||
public enum StandaloneResourceManagerWithUUIDFactory implements ResourceManagerFactory<ResourceID> { | ||
INSTANCE; | ||
|
||
@Override | ||
public ResourceManager<ResourceID> createResourceManager( | ||
Configuration configuration, | ||
ResourceID resourceId, | ||
RpcService rpcService, | ||
HighAvailabilityServices highAvailabilityServices, | ||
HeartbeatServices heartbeatServices, | ||
MetricRegistry metricRegistry, | ||
FatalErrorHandler fatalErrorHandler, | ||
ClusterInformation clusterInformation, | ||
@Nullable String webInterfaceUrl, | ||
JobManagerMetricGroup jobManagerMetricGroup) throws Exception { | ||
final ResourceManagerRuntimeServicesConfiguration resourceManagerRuntimeServicesConfiguration = ResourceManagerRuntimeServicesConfiguration.fromConfiguration(configuration); | ||
final ResourceManagerRuntimeServices resourceManagerRuntimeServices = ResourceManagerRuntimeServices.fromConfiguration( | ||
resourceManagerRuntimeServicesConfiguration, | ||
highAvailabilityServices, | ||
rpcService.getScheduledExecutor()); | ||
|
||
return new StandaloneResourceManager( | ||
rpcService, | ||
generateEndpointIdWithUUID(), | ||
resourceId, | ||
highAvailabilityServices, | ||
heartbeatServices, | ||
resourceManagerRuntimeServices.getSlotManager(), | ||
metricRegistry, | ||
resourceManagerRuntimeServices.getJobLeaderIdService(), | ||
clusterInformation, | ||
fatalErrorHandler, | ||
jobManagerMetricGroup); | ||
} | ||
} |
Oops, something went wrong.