public abstract class TaskContext
extends Object
implements java.io.Serializable
org.apache.spark.TaskContext.get()
Constructor and Description |
---|
TaskContext() |
Modifier and Type | Method and Description |
---|---|
abstract void |
addOnCompleteCallback(scala.Function0<scala.runtime.BoxedUnit> f)
Adds a callback function to be executed on task completion.
|
abstract TaskContext |
addTaskCompletionListener(scala.Function1<TaskContext,scala.runtime.BoxedUnit> f)
Adds a listener in the form of a Scala closure to be executed on task completion.
|
abstract TaskContext |
addTaskCompletionListener(TaskCompletionListener listener)
Adds a (Java friendly) listener to be executed on task completion.
|
abstract long |
attemptId() |
abstract int |
attemptNumber()
How many times this task has been attempted.
|
static TaskContext |
get()
Return the currently active TaskContext.
|
abstract boolean |
isCompleted()
Returns true if the task has completed.
|
abstract boolean |
isInterrupted()
Returns true if the task has been killed.
|
abstract boolean |
isRunningLocally()
Returns true if the task is running locally in the driver program.
|
abstract int |
partitionId()
The ID of the RDD partition that is computed by this task.
|
abstract boolean |
runningLocally() |
abstract int |
stageId()
The ID of the stage that this task belong to.
|
abstract long |
taskAttemptId()
An ID that is unique to this task attempt (within the same SparkContext, no two task attempts
will share the same attempt ID).
|
abstract org.apache.spark.executor.TaskMetrics |
taskMetrics()
::DeveloperApi::
|
public static TaskContext get()
public abstract boolean isCompleted()
public abstract boolean isInterrupted()
public abstract boolean runningLocally()
public abstract boolean isRunningLocally()
public abstract TaskContext addTaskCompletionListener(TaskCompletionListener listener)
listener
- (undocumented)public abstract TaskContext addTaskCompletionListener(scala.Function1<TaskContext,scala.runtime.BoxedUnit> f)
f
- (undocumented)public abstract void addOnCompleteCallback(scala.Function0<scala.runtime.BoxedUnit> f)
f
- Callback function.public abstract int stageId()
public abstract int partitionId()
public abstract int attemptNumber()
public abstract long attemptId()
public abstract long taskAttemptId()
public abstract org.apache.spark.executor.TaskMetrics taskMetrics()