Class MiniClusterJobClient
- java.lang.Object
-
- org.apache.flink.runtime.minicluster.MiniClusterJobClient
-
- All Implemented Interfaces:
JobClient
,CoordinationRequestGateway
public final class MiniClusterJobClient extends Object implements JobClient, CoordinationRequestGateway
AJobClient
for aMiniCluster
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
MiniClusterJobClient.JobFinalizationBehavior
Determines the behavior of theMiniClusterJobClient
when the job finishes.
-
Constructor Summary
Constructors Constructor Description MiniClusterJobClient(JobID jobID, MiniCluster miniCluster, ClassLoader classLoader, MiniClusterJobClient.JobFinalizationBehavior finalizationBehaviour)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CompletableFuture<Void>
cancel()
Cancels the associated job.CompletableFuture<Map<String,Object>>
getAccumulators()
Requests the accumulators of the associated job.CompletableFuture<JobExecutionResult>
getJobExecutionResult()
Returns theresult of the job execution
of the submitted job.JobID
getJobID()
Returns theJobID
that uniquely identifies the job this client is scoped to.CompletableFuture<JobStatus>
getJobStatus()
Requests theJobStatus
of the associated job.void
reportHeartbeat(long expiredTimestamp)
The client reports the heartbeat to the dispatcher for aliveness.CompletableFuture<CoordinationResponse>
sendCoordinationRequest(OperatorID operatorId, CoordinationRequest request)
Send out a request to a specified coordinator and return the response.CompletableFuture<String>
stopWithSavepoint(boolean terminate, String savepointDirectory, SavepointFormatType formatType)
Stops the associated job on Flink cluster.CompletableFuture<String>
triggerSavepoint(String savepointDirectory, SavepointFormatType formatType)
Triggers a savepoint for the associated job.
-
-
-
Constructor Detail
-
MiniClusterJobClient
public MiniClusterJobClient(JobID jobID, MiniCluster miniCluster, ClassLoader classLoader, MiniClusterJobClient.JobFinalizationBehavior finalizationBehaviour)
Creates aMiniClusterJobClient
for the givenJobID
andMiniCluster
. This will shut down theMiniCluster
after job result retrieval ifshutdownCluster
istrue
.
-
-
Method Detail
-
getJobID
public JobID getJobID()
Description copied from interface:JobClient
Returns theJobID
that uniquely identifies the job this client is scoped to.
-
getJobStatus
public CompletableFuture<JobStatus> getJobStatus()
Description copied from interface:JobClient
Requests theJobStatus
of the associated job.- Specified by:
getJobStatus
in interfaceJobClient
-
cancel
public CompletableFuture<Void> cancel()
Description copied from interface:JobClient
Cancels the associated job.
-
stopWithSavepoint
public CompletableFuture<String> stopWithSavepoint(boolean terminate, @Nullable String savepointDirectory, SavepointFormatType formatType)
Description copied from interface:JobClient
Stops the associated job on Flink cluster.Stopping works only for streaming programs. Be aware, that the job might continue to run for a while after sending the stop command, because after sources stopped to emit data all operators need to finish processing.
- Specified by:
stopWithSavepoint
in interfaceJobClient
- Parameters:
terminate
- flag indicating if the source should inject aMAX_WATERMARK
in the pipelinesavepointDirectory
- directory the savepoint should be written toformatType
- binary format of the savepoint- Returns:
- a
CompletableFuture
containing the path where the savepoint is located
-
triggerSavepoint
public CompletableFuture<String> triggerSavepoint(@Nullable String savepointDirectory, SavepointFormatType formatType)
Description copied from interface:JobClient
Triggers a savepoint for the associated job. The savepoint will be written to the given savepoint directory, orCheckpointingOptions.SAVEPOINT_DIRECTORY
if it is null.- Specified by:
triggerSavepoint
in interfaceJobClient
- Parameters:
savepointDirectory
- directory the savepoint should be written toformatType
- binary format of the savepoint- Returns:
- a
CompletableFuture
containing the path where the savepoint is located
-
getAccumulators
public CompletableFuture<Map<String,Object>> getAccumulators()
Description copied from interface:JobClient
Requests the accumulators of the associated job. Accumulators can be requested while it is running or after it has finished. The class loader is used to deserialize the incoming accumulator results.- Specified by:
getAccumulators
in interfaceJobClient
-
getJobExecutionResult
public CompletableFuture<JobExecutionResult> getJobExecutionResult()
Description copied from interface:JobClient
Returns theresult of the job execution
of the submitted job.- Specified by:
getJobExecutionResult
in interfaceJobClient
-
sendCoordinationRequest
public CompletableFuture<CoordinationResponse> sendCoordinationRequest(OperatorID operatorId, CoordinationRequest request)
Description copied from interface:CoordinationRequestGateway
Send out a request to a specified coordinator and return the response.- Specified by:
sendCoordinationRequest
in interfaceCoordinationRequestGateway
- Parameters:
operatorId
- specifies which coordinator to receive the requestrequest
- the request to send- Returns:
- the response from the coordinator
-
reportHeartbeat
public void reportHeartbeat(long expiredTimestamp)
Description copied from interface:JobClient
The client reports the heartbeat to the dispatcher for aliveness.- Specified by:
reportHeartbeat
in interfaceJobClient
-
-