public class TaskContext
extends Object
implements scala.Serializable
Constructor and Description |
---|
TaskContext(int stageId,
int partitionId,
long attemptId,
boolean runningLocally,
org.apache.spark.executor.TaskMetrics taskMetrics) |
Modifier and Type | Method and Description |
---|---|
void |
addOnCompleteCallback(scala.Function0<scala.runtime.BoxedUnit> f)
Add a callback function to be executed on task completion.
|
TaskContext |
addTaskCompletionListener(scala.Function1<TaskContext,scala.runtime.BoxedUnit> f)
Add a listener in the form of a Scala closure to be executed on task completion.
|
TaskContext |
addTaskCompletionListener(TaskCompletionListener listener)
Add a (Java friendly) listener to be executed on task completion.
|
long |
attemptId() |
boolean |
isCompleted()
Checks whether the task has completed.
|
boolean |
isInterrupted()
Checks whether the task has been killed.
|
int |
partitionId() |
boolean |
runningLocally() |
int |
splitId() |
int |
stageId() |
org.apache.spark.executor.TaskMetrics |
taskMetrics() |
public TaskContext(int stageId, int partitionId, long attemptId, boolean runningLocally, org.apache.spark.executor.TaskMetrics taskMetrics)
public int stageId()
public int partitionId()
public long attemptId()
public boolean runningLocally()
public org.apache.spark.executor.TaskMetrics taskMetrics()
public int splitId()
public boolean isCompleted()
public boolean isInterrupted()
public TaskContext addTaskCompletionListener(TaskCompletionListener listener)
An example use is for HadoopRDD to register a callback to close the input stream.
public TaskContext addTaskCompletionListener(scala.Function1<TaskContext,scala.runtime.BoxedUnit> f)
An example use is for HadoopRDD to register a callback to close the input stream.
public void addOnCompleteCallback(scala.Function0<scala.runtime.BoxedUnit> f)
f
- Callback function.