public class MiniClusterClient extends Object implements ClusterClient<MiniClusterClient.MiniClusterId>
MiniCluster
.Modifier and Type | Class and Description |
---|---|
static class |
MiniClusterClient.MiniClusterId
The type of the Cluster ID for the local
MiniCluster . |
Constructor and Description |
---|
MiniClusterClient(Configuration configuration,
MiniCluster miniCluster) |
Modifier and Type | Method and Description |
---|---|
CompletableFuture<Acknowledge> |
cancel(JobID jobId)
Cancels a job identified by the job id.
|
CompletableFuture<String> |
cancelWithSavepoint(JobID jobId,
String savepointDirectory,
SavepointFormatType formatType)
Cancels a job identified by the job id and triggers a savepoint.
|
void |
close() |
CompletableFuture<Acknowledge> |
disposeSavepoint(String savepointPath)
Dispose the savepoint under the given path.
|
CompletableFuture<Map<String,Object>> |
getAccumulators(JobID jobID,
ClassLoader loader)
Requests and returns the accumulators for the given job identifier.
|
MiniClusterClient.MiniClusterId |
getClusterId()
Returns the cluster id identifying the cluster to which the client is connected.
|
Configuration |
getFlinkConfiguration()
Return the Flink configuration object.
|
CompletableFuture<JobStatus> |
getJobStatus(JobID jobId)
|
String |
getWebInterfaceURL()
Returns an URL (as a string) to the cluster web interface.
|
CompletableFuture<Void> |
invalidateClusterDataset(AbstractID clusterDatasetId)
Invalidate the cached intermediate dataset with the given id.
|
CompletableFuture<Set<AbstractID>> |
listCompletedClusterDatasetIds()
Return a set of ids of the completed cluster datasets.
|
CompletableFuture<Collection<JobStatusMessage>> |
listJobs()
Lists the currently running and finished jobs on the cluster.
|
CompletableFuture<Void> |
reportHeartbeat(JobID jobId,
long expiredTimestamp)
The client reports the heartbeat to the dispatcher for aliveness.
|
CompletableFuture<JobResult> |
requestJobResult(JobID jobId)
|
CompletableFuture<CoordinationResponse> |
sendCoordinationRequest(JobID jobId,
OperatorID operatorId,
CoordinationRequest request)
Sends out a request to a specified coordinator and return the response.
|
void |
shutDownCluster()
Shut down the cluster that this client communicate with.
|
CompletableFuture<String> |
stopWithSavepoint(JobID jobId,
boolean advanceToEndOfEventTime,
String savepointDirectory,
SavepointFormatType formatType)
Stops a program on Flink cluster whose job-manager is configured in this client's
configuration.
|
CompletableFuture<JobID> |
submitJob(JobGraph jobGraph)
Submit the given
JobGraph to the cluster. |
CompletableFuture<String> |
triggerSavepoint(JobID jobId,
String savepointDirectory,
SavepointFormatType formatType)
Triggers a savepoint for the job identified by the job id.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getAccumulators
public MiniClusterClient(@Nonnull Configuration configuration, @Nonnull MiniCluster miniCluster)
public Configuration getFlinkConfiguration()
ClusterClient
getFlinkConfiguration
in interface ClusterClient<MiniClusterClient.MiniClusterId>
public CompletableFuture<JobID> submitJob(@Nonnull JobGraph jobGraph)
ClusterClient
JobGraph
to the cluster.submitJob
in interface ClusterClient<MiniClusterClient.MiniClusterId>
jobGraph
- to submitJobID
of the submitted jobpublic CompletableFuture<JobResult> requestJobResult(@Nonnull JobID jobId)
ClusterClient
requestJobResult
in interface ClusterClient<MiniClusterClient.MiniClusterId>
jobId
- for which to request the JobResult
JobResult
public CompletableFuture<Acknowledge> cancel(JobID jobId)
ClusterClient
cancel
in interface ClusterClient<MiniClusterClient.MiniClusterId>
jobId
- the job idpublic CompletableFuture<String> cancelWithSavepoint(JobID jobId, @Nullable String savepointDirectory, SavepointFormatType formatType)
ClusterClient
cancelWithSavepoint
in interface ClusterClient<MiniClusterClient.MiniClusterId>
jobId
- the job idsavepointDirectory
- directory the savepoint should be written toformatType
- a binary format of the savepointpublic CompletableFuture<String> stopWithSavepoint(JobID jobId, boolean advanceToEndOfEventTime, @Nullable String savepointDirectory, SavepointFormatType formatType)
ClusterClient
stopWithSavepoint
in interface ClusterClient<MiniClusterClient.MiniClusterId>
jobId
- the job ID of the streaming program to stopadvanceToEndOfEventTime
- flag indicating if the source should inject a MAX_WATERMARK
in the pipelinesavepointDirectory
- directory the savepoint should be written toformatType
- a binary format of the savepointCompletableFuture
containing the path where the savepoint is locatedpublic CompletableFuture<String> triggerSavepoint(JobID jobId, @Nullable String savepointDirectory, SavepointFormatType formatType)
ClusterClient
CheckpointingOptions.SAVEPOINT_DIRECTORY
if it is null.triggerSavepoint
in interface ClusterClient<MiniClusterClient.MiniClusterId>
jobId
- job idsavepointDirectory
- directory the savepoint should be written toformatType
- a binary format of the savepointpublic CompletableFuture<Acknowledge> disposeSavepoint(String savepointPath)
ClusterClient
disposeSavepoint
in interface ClusterClient<MiniClusterClient.MiniClusterId>
savepointPath
- path to the savepoint to be disposedpublic CompletableFuture<Collection<JobStatusMessage>> listJobs()
ClusterClient
listJobs
in interface ClusterClient<MiniClusterClient.MiniClusterId>
public CompletableFuture<Map<String,Object>> getAccumulators(JobID jobID, ClassLoader loader)
ClusterClient
getAccumulators
in interface ClusterClient<MiniClusterClient.MiniClusterId>
jobID
- The job identifier of a job.loader
- The class loader for deserializing the accumulator results.public CompletableFuture<JobStatus> getJobStatus(JobID jobId)
ClusterClient
getJobStatus
in interface ClusterClient<MiniClusterClient.MiniClusterId>
public void close()
close
in interface AutoCloseable
close
in interface ClusterClient<MiniClusterClient.MiniClusterId>
public MiniClusterClient.MiniClusterId getClusterId()
ClusterClient
getClusterId
in interface ClusterClient<MiniClusterClient.MiniClusterId>
public void shutDownCluster()
ClusterClient
shutDownCluster
in interface ClusterClient<MiniClusterClient.MiniClusterId>
public String getWebInterfaceURL()
ClusterClient
getWebInterfaceURL
in interface ClusterClient<MiniClusterClient.MiniClusterId>
public CompletableFuture<CoordinationResponse> sendCoordinationRequest(JobID jobId, OperatorID operatorId, CoordinationRequest request)
ClusterClient
sendCoordinationRequest
in interface ClusterClient<MiniClusterClient.MiniClusterId>
jobId
- specifies the job which the coordinator belongs tooperatorId
- specifies which coordinator to receive the requestrequest
- the request to sendpublic CompletableFuture<Set<AbstractID>> listCompletedClusterDatasetIds()
ClusterClient
listCompletedClusterDatasetIds
in interface ClusterClient<MiniClusterClient.MiniClusterId>
public CompletableFuture<Void> invalidateClusterDataset(AbstractID clusterDatasetId)
ClusterClient
invalidateClusterDataset
in interface ClusterClient<MiniClusterClient.MiniClusterId>
clusterDatasetId
- id of the cluster dataset to be invalidated.public CompletableFuture<Void> reportHeartbeat(JobID jobId, long expiredTimestamp)
ClusterClient
reportHeartbeat
in interface ClusterClient<MiniClusterClient.MiniClusterId>
jobId
- The jobId for the client and the job.Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.