Class 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 of BatchScheduler, so when a change has to be made on BatchScheduler, it also means that it should be reflected in this class as well.
    • Method Detail

      • reset

        public void reset()
        Reset the instance to its initial state.
      • 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 interface Scheduler
        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 interface Scheduler
        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 interface Scheduler
        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 interface Scheduler
        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 interface Scheduler
        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 interface Scheduler
      • terminate

        public void terminate()
        Description copied from interface: Scheduler
        To be called when a job should be terminated. Any clean up code should be implemented in this method.
        Specified by:
        terminate in interface Scheduler