public class MiniCluster extends Object implements JobExecutorService, AutoCloseableAsync
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(JobID jobId) |
CompletableFuture<Void> |
closeAsync()
Shuts down the mini cluster, failing all currently executing jobs.
|
protected MetricRegistryImpl |
createMetricRegistry(Configuration config)
Factory method to create the metric registry for the mini cluster.
|
protected RpcService |
createRpcService(Configuration configuration,
Time askTimeout,
boolean remoteEnabled,
String bindAddress)
Factory method to instantiate the RPC service.
|
CompletableFuture<Acknowledge> |
disposeSavepoint(String savepointPath) |
JobExecutionResult |
executeJobBlocking(JobGraph job)
This method runs a job in blocking mode.
|
CompletableFuture<? extends AccessExecutionGraph> |
getExecutionGraph(JobID jobId) |
HighAvailabilityServices |
getHighAvailabilityServices() |
CompletableFuture<JobStatus> |
getJobStatus(JobID jobId) |
URI |
getRestAddress() |
boolean |
isRunning()
Checks if the mini cluster was started and is running.
|
CompletableFuture<Collection<JobStatusMessage>> |
listJobs() |
CompletableFuture<JobResult> |
requestJobResult(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.
|
protected ResourceManagerRunner |
startResourceManager(Configuration configuration,
HighAvailabilityServices haServices,
HeartbeatServices heartbeatServices,
MetricRegistry metricRegistry,
RpcService resourceManagerRpcService,
ClusterInformation clusterInformation,
JobManagerMetricGroup jobManagerMetricGroup) |
protected TaskExecutor[] |
startTaskManagers(Configuration configuration,
HighAvailabilityServices haServices,
HeartbeatServices heartbeatServices,
MetricRegistry metricRegistry,
BlobCacheService blobCacheService,
int numTaskManagers,
RpcService[] taskManagerRpcServices) |
CompletableFuture<Acknowledge> |
stopJob(JobID jobId) |
CompletableFuture<JobSubmissionResult> |
submitJob(JobGraph jobGraph) |
CompletableFuture<String> |
triggerSavepoint(JobID jobId,
String targetDirectory,
boolean cancelJob) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
close
public MiniCluster(MiniClusterConfiguration miniClusterConfiguration)
miniClusterConfiguration
- The configuration for the mini clusterpublic URI getRestAddress()
public HighAvailabilityServices getHighAvailabilityServices()
public boolean isRunning()
public void start() throws Exception
Exception
- This method passes on any exception that occurs during the startup of
the mini cluster.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 AutoCloseableAsync
public CompletableFuture<Collection<JobStatusMessage>> listJobs()
public CompletableFuture<JobStatus> getJobStatus(JobID jobId)
public CompletableFuture<Acknowledge> cancelJob(JobID jobId)
public CompletableFuture<Acknowledge> stopJob(JobID jobId)
public CompletableFuture<String> triggerSavepoint(JobID jobId, String targetDirectory, boolean cancelJob)
public CompletableFuture<Acknowledge> disposeSavepoint(String savepointPath)
public CompletableFuture<? extends AccessExecutionGraph> getExecutionGraph(JobID jobId)
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 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<JobSubmissionResult> submitJob(JobGraph jobGraph)
public CompletableFuture<JobResult> requestJobResult(JobID jobId)
protected MetricRegistryImpl createMetricRegistry(Configuration config)
config
- The configuration of the mini clusterprotected RpcService createRpcService(Configuration configuration, Time askTimeout, boolean remoteEnabled, String bindAddress)
configuration
- The configuration of the mini clusteraskTimeout
- The default RPC timeout for asynchronous "ask" requests.remoteEnabled
- True, if the RPC service should be reachable from other (remote) RPC services.bindAddress
- The address to bind the RPC service to. Only relevant when "remoteEnabled" is true.protected ResourceManagerRunner startResourceManager(Configuration configuration, HighAvailabilityServices haServices, HeartbeatServices heartbeatServices, MetricRegistry metricRegistry, RpcService resourceManagerRpcService, ClusterInformation clusterInformation, JobManagerMetricGroup jobManagerMetricGroup) throws Exception
Exception
protected TaskExecutor[] startTaskManagers(Configuration configuration, HighAvailabilityServices haServices, HeartbeatServices heartbeatServices, MetricRegistry metricRegistry, BlobCacheService blobCacheService, int numTaskManagers, RpcService[] taskManagerRpcServices) throws Exception
Exception
Copyright © 2014–2020 The Apache Software Foundation. All rights reserved.