public abstract class AbstractInvokable extends Object
BatchTask
inherit from this class.
The TaskManager invokes the invoke()
method when executing a
task. All operations of the task happen in this method (setting up input
output stream readers and writers as well as 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.
|
ExecutionConfig |
getExecutionConfig()
Returns the global ExecutionConfig, obtained from the job configuration.
|
int |
getIndexInSubtaskGroup()
Returns the index of this subtask in the subtask group.
|
Configuration |
getJobConfiguration()
Returns the job configuration object which was attached to the original
JobGraph . |
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()
Starts the execution.
|
void |
setEnvironment(Environment environment)
Sets the environment of this task.
|
public abstract void invoke() throws Exception
Must be overwritten by the concrete task implementation. This method is called by the task manager when the actual execution of the task starts.
All resources should be cleaned up when the method returns. Make sure
to guard the code with try-finally
blocks where necessary.
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 Configuration getTaskConfiguration()
JobVertex
.JobVertex
public Configuration getJobConfiguration()
JobGraph
.JobGraph
public ExecutionConfig getExecutionConfig()
public void cancel() throws Exception
Exception
- thrown if any exception occurs during the execution of the user codeCopyright © 2014–2017 The Apache Software Foundation. All rights reserved.