public class RestClusterClient<T> extends ClusterClient<T> implements NewClusterClient
ClusterClient implementation that communicates via HTTP REST requests.flinkConfig, highAvailabilityServices, lastJobExecutionResult, log, timeout| 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.leaderretrieval.LeaderRetrievalService webMonitorRetrievalService) |
| Modifier and Type | Method and Description |
|---|---|
void |
cancel(org.apache.flink.api.common.JobID jobID)
Cancels a job identified by the job id.
|
String |
cancelWithSavepoint(org.apache.flink.api.common.JobID jobId,
String savepointDirectory)
Cancels a job identified by the job id and triggers a savepoint.
|
CompletableFuture<org.apache.flink.runtime.messages.Acknowledge> |
disposeSavepoint(String savepointPath) |
Map<String,org.apache.flink.util.OptionalFailure<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.
|
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.runtime.jobgraph.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 JobManager 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. |
<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 |
shutdown()
Shuts down the client.
|
void |
shutDownCluster() |
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.JobSubmissionResult> |
submitJob(org.apache.flink.runtime.jobgraph.JobGraph jobGraph)
Submits the given
JobGraph to the dispatcher. |
org.apache.flink.api.common.JobSubmissionResult |
submitJob(org.apache.flink.runtime.jobgraph.JobGraph jobGraph,
ClassLoader classLoader)
Calls the subclasses' submitJob method.
|
CompletableFuture<String> |
triggerSavepoint(org.apache.flink.api.common.JobID jobId,
String savepointDirectory)
Triggers a savepoint for the job identified by the job id.
|
getAccumulators, getClusterConnectionInfo, getFlinkConfiguration, getJobGraph, getJobGraph, getOptimizedPlan, getOptimizedPlan, getOptimizedPlanAsJson, getPrintStatusDuringExecution, isDetached, run, run, run, run, run, setDetached, setPrintStatusDuringExecutionpublic RestClusterClient(org.apache.flink.configuration.Configuration config,
T clusterId)
throws Exception
Exceptionpublic void shutdown()
ClusterClientshutdown in class ClusterClient<T>public org.apache.flink.api.common.JobSubmissionResult submitJob(org.apache.flink.runtime.jobgraph.JobGraph jobGraph,
ClassLoader classLoader)
throws ProgramInvocationException
ClusterClientsubmitJob in class ClusterClient<T>jobGraph - The JobGraph to be submittedProgramInvocationExceptionpublic 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.runtime.jobgraph.JobStatus> getJobStatus(org.apache.flink.api.common.JobID jobId)
ClusterClientJobStatus of the job with the given JobID.getJobStatus in class 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 NewClusterClientjobId - 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.JobSubmissionResult> submitJob(@Nonnull org.apache.flink.runtime.jobgraph.JobGraph jobGraph)
JobGraph to the dispatcher.submitJob in interface NewClusterClientjobGraph - to submitpublic void cancel(org.apache.flink.api.common.JobID jobID)
throws Exception
ClusterClientcancel in class ClusterClient<T>jobID - the job idException - In case an error occurred.public String stopWithSavepoint(org.apache.flink.api.common.JobID jobId, boolean advanceToEndOfTime, @Nullable String savepointDirectory) throws Exception
ClusterClientstopWithSavepoint in class 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 locatedException - If the job ID is invalid (ie, is unknown or refers to a batch job) or if sending the stop signal
failed. That might be due to an I/O problem, ie, the job-manager is unreachable.public String cancelWithSavepoint(org.apache.flink.api.common.JobID jobId, @Nullable String savepointDirectory) throws Exception
ClusterClientcancelWithSavepoint in class ClusterClient<T>jobId - the job idsavepointDirectory - directory the savepoint should be written toException - In case an error occurred.public CompletableFuture<String> triggerSavepoint(org.apache.flink.api.common.JobID jobId, @Nullable String savepointDirectory)
ClusterClientCheckpointingOptions.SAVEPOINT_DIRECTORY if it is null.triggerSavepoint in class ClusterClient<T>jobId - job idsavepointDirectory - directory the savepoint should be written topublic Map<String,org.apache.flink.util.OptionalFailure<Object>> getAccumulators(org.apache.flink.api.common.JobID jobID, ClassLoader loader) throws Exception
ClusterClientgetAccumulators in class ClusterClient<T>jobID - The job identifier of a job.loader - The class loader for deserializing the accumulator results.Exceptionpublic CompletableFuture<Collection<org.apache.flink.runtime.client.JobStatusMessage>> listJobs()
ClusterClientlistJobs in class ClusterClient<T>public T getClusterId()
ClusterClientgetClusterId in class ClusterClient<T>public CompletableFuture<org.apache.flink.runtime.messages.Acknowledge> disposeSavepoint(String savepointPath)
disposeSavepoint in class ClusterClient<T>public void shutDownCluster()
shutDownCluster in class ClusterClient<T>public String getWebInterfaceURL()
ClusterClientgetWebInterfaceURL in class 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–2020 The Apache Software Foundation. All rights reserved.