@ThreadSafe public final class RoundRobinSchedulingPolicy extends Object implements SchedulingPolicy
BatchSingleJobScheduler
.
This policy keeps a list of available ExecutorRepresenter
for each type of container.
The RR policy is used for each container type when trying to schedule a task group.Constructor and Description |
---|
RoundRobinSchedulingPolicy(ContainerManager containerManager,
int scheduleTimeoutMs) |
Modifier and Type | Method and Description |
---|---|
long |
getScheduleTimeoutMs()
Returns this scheduling policy's timeout before an executor assignment.
|
void |
onExecutorAdded(String executorId)
Adds the executorId to the pool of available executors.
|
Set<String> |
onExecutorRemoved(String executorId)
Deletes the executorId from the pool of available executors.
|
void |
onTaskGroupExecutionComplete(String executorId,
String taskGroupId)
Marks the taskGroup's completion in the executor.
|
void |
onTaskGroupExecutionFailed(String executorId,
String taskGroupId)
Marks the taskGroup's failure in the executor.
|
boolean |
scheduleTaskGroup(ScheduledTaskGroup scheduledTaskGroup,
JobStateManager jobStateManager)
Attempts to schedule the given taskGroup to an executor according to this policy.
|
@Inject public RoundRobinSchedulingPolicy(ContainerManager containerManager, int scheduleTimeoutMs)
public long getScheduleTimeoutMs()
SchedulingPolicy
getScheduleTimeoutMs
in interface SchedulingPolicy
public boolean scheduleTaskGroup(ScheduledTaskGroup scheduledTaskGroup, JobStateManager jobStateManager)
SchedulingPolicy
scheduleTaskGroup
in interface SchedulingPolicy
scheduledTaskGroup
- to schedule.jobStateManager
- jobStateManager which the TaskGroup belongs to.public void onExecutorAdded(String executorId)
SchedulingPolicy
onExecutorAdded
in interface SchedulingPolicy
executorId
- for the executor that has been added.public Set<String> onExecutorRemoved(String executorId)
SchedulingPolicy
onExecutorRemoved
in interface SchedulingPolicy
executorId
- for the executor that has been deleted.public void onTaskGroupExecutionComplete(String executorId, String taskGroupId)
SchedulingPolicy
onTaskGroupExecutionComplete
in interface SchedulingPolicy
executorId
- of the executor where the taskGroup's execution has completed.taskGroupId
- whose execution has completed.public void onTaskGroupExecutionFailed(String executorId, String taskGroupId)
SchedulingPolicy
onTaskGroupExecutionFailed
in interface SchedulingPolicy
executorId
- of the executor where the taskGroup's execution has failed.taskGroupId
- whose execution has completed.Copyright © 2018. All rights reserved.