public abstract class Task<T>
extends Object
implements scala.Serializable
ShuffleMapTask
- ResultTask
A Spark job consists of one or more stages. The very last stage in a job consists of multiple ResultTasks, while earlier stages consist of ShuffleMapTasks. A ResultTask executes the task and sends the task output back to the driver application. A ShuffleMapTask executes the task and divides the task output to multiple buckets (based on the task's partitioner).
Constructor and Description |
---|
Task(int stageId,
int partitionId) |
Modifier and Type | Method and Description |
---|---|
static scala.Tuple3<scala.collection.mutable.HashMap<String,Object>,scala.collection.mutable.HashMap<String,Object>,java.nio.ByteBuffer> |
deserializeWithDependencies(java.nio.ByteBuffer serializedTask)
Deserialize the list of dependencies in a task serialized with serializeWithDependencies,
and return the task itself as a serialized ByteBuffer.
|
long |
epoch() |
void |
kill(boolean interruptThread)
Kills a task by setting the interrupted flag to true.
|
boolean |
killed()
Whether the task has been killed.
|
scala.Option<org.apache.spark.executor.TaskMetrics> |
metrics() |
int |
partitionId() |
scala.collection.Seq<TaskLocation> |
preferredLocations() |
T |
run(long taskAttemptId,
int attemptNumber)
Called by Executor to run this task.
|
abstract T |
runTask(TaskContext context) |
static java.nio.ByteBuffer |
serializeWithDependencies(Task<?> task,
scala.collection.mutable.HashMap<String,Object> currentFiles,
scala.collection.mutable.HashMap<String,Object> currentJars,
SerializerInstance serializer)
Serialize a task and the current app dependencies (files and JARs added to the SparkContext)
|
int |
stageId() |
public static java.nio.ByteBuffer serializeWithDependencies(Task<?> task, scala.collection.mutable.HashMap<String,Object> currentFiles, scala.collection.mutable.HashMap<String,Object> currentJars, SerializerInstance serializer)
public static scala.Tuple3<scala.collection.mutable.HashMap<String,Object>,scala.collection.mutable.HashMap<String,Object>,java.nio.ByteBuffer> deserializeWithDependencies(java.nio.ByteBuffer serializedTask)
public int stageId()
public int partitionId()
public final T run(long taskAttemptId, int attemptNumber)
taskAttemptId
- an identifier for this task attempt that is unique within a SparkContext.attemptNumber
- how many times this task has been attempted (0 for the first attempt)public abstract T runTask(TaskContext context)
public scala.collection.Seq<TaskLocation> preferredLocations()
public long epoch()
public scala.Option<org.apache.spark.executor.TaskMetrics> metrics()
public boolean killed()
public void kill(boolean interruptThread)