@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()
SchedulingPolicygetScheduleTimeoutMs in interface SchedulingPolicypublic boolean scheduleTaskGroup(ScheduledTaskGroup scheduledTaskGroup, JobStateManager jobStateManager)
SchedulingPolicyscheduleTaskGroup in interface SchedulingPolicyscheduledTaskGroup - to schedule.jobStateManager - jobStateManager which the TaskGroup belongs to.public void onExecutorAdded(String executorId)
SchedulingPolicyonExecutorAdded in interface SchedulingPolicyexecutorId - for the executor that has been added.public Set<String> onExecutorRemoved(String executorId)
SchedulingPolicyonExecutorRemoved in interface SchedulingPolicyexecutorId - for the executor that has been deleted.public void onTaskGroupExecutionComplete(String executorId, String taskGroupId)
SchedulingPolicyonTaskGroupExecutionComplete in interface SchedulingPolicyexecutorId - of the executor where the taskGroup's execution has completed.taskGroupId - whose execution has completed.public void onTaskGroupExecutionFailed(String executorId, String taskGroupId)
SchedulingPolicyonTaskGroupExecutionFailed in interface SchedulingPolicyexecutorId - of the executor where the taskGroup's execution has failed.taskGroupId - whose execution has completed.Copyright © 2018. All rights reserved.