public final class BatchSingleJobScheduler extends Object implements Scheduler
PhysicalPlan
to execute and schedules the TaskGroups.
The policy by which it schedules them is dependent on the implementation of SchedulingPolicy
.Constructor and Description |
---|
BatchSingleJobScheduler(SchedulingPolicy schedulingPolicy,
SchedulerRunner schedulerRunner,
PendingTaskGroupQueue pendingTaskGroupQueue,
BlockManagerMaster blockManagerMaster,
PubSubEventHandlerWrapper pubSubEventHandlerWrapper,
UpdatePhysicalPlanEventHandler updatePhysicalPlanEventHandler) |
Modifier and Type | Method and Description |
---|---|
void |
onExecutorAdded(String executorId)
Called when an executor is added to Runtime, so that the extra resource can be used to execute the job.
|
void |
onExecutorRemoved(String executorId)
Called when an executor is removed from Runtime, so that faults related to the removal can be handled.
|
void |
onTaskGroupStateChanged(String executorId,
String taskGroupId,
TaskGroupState.State newState,
int attemptIdx,
String taskPutOnHold,
TaskGroupState.RecoverableFailureCause failureCause)
Receives a
ControlMessage.TaskGroupStateChangedMsg from an executor. |
void |
scheduleJob(PhysicalPlan jobToSchedule,
JobStateManager scheduledJobStateManager)
Receives a job to schedule.
|
void |
terminate()
To be called when a job should be terminated.
|
void |
updateJob(String jobId,
PhysicalPlan newPhysicalPlan,
Pair<String,String> taskInfo)
Receives and updates the scheduler with a new physical plan for a job.
|
@Inject public BatchSingleJobScheduler(SchedulingPolicy schedulingPolicy, SchedulerRunner schedulerRunner, PendingTaskGroupQueue pendingTaskGroupQueue, BlockManagerMaster blockManagerMaster, PubSubEventHandlerWrapper pubSubEventHandlerWrapper, UpdatePhysicalPlanEventHandler updatePhysicalPlanEventHandler)
public void scheduleJob(PhysicalPlan jobToSchedule, JobStateManager scheduledJobStateManager)
scheduleJob
in interface Scheduler
jobToSchedule
- the physical plan for the job.scheduledJobStateManager
- to keep track of the submitted job's states.public void updateJob(String jobId, PhysicalPlan newPhysicalPlan, Pair<String,String> taskInfo)
Scheduler
public void onTaskGroupStateChanged(String executorId, String taskGroupId, TaskGroupState.State newState, int attemptIdx, @Nullable String taskPutOnHold, TaskGroupState.RecoverableFailureCause failureCause)
ControlMessage.TaskGroupStateChangedMsg
from an executor.
The message is received via communicator where this method is called.onTaskGroupStateChanged
in interface Scheduler
executorId
- the id of the executor where the message was sent from.taskGroupId
- whose state has changednewState
- the state to change totaskPutOnHold
- the ID of task that are put on hold. It is null otherwise.attemptIdx
- the number of times this TaskGroup has executed.
the below parameters are only valid for failures *****************failureCause
- for which the TaskGroup failed in the case of a recoverable failure.public void onExecutorAdded(String executorId)
Scheduler
onExecutorAdded
in interface Scheduler
executorId
- of the executor that has been added.public void onExecutorRemoved(String executorId)
Scheduler
onExecutorRemoved
in interface Scheduler
executorId
- of the executor that has been removed.Copyright © 2018. All rights reserved.