public abstract class AbstractInvokable extends Object
BatchTask
) inherit from this class.
The TaskManager invokes the methods registerInputOutput()
and invoke()
in
this order when executing a task. The first method is responsible for setting up input and
output stream readers and writers, the second method contains the task's core operation.Constructor and Description |
---|
AbstractInvokable() |
Modifier and Type | Method and Description |
---|---|
void |
cancel()
This method is called when a task is canceled either as a result of a user abort or an execution failure.
|
int |
getCurrentNumberOfSubtasks()
Returns the current number of subtasks the respective task is split into.
|
Environment |
getEnvironment()
Returns the environment of this task.
|
org.apache.flink.api.common.ExecutionConfig |
getExecutionConfig()
Returns the global ExecutionConfig, obtained from the job configuration.
|
int |
getIndexInSubtaskGroup()
Returns the index of this subtask in the subtask group.
|
org.apache.flink.configuration.Configuration |
getJobConfiguration()
Returns the job configuration object which was attached to the original
JobGraph . |
org.apache.flink.configuration.Configuration |
getTaskConfiguration()
Returns the task configuration object which was attached to the original
JobVertex . |
ClassLoader |
getUserCodeClassLoader()
Returns the user code class loader of this invokable.
|
abstract void |
invoke()
Must be overwritten by the concrete task.
|
abstract void |
registerInputOutput()
Must be overwritten by the concrete task to instantiate the required record reader and record writer.
|
void |
setEnvironment(Environment environment)
Sets the environment of this task.
|
public abstract void registerInputOutput() throws Exception
Exception
public abstract void invoke() throws Exception
Exception
- Tasks may forward their exceptions for the TaskManager to handle through failure/recovery.public final void setEnvironment(Environment environment)
environment
- the environment of this taskpublic Environment getEnvironment()
public ClassLoader getUserCodeClassLoader()
public int getCurrentNumberOfSubtasks()
public int getIndexInSubtaskGroup()
public org.apache.flink.configuration.Configuration getTaskConfiguration()
JobVertex
.JobVertex
public org.apache.flink.configuration.Configuration getJobConfiguration()
JobGraph
.JobGraph
public org.apache.flink.api.common.ExecutionConfig getExecutionConfig()
public void cancel() throws Exception
Exception
- thrown if any exception occurs during the execution of the user codeCopyright © 2014–2015 The Apache Software Foundation. All rights reserved.