public class RestClusterClient extends ClusterClient
ClusterClient
implementation that communicates via HTTP REST requests.ClusterClient.LazyActorSystemLoader
actorSystemLoader, flinkConfig, highAvailabilityServices, log, timeout
Constructor and Description |
---|
RestClusterClient(Configuration config) |
RestClusterClient(Configuration config,
RestClusterClientConfiguration configuration) |
Modifier and Type | Method and Description |
---|---|
void |
cancel(JobID jobID)
Cancels a job identified by the job id.
|
String |
cancelWithSavepoint(JobID jobId,
String savepointDirectory)
Cancels a job identified by the job id and triggers a savepoint.
|
protected void |
finalizeCluster()
Request the cluster to shut down or disconnect.
|
String |
getClusterIdentifier()
Returns a string representation of the cluster.
|
GetClusterStatusResponse |
getClusterStatus()
Returns the latest cluster status, with number of Taskmanagers and slots.
|
int |
getMaxSlots()
The client may define an upper limit on the number of slots to use.
|
protected List<String> |
getNewMessages()
May return new messages from the cluster.
|
String |
getWebInterfaceURL()
Returns an URL (as a string) to the JobManager web interface.
|
boolean |
hasUserJarsInClassPath(List<URL> userJarFiles)
Returns true if the client already has the user jar and providing it again would
result in duplicate uploading of the jar.
|
CompletableFuture<Collection<JobStatusMessage>> |
listJobs()
Lists the currently running and finished jobs on the cluster.
|
void |
shutdown()
Shuts down the client.
|
void |
stop(JobID jobID)
Stops a program on Flink cluster whose job-manager is configured in this client's configuration.
|
protected JobSubmissionResult |
submitJob(JobGraph jobGraph,
ClassLoader classLoader)
Calls the subclasses' submitJob method.
|
CompletableFuture<String> |
triggerSavepoint(JobID jobId,
String savepointDirectory)
Triggers a savepoint for the job identified by the job id.
|
void |
waitForClusterToBeReady()
Blocks until the client has determined that the cluster is ready for Job submission.
|
connectToJob, endSession, endSessions, getAccumulators, getAccumulators, getFlinkConfiguration, getJobGraph, getJobManagerAddress, getJobManagerGateway, getOptimizedPlan, getOptimizedPlan, getOptimizedPlanAsJson, getPrintStatusDuringExecution, isDetached, logAndSysout, retrieveJob, run, run, run, run, run, run, runDetached, setDetached, setPrintStatusDuringExecution
public RestClusterClient(Configuration config) throws Exception
Exception
public RestClusterClient(Configuration config, RestClusterClientConfiguration configuration) throws Exception
Exception
public void shutdown()
ClusterClient
shutdown
in class ClusterClient
protected JobSubmissionResult submitJob(JobGraph jobGraph, ClassLoader classLoader) throws ProgramInvocationException
ClusterClient
submitJob
in class ClusterClient
jobGraph
- The JobGraph to be submittedProgramInvocationException
public void stop(JobID jobID) throws Exception
ClusterClient
stop
in class ClusterClient
jobID
- the job ID of the streaming program to stopException
- 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 void cancel(JobID jobID) throws Exception
ClusterClient
cancel
in class ClusterClient
jobID
- the job idException
- In case an error occurred.public String cancelWithSavepoint(JobID jobId, @Nullable String savepointDirectory) throws Exception
ClusterClient
cancelWithSavepoint
in class ClusterClient
jobId
- the job idsavepointDirectory
- directory the savepoint should be written toException
- In case an error cocurred.public CompletableFuture<String> triggerSavepoint(JobID jobId, @Nullable String savepointDirectory) throws Exception
ClusterClient
CoreOptions.SAVEPOINT_DIRECTORY
if it is null.triggerSavepoint
in class ClusterClient
jobId
- job idsavepointDirectory
- directory the savepoint should be written toException
- if no connection to the cluster could be establishedpublic CompletableFuture<Collection<JobStatusMessage>> listJobs() throws Exception
ClusterClient
listJobs
in class ClusterClient
Exception
- if no connection to the cluster could be establishedpublic String getClusterIdentifier()
ClusterClient
getClusterIdentifier
in class ClusterClient
public boolean hasUserJarsInClassPath(List<URL> userJarFiles)
ClusterClient
hasUserJarsInClassPath
in class ClusterClient
public void waitForClusterToBeReady()
ClusterClient
This is delayed until right before job submission to report any other errors first (e.g. invalid job definitions/errors in the user jar)
waitForClusterToBeReady
in class ClusterClient
public String getWebInterfaceURL()
ClusterClient
getWebInterfaceURL
in class ClusterClient
public GetClusterStatusResponse getClusterStatus()
ClusterClient
getClusterStatus
in class ClusterClient
protected List<String> getNewMessages()
ClusterClient
getNewMessages
in class ClusterClient
protected void finalizeCluster()
ClusterClient
finalizeCluster
in class ClusterClient
public int getMaxSlots()
ClusterClient
getMaxSlots
in class ClusterClient
Copyright © 2014–2018 The Apache Software Foundation. All rights reserved.