public class TaskSetManager extends Object implements Schedulable, Logging
THREADING: This class is designed to only be called from code with a lock on the TaskScheduler (e.g. its event handlers). It should not be called from other threads.
Constructor and Description |
---|
TaskSetManager(TaskSchedulerImpl sched,
TaskSet taskSet,
int maxTaskFailures,
Clock clock) |
Modifier and Type | Method and Description |
---|---|
void |
abort(String message) |
void |
addRunningTask(long tid)
If the given task ID is not in the set of running tasks, adds it.
|
void |
addSchedulable(Schedulable schedulable) |
scala.collection.mutable.ArrayBuffer<Object> |
allPendingTasks() |
int |
calculatedTasks() |
boolean |
canFetchMoreResults(long size)
Check whether has enough quota to fetch the result with
size bytes |
boolean |
checkSpeculatableTasks()
Check for tasks to be speculated and return true if there are any.
|
SparkConf |
conf() |
int[] |
copiesRunning() |
int |
currentLocalityIndex() |
boolean |
emittedTaskSizeWarning() |
SparkEnv |
env() |
long |
epoch() |
long |
EXCEPTION_PRINT_INTERVAL() |
void |
executorAdded() |
void |
executorLost(String execId,
String host)
Called by TaskScheduler when an executor is lost so we can re-enqueue our tasks
|
int |
getLocalityIndex(scala.Enumeration.Value locality)
Find the index in myLocalityLevels for a given locality.
|
Schedulable |
getSchedulableByName(String name) |
scala.collection.mutable.ArrayBuffer<TaskSetManager> |
getSortedTaskSetQueue() |
void |
handleFailedTask(long tid,
scala.Enumeration.Value state,
TaskEndReason reason)
Marks the task as failed, re-adds it to the list of pending tasks, and notifies the
DAG Scheduler.
|
void |
handleSuccessfulTask(long tid,
DirectTaskResult<?> result)
Marks the task as successful and notifies the DAGScheduler that a task has ended.
|
void |
handleTaskGettingResult(long tid)
Marks the task as getting result and notifies the DAG Scheduler
|
boolean |
isZombie() |
long |
lastLaunchTime() |
long[] |
localityWaits() |
long |
maxResultSize() |
int |
maxTaskFailures() |
int |
minShare() |
scala.Enumeration.Value[] |
myLocalityLevels() |
String |
name() |
int |
numTasks() |
Pool |
parent() |
scala.collection.mutable.ArrayBuffer<Object> |
pendingTasksWithNoPrefs() |
int |
priority() |
scala.collection.mutable.HashMap<String,scala.Tuple2<Object,Object>> |
recentExceptions() |
void |
recomputeLocality() |
void |
removeRunningTask(long tid)
If the given task ID is in the set of running tasks, removes it.
|
void |
removeSchedulable(Schedulable schedulable) |
scala.Option<TaskDescription> |
resourceOffer(String execId,
String host,
scala.Enumeration.Value maxLocality)
Respond to an offer of a single executor from the scheduler by finding a task
|
int |
runningTasks() |
scala.collection.mutable.HashSet<Object> |
runningTasksSet() |
scala.Null |
schedulableQueue() |
scala.Enumeration.Value |
schedulingMode() |
SerializerInstance |
ser() |
scala.collection.mutable.HashSet<Object> |
speculatableTasks() |
double |
SPECULATION_MULTIPLIER() |
double |
SPECULATION_QUANTILE() |
int |
stageId() |
boolean[] |
successful() |
static int |
TASK_SIZE_TO_WARN_KB() |
scala.collection.immutable.List<TaskInfo>[] |
taskAttempts() |
scala.collection.mutable.HashMap<Object,TaskInfo> |
taskInfos() |
Task<?>[] |
tasks() |
TaskSet |
taskSet() |
int |
tasksSuccessful() |
long |
totalResultSize() |
int |
weight() |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
initializeIfNecessary, initializeLogging, isTraceEnabled, log_, log, logDebug, logDebug, logError, logError, logInfo, logInfo, logName, logTrace, logTrace, logWarning, logWarning
public TaskSetManager(TaskSchedulerImpl sched, TaskSet taskSet, int maxTaskFailures, Clock clock)
public static int TASK_SIZE_TO_WARN_KB()
public TaskSet taskSet()
public int maxTaskFailures()
public SparkConf conf()
public double SPECULATION_QUANTILE()
public double SPECULATION_MULTIPLIER()
public long maxResultSize()
public SparkEnv env()
public SerializerInstance ser()
public Task<?>[] tasks()
public int numTasks()
public int[] copiesRunning()
public boolean[] successful()
public scala.collection.immutable.List<TaskInfo>[] taskAttempts()
public int tasksSuccessful()
public int weight()
weight
in interface Schedulable
public int minShare()
minShare
in interface Schedulable
public int priority()
priority
in interface Schedulable
public int stageId()
stageId
in interface Schedulable
public String name()
name
in interface Schedulable
public Pool parent()
parent
in interface Schedulable
public long totalResultSize()
public int calculatedTasks()
public scala.collection.mutable.HashSet<Object> runningTasksSet()
public int runningTasks()
runningTasks
in interface Schedulable
public boolean isZombie()
public scala.collection.mutable.ArrayBuffer<Object> pendingTasksWithNoPrefs()
public scala.collection.mutable.ArrayBuffer<Object> allPendingTasks()
public scala.collection.mutable.HashSet<Object> speculatableTasks()
public scala.collection.mutable.HashMap<Object,TaskInfo> taskInfos()
public long EXCEPTION_PRINT_INTERVAL()
public scala.collection.mutable.HashMap<String,scala.Tuple2<Object,Object>> recentExceptions()
public long epoch()
public scala.Enumeration.Value[] myLocalityLevels()
public long[] localityWaits()
public int currentLocalityIndex()
public long lastLaunchTime()
public scala.Null schedulableQueue()
schedulableQueue
in interface Schedulable
public scala.Enumeration.Value schedulingMode()
schedulingMode
in interface Schedulable
public boolean emittedTaskSizeWarning()
public scala.Option<TaskDescription> resourceOffer(String execId, String host, scala.Enumeration.Value maxLocality)
NOTE: this function is either called with a maxLocality which would be adjusted by delay scheduling algorithm or it will be with a special NO_PREF locality which will be not modified
execId
- the executor Id of the offered resourcehost
- the host Id of the offered resourcemaxLocality
- the maximum locality we want to schedule the tasks atpublic int getLocalityIndex(scala.Enumeration.Value locality)
public void handleTaskGettingResult(long tid)
public boolean canFetchMoreResults(long size)
size
bytespublic void handleSuccessfulTask(long tid, DirectTaskResult<?> result)
public void handleFailedTask(long tid, scala.Enumeration.Value state, TaskEndReason reason)
public void abort(String message)
public void addRunningTask(long tid)
Used to keep track of the number of running tasks, for enforcing scheduling policies.
public void removeRunningTask(long tid)
public Schedulable getSchedulableByName(String name)
getSchedulableByName
in interface Schedulable
public void addSchedulable(Schedulable schedulable)
addSchedulable
in interface Schedulable
public void removeSchedulable(Schedulable schedulable)
removeSchedulable
in interface Schedulable
public scala.collection.mutable.ArrayBuffer<TaskSetManager> getSortedTaskSetQueue()
getSortedTaskSetQueue
in interface Schedulable
public void executorLost(String execId, String host)
executorLost
in interface Schedulable
public boolean checkSpeculatableTasks()
TODO: To make this scale to large jobs, we need to maintain a list of running tasks, so that we don't scan the whole task set. It might also help to make this sorted by launch time.
checkSpeculatableTasks
in interface Schedulable
public void recomputeLocality()
public void executorAdded()