public class RestClusterClient<T> extends Object implements ClusterClient<T>
ClusterClient implementation that communicates via HTTP REST requests.| Constructor and Description |
|---|
RestClusterClient(org.apache.flink.configuration.Configuration config,
T clusterId) |
RestClusterClient(org.apache.flink.configuration.Configuration config,
T clusterId,
org.apache.flink.runtime.highavailability.ClientHighAvailabilityServices clientHAServices) |
| Modifier and Type | Method and Description |
|---|---|
CompletableFuture<org.apache.flink.runtime.messages.Acknowledge> |
cancel(org.apache.flink.api.common.JobID jobID)
Cancels a job identified by the job id.
|
CompletableFuture<String> |
cancelWithSavepoint(org.apache.flink.api.common.JobID jobId,
String savepointDirectory)
Cancels a job identified by the job id and triggers a savepoint.
|
void |
close() |
CompletableFuture<org.apache.flink.runtime.messages.Acknowledge> |
disposeSavepoint(String savepointPath)
Dispose the savepoint under the given path.
|
CompletableFuture<Map<String,Object>> |
getAccumulators(org.apache.flink.api.common.JobID jobID,
ClassLoader loader)
Requests and returns the accumulators for the given job identifier.
|
T |
getClusterId()
Returns the cluster id identifying the cluster to which the client is connected.
|
org.apache.flink.configuration.Configuration |
getFlinkConfiguration()
Return the Flink configuration object.
|
CompletableFuture<org.apache.flink.runtime.rest.messages.job.JobDetailsInfo> |
getJobDetails(org.apache.flink.api.common.JobID jobId)
Requests the job details.
|
CompletableFuture<org.apache.flink.api.common.JobStatus> |
getJobStatus(org.apache.flink.api.common.JobID jobId)
Requests the
JobStatus of the job with the given JobID. |
String |
getWebInterfaceURL()
Returns an URL (as a string) to the cluster web interface.
|
CompletableFuture<Collection<org.apache.flink.runtime.client.JobStatusMessage>> |
listJobs()
Lists the currently running and finished jobs on the cluster.
|
CompletableFuture<org.apache.flink.runtime.jobmaster.JobResult> |
requestJobResult(org.apache.flink.api.common.JobID jobId)
Requests the
JobResult for the given JobID. |
CompletableFuture<org.apache.flink.runtime.operators.coordination.CoordinationResponse> |
sendCoordinationRequest(org.apache.flink.api.common.JobID jobId,
org.apache.flink.runtime.jobgraph.OperatorID operatorId,
org.apache.flink.runtime.operators.coordination.CoordinationRequest request)
Sends out a request to a specified coordinator and return the response.
|
<M extends org.apache.flink.runtime.rest.messages.MessageHeaders<R,P,U>,U extends org.apache.flink.runtime.rest.messages.MessageParameters,R extends org.apache.flink.runtime.rest.messages.RequestBody,P extends org.apache.flink.runtime.rest.messages.ResponseBody> |
sendRequest(M messageHeaders,
U messageParameters,
R request) |
void |
shutDownCluster()
Shut down the cluster that this client communicate with.
|
CompletableFuture<String> |
stopWithSavepoint(org.apache.flink.api.common.JobID jobId,
boolean advanceToEndOfTime,
String savepointDirectory)
Stops a program on Flink cluster whose job-manager is configured in this client's
configuration.
|
CompletableFuture<org.apache.flink.api.common.JobID> |
submitJob(org.apache.flink.runtime.jobgraph.JobGraph jobGraph)
Submit the given
JobGraph to the cluster. |
CompletableFuture<String> |
triggerSavepoint(org.apache.flink.api.common.JobID jobId,
String savepointDirectory)
Triggers a savepoint for the job identified by the job id.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetAccumulatorspublic RestClusterClient(org.apache.flink.configuration.Configuration config,
T clusterId)
throws Exception
Exceptionpublic org.apache.flink.configuration.Configuration getFlinkConfiguration()
ClusterClientgetFlinkConfiguration in interface ClusterClient<T>public void close()
close in interface AutoCloseableclose in interface ClusterClient<T>public CompletableFuture<org.apache.flink.runtime.rest.messages.job.JobDetailsInfo> getJobDetails(org.apache.flink.api.common.JobID jobId)
jobId - The job idpublic CompletableFuture<org.apache.flink.api.common.JobStatus> getJobStatus(org.apache.flink.api.common.JobID jobId)
ClusterClientJobStatus of the job with the given JobID.getJobStatus in interface ClusterClient<T>public CompletableFuture<org.apache.flink.runtime.jobmaster.JobResult> requestJobResult(@Nonnull org.apache.flink.api.common.JobID jobId)
JobResult for the given JobID. The method retries multiple times
to poll the JobResult before giving up.requestJobResult in interface ClusterClient<T>jobId - specifying the job for which to retrieve the JobResultJobResult once the job has completed or
with a failure if the JobResult could not be retrieved.public CompletableFuture<org.apache.flink.api.common.JobID> submitJob(@Nonnull org.apache.flink.runtime.jobgraph.JobGraph jobGraph)
ClusterClientJobGraph to the cluster.submitJob in interface ClusterClient<T>jobGraph - to submitJobID of the submitted jobpublic CompletableFuture<org.apache.flink.runtime.messages.Acknowledge> cancel(org.apache.flink.api.common.JobID jobID)
ClusterClientcancel in interface ClusterClient<T>jobID - the job idpublic CompletableFuture<String> stopWithSavepoint(org.apache.flink.api.common.JobID jobId, boolean advanceToEndOfTime, @Nullable String savepointDirectory)
ClusterClientstopWithSavepoint in interface ClusterClient<T>jobId - the job ID of the streaming program to stopadvanceToEndOfTime - flag indicating if the source should inject a MAX_WATERMARK in the pipelinesavepointDirectory - directory the savepoint should be written toCompletableFuture containing the path where the savepoint is locatedpublic CompletableFuture<String> cancelWithSavepoint(org.apache.flink.api.common.JobID jobId, @Nullable String savepointDirectory)
ClusterClientcancelWithSavepoint in interface ClusterClient<T>jobId - the job idsavepointDirectory - directory the savepoint should be written topublic CompletableFuture<String> triggerSavepoint(org.apache.flink.api.common.JobID jobId, @Nullable String savepointDirectory)
ClusterClientCheckpointingOptions.SAVEPOINT_DIRECTORY if it is null.triggerSavepoint in interface ClusterClient<T>jobId - job idsavepointDirectory - directory the savepoint should be written topublic CompletableFuture<org.apache.flink.runtime.operators.coordination.CoordinationResponse> sendCoordinationRequest(org.apache.flink.api.common.JobID jobId, org.apache.flink.runtime.jobgraph.OperatorID operatorId, org.apache.flink.runtime.operators.coordination.CoordinationRequest request)
ClusterClientsendCoordinationRequest in interface ClusterClient<T>jobId - specifies the job which the coordinator belongs tooperatorId - specifies which coordinator to receive the requestrequest - the request to sendpublic CompletableFuture<Map<String,Object>> getAccumulators(org.apache.flink.api.common.JobID jobID, ClassLoader loader)
ClusterClientgetAccumulators in interface ClusterClient<T>jobID - The job identifier of a job.loader - The class loader for deserializing the accumulator results.public CompletableFuture<Collection<org.apache.flink.runtime.client.JobStatusMessage>> listJobs()
ClusterClientlistJobs in interface ClusterClient<T>public T getClusterId()
ClusterClientgetClusterId in interface ClusterClient<T>public CompletableFuture<org.apache.flink.runtime.messages.Acknowledge> disposeSavepoint(String savepointPath)
ClusterClientdisposeSavepoint in interface ClusterClient<T>savepointPath - path to the savepoint to be disposedpublic void shutDownCluster()
ClusterClientshutDownCluster in interface ClusterClient<T>public String getWebInterfaceURL()
ClusterClientgetWebInterfaceURL in interface ClusterClient<T>@VisibleForTesting public <M extends org.apache.flink.runtime.rest.messages.MessageHeaders<R,P,U>,U extends org.apache.flink.runtime.rest.messages.MessageParameters,R extends org.apache.flink.runtime.rest.messages.RequestBody,P extends org.apache.flink.runtime.rest.messages.ResponseBody> CompletableFuture<P> sendRequest(M messageHeaders, U messageParameters, R request)
Copyright © 2014–2021 The Apache Software Foundation. All rights reserved.