Class BatchScheduler

  • All Implemented Interfaces:

    public final class BatchScheduler
    extends Object
    implements Scheduler
    (CONCURRENCY) Only a single dedicated thread should use the public methods of this class. (i.e., runtimeMasterThread in RuntimeMaster)

    BatchScheduler receives a single PhysicalPlan to execute and schedules the Tasks.

    • Method Detail

      • 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
        newPhysicalPlan - new physical plan for the job.
      • onRunTimePassMessage

        public void onRunTimePassMessage​(String taskId,
                                         Object data)
        taskId - that generated the message.
        data - of the message.
      • schedulePlan

        public void schedulePlan​(PhysicalPlan submittedPhysicalPlan,
                                 int maxScheduleAttempt)
        Schedules a given plan. If multiple physical plans are submitted, they will be appended and handled as a single plan. TODO #182: Consider reshaping in run-time optimization. At now, we only consider plan appending.
        Specified by:
        schedulePlan in interface Scheduler
        submittedPhysicalPlan - the physical plan to schedule.
        maxScheduleAttempt - the max number of times this plan/sub-part of the plan should be attempted.
      • onTaskStateReportFromExecutor

        public void onTaskStateReportFromExecutor​(String executorId,
                                                  String taskId,
                                                  int taskAttemptIndex,
                                                  TaskState.State newState,
                                                  String vertexPutOnHold,
                                                  TaskState.RecoverableTaskFailureCause failureCause)
        Handles task state transition notifications sent from executors. Note that we can receive notifications for previous task attempts, due to the nature of asynchronous events. We ignore such late-arriving notifications, and only handle notifications for the current task attempt.
        Specified by:
        onTaskStateReportFromExecutor in interface Scheduler
        executorId - the id of the executor where the message was sent from.
        taskId - whose state has changed
        taskAttemptIndex - of the task whose state has changed
        newState - the state to change to
        vertexPutOnHold - the ID of vertex that is put on hold. It is null otherwise.
        failureCause - for which the Task failed in the case of a recoverable failure.
      • onSpeculativeExecutionCheck

        public void onSpeculativeExecutionCheck()
        Description copied from interface: Scheduler
        Called to check for speculative execution.
        Specified by:
        onSpeculativeExecutionCheck in interface Scheduler
      • 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
        executorRepresenter - a representation of the added executor.
      • onExecutorRemoved

        public void onExecutorRemoved​(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
        executorId - of the executor that has been removed.
      • 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