Class SimulationScheduler
- java.lang.Object
-
- org.apache.nemo.runtime.master.scheduler.SimulationScheduler
-
- All Implemented Interfaces:
Scheduler
@NotThreadSafe public final class SimulationScheduler extends java.lang.Object implements Scheduler
Scheduler for simulating an execution not controlled by the runtime master. This class follows the structure ofBatchScheduler
, so when a change has to be made on BatchScheduler, it also means that it should be reflected in this class as well.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MetricStore
collectMetricStore()
The endpoint of the simulator.PlanStateManager
getPlanStateManager()
void
onExecutorAdded(ExecutorRepresenter executorRepresenter)
Called when an executor is added to Runtime, so that the extra resource can be used to execute the job.void
onExecutorRemoved(java.lang.String executorId)
Called when an executor is removed from Runtime, so that faults related to the removal can be handled.void
onRunTimePassMessage(java.lang.String taskId, java.lang.Object data)
Process the RuntimePassMessage.void
onSpeculativeExecutionCheck()
Called to check for speculative execution.void
onTaskStateReportFromExecutor(java.lang.String executorId, java.lang.String taskId, int attemptIdx, TaskState.State newState, java.lang.String taskPutOnHold, TaskState.RecoverableTaskFailureCause failureCause)
Called when a Task's execution state changes.void
reset()
Reset the instance to its initial state.void
schedulePlan(PhysicalPlan submittedPhysicalPlan, int maxScheduleAttempt)
The entrance point of the simulator.void
terminate()
To be called when a job should be terminated.void
updatePlan(PhysicalPlan newPhysicalPlan)
Receives and updates the scheduler with a new physical plan for a job.
-
-
-
Method Detail
-
reset
public void reset()
Reset the instance to its initial state.
-
getPlanStateManager
public PlanStateManager getPlanStateManager()
-
schedulePlan
public void schedulePlan(PhysicalPlan submittedPhysicalPlan, int maxScheduleAttempt)
The entrance point of the simulator. Simulate a plan by submitting a plan through this method.- Specified by:
schedulePlan
in interfaceScheduler
- Parameters:
submittedPhysicalPlan
- the plan to simulate.maxScheduleAttempt
- the max number of times this plan/sub-part of the plan should be attempted.
-
updatePlan
public void updatePlan(PhysicalPlan newPhysicalPlan)
Description copied from interface:Scheduler
Receives and updates the scheduler with a new physical plan for a job.- Specified by:
updatePlan
in interfaceScheduler
- Parameters:
newPhysicalPlan
- new physical plan for the job.
-
onExecutorAdded
public void onExecutorAdded(ExecutorRepresenter executorRepresenter)
Description copied from interface:Scheduler
Called when an executor is added to Runtime, so that the extra resource can be used to execute the job.- Specified by:
onExecutorAdded
in interfaceScheduler
- Parameters:
executorRepresenter
- a representation of the added executor.
-
onExecutorRemoved
public void onExecutorRemoved(java.lang.String executorId)
Description copied from interface:Scheduler
Called when an executor is removed from Runtime, so that faults related to the removal can be handled.- Specified by:
onExecutorRemoved
in interfaceScheduler
- Parameters:
executorId
- of the executor that has been removed.
-
onRunTimePassMessage
public void onRunTimePassMessage(java.lang.String taskId, java.lang.Object data)
Process the RuntimePassMessage.- Parameters:
taskId
- that generated the message.data
- of the message.
-
onTaskStateReportFromExecutor
public void onTaskStateReportFromExecutor(java.lang.String executorId, java.lang.String taskId, int attemptIdx, TaskState.State newState, @Nullable java.lang.String taskPutOnHold, TaskState.RecoverableTaskFailureCause failureCause)
Description copied from interface:Scheduler
Called when a Task's execution state changes.- Specified by:
onTaskStateReportFromExecutor
in interfaceScheduler
- Parameters:
executorId
- of the executor in which the Task is executing.taskId
- of the Task whose state must be updated.attemptIdx
- the number of times this Task has executed. ************** the below parameters are only valid for failures *****************newState
- for the Task.taskPutOnHold
- the ID of task that are put on hold. It is null otherwise.failureCause
- for which the Task failed in the case of a recoverable failure.
-
collectMetricStore
public MetricStore collectMetricStore()
The endpoint of the simulator. Collect the metric store, and terminate the simulator.- Returns:
- the metrics of the simulation.
-
onSpeculativeExecutionCheck
public void onSpeculativeExecutionCheck()
Description copied from interface:Scheduler
Called to check for speculative execution.- Specified by:
onSpeculativeExecutionCheck
in interfaceScheduler
-
-