Interface RestfulGateway
-
- All Superinterfaces:
RpcGateway
- All Known Subinterfaces:
DispatcherGateway
- All Known Implementing Classes:
Dispatcher
,MiniDispatcher
,NonLeaderRetrievalRestfulGateway
,StandaloneDispatcher
public interface RestfulGateway extends RpcGateway
Gateway for restful endpoints.Gateways which implement this method run a REST endpoint which is reachable under the returned address.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description CompletableFuture<Acknowledge>
cancelJob(JobID jobId, Duration timeout)
Cancel the given job.default CompletableFuture<CoordinationResponse>
deliverCoordinationRequestToCoordinator(JobID jobId, String operatorUid, SerializedValue<CoordinationRequest> serializedRequest, Duration timeout)
Deliver a coordination request to a specified coordinator and return the response.default CompletableFuture<Acknowledge>
disposeSavepoint(String savepointPath, Duration timeout)
Dispose the given savepoint.default CompletableFuture<OperationResult<Long>>
getTriggeredCheckpointStatus(AsynchronousJobOperationKey operationKey)
Get the status of a checkpoint triggered under the specified operation key.default CompletableFuture<OperationResult<String>>
getTriggeredSavepointStatus(AsynchronousJobOperationKey operationKey)
Get the status of a savepoint triggered under the specified operation key.default CompletableFuture<Void>
reportJobClientHeartbeat(JobID jobId, long expiredTimestamp, Duration timeout)
The client reports the heartbeat to the dispatcher for aliveness.CompletableFuture<CheckpointStatsSnapshot>
requestCheckpointStats(JobID jobId, Duration timeout)
Requests theCheckpointStatsSnapshot
containing checkpointing information.CompletableFuture<ClusterOverview>
requestClusterOverview(Duration timeout)
Requests the cluster status overview.CompletableFuture<ExecutionGraphInfo>
requestExecutionGraphInfo(JobID jobId, Duration timeout)
Requests theExecutionGraphInfo
containing additional information besides theArchivedExecutionGraph
.default CompletableFuture<ArchivedExecutionGraph>
requestJob(JobID jobId, Duration timeout)
Requests theArchivedExecutionGraph
for the given jobId.default CompletableFuture<JobResourceRequirements>
requestJobResourceRequirements(JobID jobId)
Read currentjob resource requirements
for a given job.CompletableFuture<JobResult>
requestJobResult(JobID jobId, Duration timeout)
Requests theJobResult
of a job specified by the given jobId.default CompletableFuture<JobStatus>
requestJobStatus(JobID jobId, Duration timeout)
Request theJobStatus
of the given job.CompletableFuture<Collection<String>>
requestMetricQueryServiceAddresses(Duration timeout)
Requests the addresses of theMetricQueryService
to query.CompletableFuture<MultipleJobsDetails>
requestMultipleJobDetails(Duration timeout)
Requests job details currently being executed on the Flink cluster.CompletableFuture<Collection<Tuple2<ResourceID,String>>>
requestTaskManagerMetricQueryServiceAddresses(Duration timeout)
Requests the addresses for the TaskManagers'MetricQueryService
to query.CompletableFuture<ThreadDumpInfo>
requestThreadDump(Duration timeout)
Requests the thread dump from the JobManager.default CompletableFuture<Acknowledge>
shutDownCluster()
default CompletableFuture<Acknowledge>
stopWithSavepoint(AsynchronousJobOperationKey operationKey, String targetDirectory, SavepointFormatType formatType, TriggerSavepointMode savepointMode, Duration timeout)
Stops the job with a savepoint, returning a future that completes when the operation is started.default CompletableFuture<Acknowledge>
triggerCheckpoint(AsynchronousJobOperationKey operationKey, CheckpointType checkpointType, Duration timeout)
Triggers a checkpoint with the given savepoint directory as a target.default CompletableFuture<Acknowledge>
triggerSavepoint(AsynchronousJobOperationKey operationKey, String targetDirectory, SavepointFormatType formatType, TriggerSavepointMode savepointMode, Duration timeout)
Triggers a savepoint with the given savepoint directory as a target, returning a future that completes when the operation is started.default CompletableFuture<Acknowledge>
updateJobResourceRequirements(JobID jobId, JobResourceRequirements jobResourceRequirements)
Updatejob resource requirements
for a given job.-
Methods inherited from interface org.apache.flink.runtime.rpc.RpcGateway
getAddress, getHostname
-
-
-
-
Method Detail
-
cancelJob
CompletableFuture<Acknowledge> cancelJob(JobID jobId, Duration timeout)
Cancel the given job.- Parameters:
jobId
- identifying the job to canceltimeout
- of the operation- Returns:
- A future acknowledge if the cancellation succeeded
-
requestJob
default CompletableFuture<ArchivedExecutionGraph> requestJob(JobID jobId, Duration timeout)
Requests theArchivedExecutionGraph
for the given jobId. If there is no such graph, then the future is completed with aFlinkJobNotFoundException
.- Parameters:
jobId
- identifying the job whoseArchivedExecutionGraph
is requestedtimeout
- for the asynchronous operation- Returns:
- Future containing the
ArchivedExecutionGraph
for the given jobId, otherwiseFlinkJobNotFoundException
-
requestExecutionGraphInfo
CompletableFuture<ExecutionGraphInfo> requestExecutionGraphInfo(JobID jobId, Duration timeout)
Requests theExecutionGraphInfo
containing additional information besides theArchivedExecutionGraph
. If there is no such graph, then the future is completed with aFlinkJobNotFoundException
.- Parameters:
jobId
- identifying the job whoseExecutionGraphInfo
is requestedtimeout
- for the asynchronous operation- Returns:
- Future containing the
ExecutionGraphInfo
for the given jobId, otherwiseFlinkJobNotFoundException
-
requestCheckpointStats
CompletableFuture<CheckpointStatsSnapshot> requestCheckpointStats(JobID jobId, Duration timeout)
Requests theCheckpointStatsSnapshot
containing checkpointing information.- Parameters:
jobId
- identifying the job whoseCheckpointStatsSnapshot
is requestedtimeout
- for the asynchronous operation- Returns:
- Future containing the
CheckpointStatsSnapshot
for the given jobId
-
requestJobResult
CompletableFuture<JobResult> requestJobResult(JobID jobId, Duration timeout)
Requests theJobResult
of a job specified by the given jobId.
-
requestMultipleJobDetails
CompletableFuture<MultipleJobsDetails> requestMultipleJobDetails(Duration timeout)
Requests job details currently being executed on the Flink cluster.- Parameters:
timeout
- for the asynchronous operation- Returns:
- Future containing the job details
-
requestClusterOverview
CompletableFuture<ClusterOverview> requestClusterOverview(Duration timeout)
Requests the cluster status overview.- Parameters:
timeout
- for the asynchronous operation- Returns:
- Future containing the status overview
-
requestMetricQueryServiceAddresses
CompletableFuture<Collection<String>> requestMetricQueryServiceAddresses(Duration timeout)
Requests the addresses of theMetricQueryService
to query.- Parameters:
timeout
- for the asynchronous operation- Returns:
- Future containing the collection of metric query service addresses to query
-
requestTaskManagerMetricQueryServiceAddresses
CompletableFuture<Collection<Tuple2<ResourceID,String>>> requestTaskManagerMetricQueryServiceAddresses(Duration timeout)
Requests the addresses for the TaskManagers'MetricQueryService
to query.- Parameters:
timeout
- for the asynchronous operation- Returns:
- Future containing the collection of instance ids and the corresponding metric query service address
-
requestThreadDump
CompletableFuture<ThreadDumpInfo> requestThreadDump(Duration timeout)
Requests the thread dump from the JobManager.- Parameters:
timeout
- timeout of the asynchronous operation- Returns:
- Future containing the thread dump information
-
triggerCheckpoint
default CompletableFuture<Acknowledge> triggerCheckpoint(AsynchronousJobOperationKey operationKey, CheckpointType checkpointType, Duration timeout)
Triggers a checkpoint with the given savepoint directory as a target.- Parameters:
operationKey
- the key of the operation, for deduplication purposescheckpointType
- checkpoint backup type (configured / full / incremental)timeout
- Timeout for the asynchronous operation- Returns:
- A future to the
external pointer
of the savepoint.
-
getTriggeredCheckpointStatus
default CompletableFuture<OperationResult<Long>> getTriggeredCheckpointStatus(AsynchronousJobOperationKey operationKey)
Get the status of a checkpoint triggered under the specified operation key.- Parameters:
operationKey
- key of the operation- Returns:
- Future which completes immediately with the status, or fails if no operation is registered for the key
-
triggerSavepoint
default CompletableFuture<Acknowledge> triggerSavepoint(AsynchronousJobOperationKey operationKey, String targetDirectory, SavepointFormatType formatType, TriggerSavepointMode savepointMode, Duration timeout)
Triggers a savepoint with the given savepoint directory as a target, returning a future that completes when the operation is started.- Parameters:
operationKey
- the key of the operation, for deduplication purposestargetDirectory
- Target directory for the savepoint.formatType
- Binary format of the savepoint.savepointMode
- context of the savepoint operationtimeout
- Timeout for the asynchronous operation- Returns:
- Future which is completed once the operation is triggered successfully
-
stopWithSavepoint
default CompletableFuture<Acknowledge> stopWithSavepoint(AsynchronousJobOperationKey operationKey, String targetDirectory, SavepointFormatType formatType, TriggerSavepointMode savepointMode, Duration timeout)
Stops the job with a savepoint, returning a future that completes when the operation is started.- Parameters:
operationKey
- key of the operation, for deduplicationtargetDirectory
- Target directory for the savepoint.formatType
- Binary format of the savepoint.savepointMode
- context of the savepoint operationtimeout
- for the rpc call- Returns:
- Future which is completed once the operation is triggered successfully
-
getTriggeredSavepointStatus
default CompletableFuture<OperationResult<String>> getTriggeredSavepointStatus(AsynchronousJobOperationKey operationKey)
Get the status of a savepoint triggered under the specified operation key.- Parameters:
operationKey
- key of the operation- Returns:
- Future which completes immediately with the status, or fails if no operation is registered for the key
-
disposeSavepoint
default CompletableFuture<Acknowledge> disposeSavepoint(String savepointPath, Duration timeout)
Dispose the given savepoint.- Parameters:
savepointPath
- identifying the savepoint to disposetimeout
- RPC timeout- Returns:
- A future acknowledge if the disposal succeeded
-
requestJobStatus
default CompletableFuture<JobStatus> requestJobStatus(JobID jobId, Duration timeout)
Request theJobStatus
of the given job.- Parameters:
jobId
- identifying the job for which to retrieve the JobStatustimeout
- for the asynchronous operation- Returns:
- A future to the
JobStatus
of the given job
-
shutDownCluster
default CompletableFuture<Acknowledge> shutDownCluster()
-
deliverCoordinationRequestToCoordinator
default CompletableFuture<CoordinationResponse> deliverCoordinationRequestToCoordinator(JobID jobId, String operatorUid, SerializedValue<CoordinationRequest> serializedRequest, Duration timeout)
Deliver a coordination request to a specified coordinator and return the response.On the client side, a unique operatorUid must be defined to identify an operator. Otherwise, the query cannot be executed correctly. Note that we use operatorUid instead of operatorID because the latter is an internal runtime concept that cannot be recognized by the client.
- Parameters:
jobId
- identifying the job which the coordinator belongs tooperatorUid
- identifying the coordinator to receive the requestserializedRequest
- serialized request to delivertimeout
- RPC timeout- Returns:
- A future containing the response. The response will fail with a
FlinkException
if the task is not running, or no operator/coordinator exists for the given ID, or the coordinator cannot handle client events.
-
reportJobClientHeartbeat
default CompletableFuture<Void> reportJobClientHeartbeat(JobID jobId, long expiredTimestamp, Duration timeout)
The client reports the heartbeat to the dispatcher for aliveness.
-
requestJobResourceRequirements
default CompletableFuture<JobResourceRequirements> requestJobResourceRequirements(JobID jobId)
Read currentjob resource requirements
for a given job.- Parameters:
jobId
- job to read the resource requirements for- Returns:
- Future which that contains current resource requirements.
-
updateJobResourceRequirements
default CompletableFuture<Acknowledge> updateJobResourceRequirements(JobID jobId, JobResourceRequirements jobResourceRequirements)
Updatejob resource requirements
for a given job. When the returned future is complete the requirements have been updated and were persisted in HA, but the job may not have been rescaled (yet).- Parameters:
jobId
- job the given requirements belong tojobResourceRequirements
- new resource requirements for the job- Returns:
- Future which is completed successfully when requirements are updated
-
-