public class MiniCluster extends Object implements JobExecutorService, org.apache.flink.util.AutoCloseableAsync
Modifier and Type | Class and Description |
---|---|
protected static class |
MiniCluster.CommonRpcServiceFactory
Factory which returns always the common
RpcService . |
protected class |
MiniCluster.DedicatedRpcServiceFactory
Factory which creates and registers new
RpcService . |
protected static interface |
MiniCluster.RpcServiceFactory
Internal factory for
RpcService . |
Constructor and Description |
---|
MiniCluster(MiniClusterConfiguration miniClusterConfiguration)
Creates a new Flink mini cluster based on the given configuration.
|
Modifier and Type | Method and Description |
---|---|
CompletableFuture<Acknowledge> |
cancelJob(org.apache.flink.api.common.JobID jobId) |
CompletableFuture<Void> |
closeAsync()
Shuts down the mini cluster, failing all currently executing jobs.
|
protected Collection<? extends DispatcherResourceManagerComponent> |
createDispatcherResourceManagerComponents(org.apache.flink.configuration.Configuration configuration,
MiniCluster.RpcServiceFactory rpcServiceFactory,
HighAvailabilityServices haServices,
BlobServer blobServer,
HeartbeatServices heartbeatServices,
MetricRegistry metricRegistry,
MetricQueryServiceRetriever metricQueryServiceRetriever,
FatalErrorHandler fatalErrorHandler) |
protected HighAvailabilityServices |
createHighAvailabilityServices(org.apache.flink.configuration.Configuration configuration,
Executor executor) |
protected RpcService |
createLocalRpcService(org.apache.flink.configuration.Configuration configuration)
Factory method to instantiate the local RPC service.
|
protected MetricRegistryImpl |
createMetricRegistry(org.apache.flink.configuration.Configuration config)
Factory method to create the metric registry for the mini cluster.
|
protected RpcService |
createRemoteRpcService(org.apache.flink.configuration.Configuration configuration,
String bindAddress,
int bindPort)
Factory method to instantiate the remote RPC service.
|
protected RpcService |
createRemoteRpcService(org.apache.flink.configuration.Configuration configuration,
String externalAddress,
String externalPortRange,
String bindAddress)
Factory method to instantiate the remote RPC service.
|
CompletableFuture<CoordinationResponse> |
deliverCoordinationRequestToCoordinator(org.apache.flink.api.common.JobID jobId,
OperatorID operatorId,
org.apache.flink.util.SerializedValue<CoordinationRequest> serializedRequest) |
CompletableFuture<Acknowledge> |
disposeSavepoint(String savepointPath) |
org.apache.flink.api.common.JobExecutionResult |
executeJobBlocking(JobGraph job)
This method runs a job in blocking mode.
|
ClusterInformation |
getClusterInformation() |
protected CompletableFuture<DispatcherGateway> |
getDispatcherGatewayFuture() |
CompletableFuture<? extends AccessExecutionGraph> |
getExecutionGraph(org.apache.flink.api.common.JobID jobId) |
protected Executor |
getIOExecutor() |
CompletableFuture<org.apache.flink.api.common.JobStatus> |
getJobStatus(org.apache.flink.api.common.JobID jobId) |
CompletableFuture<URI> |
getRestAddress() |
boolean |
isRunning()
Checks if the mini cluster was started and is running.
|
CompletableFuture<Collection<JobStatusMessage>> |
listJobs() |
CompletableFuture<ClusterOverview> |
requestClusterOverview() |
CompletableFuture<JobResult> |
requestJobResult(org.apache.flink.api.common.JobID jobId) |
void |
runDetached(JobGraph job)
This method executes a job in detached mode.
|
void |
start()
Starts the mini cluster, based on the configured properties.
|
CompletableFuture<String> |
stopWithSavepoint(org.apache.flink.api.common.JobID jobId,
String targetDirectory,
boolean advanceToEndOfEventTime) |
CompletableFuture<org.apache.flink.api.common.JobSubmissionResult> |
submitJob(JobGraph jobGraph) |
protected CompletableFuture<Void> |
terminateTaskExecutor(int index) |
CompletableFuture<String> |
triggerSavepoint(org.apache.flink.api.common.JobID jobId,
String targetDirectory,
boolean cancelJob) |
protected boolean |
useLocalCommunication() |
public MiniCluster(MiniClusterConfiguration miniClusterConfiguration)
miniClusterConfiguration
- The configuration for the mini clusterpublic CompletableFuture<URI> getRestAddress()
public ClusterInformation getClusterInformation()
protected Executor getIOExecutor()
public boolean isRunning()
public void start() throws Exception
Exception
- This method passes on any exception that occurs during the startup of
the mini cluster.@VisibleForTesting protected Collection<? extends DispatcherResourceManagerComponent> createDispatcherResourceManagerComponents(org.apache.flink.configuration.Configuration configuration, MiniCluster.RpcServiceFactory rpcServiceFactory, HighAvailabilityServices haServices, BlobServer blobServer, HeartbeatServices heartbeatServices, MetricRegistry metricRegistry, MetricQueryServiceRetriever metricQueryServiceRetriever, FatalErrorHandler fatalErrorHandler) throws Exception
Exception
@VisibleForTesting protected HighAvailabilityServices createHighAvailabilityServices(org.apache.flink.configuration.Configuration configuration, Executor executor) throws Exception
Exception
public CompletableFuture<Void> closeAsync()
start()
method again.
This method shuts down all started services and components, even if an exception occurs in the process of shutting down some component.
closeAsync
in interface org.apache.flink.util.AutoCloseableAsync
@VisibleForTesting protected boolean useLocalCommunication()
@VisibleForTesting @Nonnull protected CompletableFuture<Void> terminateTaskExecutor(int index)
public CompletableFuture<Collection<JobStatusMessage>> listJobs()
public CompletableFuture<org.apache.flink.api.common.JobStatus> getJobStatus(org.apache.flink.api.common.JobID jobId)
public CompletableFuture<Acknowledge> cancelJob(org.apache.flink.api.common.JobID jobId)
public CompletableFuture<String> triggerSavepoint(org.apache.flink.api.common.JobID jobId, String targetDirectory, boolean cancelJob)
public CompletableFuture<String> stopWithSavepoint(org.apache.flink.api.common.JobID jobId, String targetDirectory, boolean advanceToEndOfEventTime)
public CompletableFuture<Acknowledge> disposeSavepoint(String savepointPath)
public CompletableFuture<? extends AccessExecutionGraph> getExecutionGraph(org.apache.flink.api.common.JobID jobId)
public CompletableFuture<CoordinationResponse> deliverCoordinationRequestToCoordinator(org.apache.flink.api.common.JobID jobId, OperatorID operatorId, org.apache.flink.util.SerializedValue<CoordinationRequest> serializedRequest)
public void runDetached(JobGraph job) throws JobExecutionException, InterruptedException
job
- The Flink job to executeJobExecutionException
- Thrown if anything went amiss during initial job launch,
or if the job terminally failed.InterruptedException
public org.apache.flink.api.common.JobExecutionResult executeJobBlocking(JobGraph job) throws JobExecutionException, InterruptedException
executeJobBlocking
in interface JobExecutor
job
- The Flink job to executeJobExecutionException
- Thrown if anything went amiss during initial job launch,
or if the job terminally failed.InterruptedException
public CompletableFuture<org.apache.flink.api.common.JobSubmissionResult> submitJob(JobGraph jobGraph)
public CompletableFuture<JobResult> requestJobResult(org.apache.flink.api.common.JobID jobId)
public CompletableFuture<ClusterOverview> requestClusterOverview()
@VisibleForTesting protected CompletableFuture<DispatcherGateway> getDispatcherGatewayFuture()
protected MetricRegistryImpl createMetricRegistry(org.apache.flink.configuration.Configuration config)
config
- The configuration of the mini clusterprotected RpcService createRemoteRpcService(org.apache.flink.configuration.Configuration configuration, String bindAddress, int bindPort) throws Exception
configuration
- Flink configuration.bindAddress
- The address to bind the RPC service to.bindPort
- The port range to bind the RPC service to.Exception
protected RpcService createRemoteRpcService(org.apache.flink.configuration.Configuration configuration, String externalAddress, String externalPortRange, String bindAddress) throws Exception
configuration
- Flink configuration.externalAddress
- The external address to access the RPC service.externalPortRange
- The external port range to access the RPC service.bindAddress
- The address to bind the RPC service to.Exception
protected RpcService createLocalRpcService(org.apache.flink.configuration.Configuration configuration) throws Exception
configuration
- Flink configuration.Exception
Copyright © 2014–2020 The Apache Software Foundation. All rights reserved.