public class MiniClusterClient extends ClusterClient<org.apache.flink.client.program.MiniClusterClient.MiniClusterId> implements NewClusterClient
MiniCluster.ClusterClient.LazyActorSystemLoaderactorSystemLoader, flinkConfig, highAvailabilityServices, lastJobExecutionResult, log, MAX_SLOTS_UNKNOWN, timeout| Constructor and Description |
|---|
MiniClusterClient(org.apache.flink.configuration.Configuration configuration,
org.apache.flink.runtime.minicluster.MiniCluster miniCluster) |
| 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)
Requests and returns the accumulators for the given job identifier.
|
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.
|
org.apache.flink.runtime.util.LeaderConnectionInfo |
getClusterConnectionInfo()
Gets the current cluster connection info (may change in case of a HA setup).
|
org.apache.flink.client.program.MiniClusterClient.MiniClusterId |
getClusterId()
Returns the cluster id identifying the cluster to which the client is connected.
|
org.apache.flink.runtime.clusterframework.messages.GetClusterStatusResponse |
getClusterStatus()
Returns the latest cluster status, with number of Taskmanagers and slots.
|
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. |
int |
getMaxSlots()
The client may define an upper limit on the number of slots to use.
|
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<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)
Request the
JobResult for the given JobID. |
void |
shutdown()
Shuts down the client.
|
void |
stop(org.apache.flink.api.common.JobID jobId)
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)
Submit the given
JobGraph to the cluster. |
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.
|
void |
waitForClusterToBeReady()
Blocks until the client has determined that the cluster is ready for Job submission.
|
connectToJob, endSession, endSessions, getFlinkConfiguration, getJobGraph, getJobGraph, getJobManagerGateway, getOptimizedPlan, getOptimizedPlan, getOptimizedPlanAsJson, getPrintStatusDuringExecution, isDetached, logAndSysout, rescaleJob, retrieveJob, run, run, run, run, run, run, runDetached, setDetached, setPrintStatusDuringExecution, shutDownClusterpublic void shutdown()
throws Exception
ClusterClientshutdown in class ClusterClient<org.apache.flink.client.program.MiniClusterClient.MiniClusterId>Exceptionpublic org.apache.flink.api.common.JobSubmissionResult submitJob(org.apache.flink.runtime.jobgraph.JobGraph jobGraph,
ClassLoader classLoader)
throws ProgramInvocationException
ClusterClientsubmitJob in class ClusterClient<org.apache.flink.client.program.MiniClusterClient.MiniClusterId>jobGraph - The JobGraph to be submittedProgramInvocationExceptionpublic CompletableFuture<org.apache.flink.api.common.JobSubmissionResult> submitJob(@Nonnull org.apache.flink.runtime.jobgraph.JobGraph jobGraph)
NewClusterClientJobGraph to the cluster.submitJob in interface NewClusterClientjobGraph - to submitJobSubmissionResultpublic CompletableFuture<org.apache.flink.runtime.jobmaster.JobResult> requestJobResult(@Nonnull org.apache.flink.api.common.JobID jobId)
NewClusterClientJobResult for the given JobID.requestJobResult in interface NewClusterClientjobId - for which to request the JobResultJobResultpublic void cancel(org.apache.flink.api.common.JobID jobId)
throws Exception
ClusterClientcancel in class ClusterClient<org.apache.flink.client.program.MiniClusterClient.MiniClusterId>jobId - the job idException - In case an error occurred.public String cancelWithSavepoint(org.apache.flink.api.common.JobID jobId, @Nullable String savepointDirectory) throws Exception
ClusterClientcancelWithSavepoint in class ClusterClient<org.apache.flink.client.program.MiniClusterClient.MiniClusterId>jobId - the job idsavepointDirectory - directory the savepoint should be written toException - In case an error cocurred.public void stop(org.apache.flink.api.common.JobID jobId)
throws Exception
ClusterClientstop in class ClusterClient<org.apache.flink.client.program.MiniClusterClient.MiniClusterId>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 CompletableFuture<String> triggerSavepoint(org.apache.flink.api.common.JobID jobId, @Nullable String savepointDirectory)
ClusterClientCheckpointingOptions.SAVEPOINT_DIRECTORY if it is null.triggerSavepoint in class ClusterClient<org.apache.flink.client.program.MiniClusterClient.MiniClusterId>jobId - job idsavepointDirectory - directory the savepoint should be written topublic CompletableFuture<org.apache.flink.runtime.messages.Acknowledge> disposeSavepoint(String savepointPath)
disposeSavepoint in class ClusterClient<org.apache.flink.client.program.MiniClusterClient.MiniClusterId>public CompletableFuture<Collection<org.apache.flink.runtime.client.JobStatusMessage>> listJobs()
ClusterClientlistJobs in class ClusterClient<org.apache.flink.client.program.MiniClusterClient.MiniClusterId>public Map<String,org.apache.flink.util.OptionalFailure<Object>> getAccumulators(org.apache.flink.api.common.JobID jobID) throws Exception
ClusterClientgetAccumulators in class ClusterClient<org.apache.flink.client.program.MiniClusterClient.MiniClusterId>jobID - The job identifier of a job.Exceptionpublic Map<String,org.apache.flink.util.OptionalFailure<Object>> getAccumulators(org.apache.flink.api.common.JobID jobID, ClassLoader loader) throws Exception
ClusterClientgetAccumulators in class ClusterClient<org.apache.flink.client.program.MiniClusterClient.MiniClusterId>jobID - The job identifier of a job.loader - The class loader for deserializing the accumulator results.Exceptionpublic 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<org.apache.flink.client.program.MiniClusterClient.MiniClusterId>public org.apache.flink.client.program.MiniClusterClient.MiniClusterId getClusterId()
ClusterClientgetClusterId in class ClusterClient<org.apache.flink.client.program.MiniClusterClient.MiniClusterId>public org.apache.flink.runtime.util.LeaderConnectionInfo getClusterConnectionInfo()
throws org.apache.flink.runtime.leaderretrieval.LeaderRetrievalException
ClusterClientgetClusterConnectionInfo in class ClusterClient<org.apache.flink.client.program.MiniClusterClient.MiniClusterId>org.apache.flink.runtime.leaderretrieval.LeaderRetrievalException - if the leader could not be retrievedpublic void waitForClusterToBeReady()
ClusterClientThis 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<org.apache.flink.client.program.MiniClusterClient.MiniClusterId>public String getWebInterfaceURL()
ClusterClientgetWebInterfaceURL in class ClusterClient<org.apache.flink.client.program.MiniClusterClient.MiniClusterId>public org.apache.flink.runtime.clusterframework.messages.GetClusterStatusResponse getClusterStatus()
ClusterClientgetClusterStatus in class ClusterClient<org.apache.flink.client.program.MiniClusterClient.MiniClusterId>public List<String> getNewMessages()
ClusterClientgetNewMessages in class ClusterClient<org.apache.flink.client.program.MiniClusterClient.MiniClusterId>public int getMaxSlots()
ClusterClientgetMaxSlots in class ClusterClient<org.apache.flink.client.program.MiniClusterClient.MiniClusterId>ClusterClient.MAX_SLOTS_UNKNOWN) if unknownpublic boolean hasUserJarsInClassPath(List<URL> userJarFiles)
ClusterClienthasUserJarsInClassPath in class ClusterClient<org.apache.flink.client.program.MiniClusterClient.MiniClusterId>Copyright © 2014–2018 The Apache Software Foundation. All rights reserved.