public class Client extends Object
Constructor and Description |
---|
Client(Configuration config)
Creates a instance that submits the programs to the JobManager defined in the
configuration.
|
Client(Configuration config,
int maxSlots)
Creates a new instance of the class that submits the jobs to a job-manager.
|
Modifier and Type | Method and Description |
---|---|
void |
cancel(JobID jobId)
Cancels a job identified by the job id.
|
void |
endSession(JobID jobId)
Tells the JobManager to finish the session (job) defined by the given ID.
|
void |
endSessions(List<JobID> jobIds)
Tells the JobManager to finish the sessions (jobs) defined by the given IDs.
|
Map<String,Object> |
getAccumulators(JobID jobID)
Requests and returns the accumulators for the given job identifier.
|
Map<String,Object> |
getAccumulators(JobID jobID,
ClassLoader loader)
Requests and returns the accumulators for the given job identifier.
|
JobGraph |
getJobGraph(PackagedProgram prog,
FlinkPlan optPlan) |
JobGraph |
getJobGraph(PackagedProgram prog,
FlinkPlan optPlan,
String savepointPath) |
int |
getMaxSlots() |
static FlinkPlan |
getOptimizedPlan(Optimizer compiler,
PackagedProgram prog,
int parallelism) |
static OptimizedPlan |
getOptimizedPlan(Optimizer compiler,
Plan p,
int parallelism) |
static String |
getOptimizedPlanAsJson(Optimizer compiler,
PackagedProgram prog,
int parallelism) |
boolean |
getPrintStatusDuringExecution() |
JobExecutionResult |
runBlocking(FlinkPlan compiledPlan,
List<URL> libraries,
List<URL> classpaths,
ClassLoader classLoader) |
JobExecutionResult |
runBlocking(FlinkPlan compiledPlan,
List<URL> libraries,
List<URL> classpaths,
ClassLoader classLoader,
String savepointPath) |
JobExecutionResult |
runBlocking(JobGraph jobGraph,
ClassLoader classLoader) |
JobExecutionResult |
runBlocking(JobWithJars program,
int parallelism) |
JobExecutionResult |
runBlocking(JobWithJars program,
int parallelism,
String savepointPath)
Runs a program on the Flink cluster to which this client is connected.
|
JobSubmissionResult |
runBlocking(PackagedProgram prog,
int parallelism) |
JobSubmissionResult |
runDetached(FlinkPlan compiledPlan,
List<URL> libraries,
List<URL> classpaths,
ClassLoader classLoader) |
JobSubmissionResult |
runDetached(FlinkPlan compiledPlan,
List<URL> libraries,
List<URL> classpaths,
ClassLoader classLoader,
String savepointPath) |
JobSubmissionResult |
runDetached(JobGraph jobGraph,
ClassLoader classLoader) |
JobSubmissionResult |
runDetached(JobWithJars program,
int parallelism) |
JobSubmissionResult |
runDetached(JobWithJars program,
int parallelism,
String savepointPath)
Submits a program to the Flink cluster to which this client is connected.
|
JobSubmissionResult |
runDetached(PackagedProgram prog,
int parallelism) |
void |
setPrintStatusDuringExecution(boolean print)
Configures whether the client should print progress updates during the execution to
System.out . |
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.
|
public Client(Configuration config) throws IOException
config
- The config used to obtain the job-manager's address, and used to configure the optimizer.IOException
- Thrown, if the client's actor system could not be started.UnknownHostException
- Thrown, if the JobManager's hostname could not be resolved.public Client(Configuration config, int maxSlots) throws IOException
config
- The configuration for the client-side processes, like the optimizer.maxSlots
- maxSlots The number of maxSlots on the cluster if != -1.IOException
- Thrown, if the client's actor system could not be started.UnknownHostException
- Thrown, if the JobManager's hostname could not be resolved.public void shutdown()
public void setPrintStatusDuringExecution(boolean print)
System.out
.
All updates are logged via the SLF4J loggers regardless of this setting.print
- True to print updates to standard out during execution, false to not print them.public boolean getPrintStatusDuringExecution()
System.out
public int getMaxSlots()
public static String getOptimizedPlanAsJson(Optimizer compiler, PackagedProgram prog, int parallelism) throws CompilerException, ProgramInvocationException
public static FlinkPlan getOptimizedPlan(Optimizer compiler, PackagedProgram prog, int parallelism) throws CompilerException, ProgramInvocationException
public static OptimizedPlan getOptimizedPlan(Optimizer compiler, Plan p, int parallelism) throws CompilerException
CompilerException
public JobSubmissionResult runBlocking(PackagedProgram prog, int parallelism) throws ProgramInvocationException
ProgramInvocationException
public JobSubmissionResult runDetached(PackagedProgram prog, int parallelism) throws ProgramInvocationException
ProgramInvocationException
public JobExecutionResult runBlocking(JobWithJars program, int parallelism) throws ProgramInvocationException
ProgramInvocationException
public JobExecutionResult runBlocking(JobWithJars program, int parallelism, String savepointPath) throws CompilerException, ProgramInvocationException
program
- The program to be executed.parallelism
- The default parallelism to use when running the program. The default parallelism is used
when the program does not set a parallelism by itself.CompilerException
- Thrown, if the compiler encounters an illegal situation.ProgramInvocationException
- Thrown, if the program could not be instantiated from its jar file,
or if the submission failed. That might be either due to an I/O problem,
i.e. the job-manager is unreachable, or due to the fact that the
parallel execution failed.public JobSubmissionResult runDetached(JobWithJars program, int parallelism) throws ProgramInvocationException
ProgramInvocationException
public JobSubmissionResult runDetached(JobWithJars program, int parallelism, String savepointPath) throws CompilerException, ProgramInvocationException
program
- The program to be executed.parallelism
- The default parallelism to use when running the program. The default parallelism is used
when the program does not set a parallelism by itself.CompilerException
- Thrown, if the compiler encounters an illegal situation.ProgramInvocationException
- Thrown, if the program could not be instantiated from its jar file,
or if the submission failed. That might be either due to an I/O problem,
i.e. the job-manager is unreachable.public JobExecutionResult runBlocking(FlinkPlan compiledPlan, List<URL> libraries, List<URL> classpaths, ClassLoader classLoader) throws ProgramInvocationException
ProgramInvocationException
public JobExecutionResult runBlocking(FlinkPlan compiledPlan, List<URL> libraries, List<URL> classpaths, ClassLoader classLoader, String savepointPath) throws ProgramInvocationException
ProgramInvocationException
public JobSubmissionResult runDetached(FlinkPlan compiledPlan, List<URL> libraries, List<URL> classpaths, ClassLoader classLoader) throws ProgramInvocationException
ProgramInvocationException
public JobSubmissionResult runDetached(FlinkPlan compiledPlan, List<URL> libraries, List<URL> classpaths, ClassLoader classLoader, String savepointPath) throws ProgramInvocationException
ProgramInvocationException
public JobExecutionResult runBlocking(JobGraph jobGraph, ClassLoader classLoader) throws ProgramInvocationException
ProgramInvocationException
public JobSubmissionResult runDetached(JobGraph jobGraph, ClassLoader classLoader) throws ProgramInvocationException
ProgramInvocationException
public void cancel(JobID jobId) throws Exception
jobId
- the job idException
- In case an error occurred.public void stop(JobID jobId) throws Exception
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 Map<String,Object> getAccumulators(JobID jobID) throws Exception
jobID
- The job identifier of a job.Exception
public Map<String,Object> getAccumulators(JobID jobID, ClassLoader loader) throws Exception
jobID
- The job identifier of a job.loader
- The class loader for deserializing the accumulator results.Exception
public void endSession(JobID jobId) throws Exception
jobId
- The ID that identifies the session.Exception
public void endSessions(List<JobID> jobIds) throws Exception
jobIds
- The IDs that identify the sessions.Exception
public JobGraph getJobGraph(PackagedProgram prog, FlinkPlan optPlan) throws ProgramInvocationException
ProgramInvocationException
public JobGraph getJobGraph(PackagedProgram prog, FlinkPlan optPlan, String savepointPath) throws ProgramInvocationException
ProgramInvocationException
Copyright © 2014–2017 The Apache Software Foundation. All rights reserved.