@Internal public abstract class PlanExecutor extends Object
The specific implementation (such as the org.apache.flink.client.LocalExecutor and org.apache.flink.client.RemoteExecutor) determines where and how to run the dataflow. The concrete implementations of the executors are loaded dynamically, because they depend on the full set of all runtime classes.
PlanExecutors can be started explicitly, in which case they keep running until stopped. If a program is submitted to a plan executor that is not running, it will start up for that program, and shut down afterwards.
Constructor and Description |
---|
PlanExecutor() |
Modifier and Type | Method and Description |
---|---|
static PlanExecutor |
createLocalExecutor(Configuration configuration)
Creates an executor that runs the plan locally in a multi-threaded environment.
|
static PlanExecutor |
createRemoteExecutor(String hostname,
int port,
Configuration clientConfiguration,
List<URL> jarFiles,
List<URL> globalClasspaths)
Creates an executor that runs the plan on a remote environment.
|
abstract void |
endSession(JobID jobID)
Ends the job session, identified by the given JobID.
|
abstract JobExecutionResult |
executePlan(Plan plan)
Execute the given program.
|
abstract String |
getOptimizerPlanAsJSON(Plan plan)
Gets the programs execution plan in a JSON format.
|
boolean |
isPrintingStatusDuringExecution()
Gets whether the executor prints progress results to "standard out" (
System.out ). |
abstract boolean |
isRunning()
Checks if this executor is currently running.
|
void |
setPrintStatusDuringExecution(boolean printStatus)
Sets whether the executor should print progress results to "standard out" (
System.out ). |
abstract void |
start()
Starts the program executor.
|
abstract void |
stop()
Shuts down the plan executor and releases all local resources.
|
public void setPrintStatusDuringExecution(boolean printStatus)
System.out
).
All progress messages are logged using the configured logging framework independent of the value
set here.printStatus
- True, to print progress updates to standard out, false to not do that.public boolean isPrintingStatusDuringExecution()
System.out
).public abstract void start() throws Exception
stop()
is called.Exception
- Thrown, if the executor startup failed.public abstract void stop() throws Exception
This method also ends all sessions created by this executor. Remote job executions may complete, but the session is not kept alive after that.
Exception
- Thrown, if the proper shutdown failed.public abstract boolean isRunning()
public abstract JobExecutionResult executePlan(Plan plan) throws Exception
If the executor has not been started before, then this method will start the executor and stop it after the execution has completed. This implies that one needs to explicitly start the executor for all programs where multiple dataflow parts depend on each other. Otherwise, the previous parts will no longer be available, because the executor immediately shut down after the execution.
plan
- The plan of the program to execute.Exception
- Thrown, if job submission caused an exception.public abstract String getOptimizerPlanAsJSON(Plan plan) throws Exception
plan
- The program to get the execution plan for.Exception
- Thrown, if the executor could not connect to the compiler.public abstract void endSession(JobID jobID) throws Exception
jobID
- The JobID identifying the job session.Exception
- Thrown, if the message to finish the session cannot be delivered.public static PlanExecutor createLocalExecutor(Configuration configuration)
public static PlanExecutor createRemoteExecutor(String hostname, int port, Configuration clientConfiguration, List<URL> jarFiles, List<URL> globalClasspaths)
hostname
- The address of the JobManager to send the program to.port
- The port of the JobManager to send the program to.clientConfiguration
- The configuration for the client (Akka, default.parallelism).jarFiles
- A list of jar files that contain the user-defined function (UDF) classes and all classes used
from within the UDFs.globalClasspaths
- A list of URLs that are added to the classpath of each user code classloader of the
program. Paths must specify a protocol (e.g. file://) and be accessible on all nodes.Copyright © 2014–2020 The Apache Software Foundation. All rights reserved.