@Public public class LocalEnvironment extends ExecutionEnvironment
ExecutionEnvironment that runs the program locally, multi-threaded, in the JVM where the
environment is instantiated.
When this environment is instantiated, it uses a default parallelism of 1. The default
parallelism can be set via ExecutionEnvironment.setParallelism(int).
Local environments can also be instantiated through ExecutionEnvironment.createLocalEnvironment()
and ExecutionEnvironment.createLocalEnvironment(int). The former version will pick a
default parallelism equal to the number of hardware contexts in the local machine.
jobID, lastJobExecutionResult, LOG, sessionTimeout| Constructor and Description |
|---|
LocalEnvironment()
Creates a new local environment.
|
LocalEnvironment(org.apache.flink.configuration.Configuration config)
Creates a new local environment that configures its local executor with the given configuration.
|
| Modifier and Type | Method and Description |
|---|---|
org.apache.flink.api.common.JobExecutionResult |
execute(String jobName)
Triggers the program execution.
|
String |
getExecutionPlan()
Creates the plan with which the system will execute the program, and returns it as
a String using a JSON representation of the execution data flow graph.
|
void |
startNewSession()
Starts a new session, discarding the previous data flow and all of its intermediate results.
|
String |
toString() |
addDefaultKryoSerializer, addDefaultKryoSerializer, areExplicitEnvironmentsAllowed, createCollectionsEnvironment, createHadoopInput, createHadoopInput, createInput, createInput, createLocalEnvironment, createLocalEnvironment, createLocalEnvironment, createProgramPlan, createProgramPlan, createProgramPlan, createRemoteEnvironment, createRemoteEnvironment, createRemoteEnvironment, execute, fromCollection, fromCollection, fromCollection, fromCollection, fromElements, fromElements, fromParallelCollection, fromParallelCollection, generateSequence, getConfig, getExecutionEnvironment, getId, getIdString, getLastJobExecutionResult, getNumberOfExecutionRetries, getParallelism, getRestartStrategy, getSessionTimeout, initializeContextEnvironment, readCsvFile, readFile, readFileOfPrimitives, readFileOfPrimitives, readHadoopFile, readHadoopFile, readHadoopFile, readHadoopFile, readSequenceFile, readTextFile, readTextFile, readTextFileWithValue, readTextFileWithValue, registerCachedFile, registerCachedFile, registerCachedFilesWithPlan, registerType, registerTypeWithKryoSerializer, registerTypeWithKryoSerializer, resetContextEnvironment, setDefaultLocalParallelism, setNumberOfExecutionRetries, setParallelism, setRestartStrategy, setSessionTimeoutpublic LocalEnvironment()
public LocalEnvironment(org.apache.flink.configuration.Configuration config)
config - The configuration used to configure the local executor.public org.apache.flink.api.common.JobExecutionResult execute(String jobName) throws Exception
ExecutionEnvironmentDataSet.print(),
writing results (e.g. DataSet.writeAsText(String),
DataSet.write(org.apache.flink.api.common.io.FileOutputFormat, String), or other generic
data sinks created with DataSet.output(org.apache.flink.api.common.io.OutputFormat).
The program execution will be logged and displayed with the given job name.
execute in class ExecutionEnvironmentException - Thrown, if the program executions fails.public String getExecutionPlan() throws Exception
ExecutionEnvironmentgetExecutionPlan in class ExecutionEnvironmentException - Thrown, if the compiler could not be instantiated, or the master could not
be contacted to retrieve information relevant to the execution planning.@PublicEvolving
public void startNewSession()
throws Exception
ExecutionEnvironmentstartNewSession in class ExecutionEnvironmentExceptionCopyright © 2014–2016 The Apache Software Foundation. All rights reserved.