Class Scheduler

java.lang.Object
nz.org.riskscape.engine.sched.Scheduler
All Implemented Interfaces:
Runnable

public class Scheduler extends Object implements Runnable

The Scheduler oversees the execution of the pipeline tasks. Mostly this involves assigning WorkerTasks to the Worker threads.

TODO rename methods called by scheduler thread to make it clearer

  • Field Details

  • Constructor Details

    • Scheduler

      public Scheduler(nz.org.riskscape.engine.sched.SchedulerParams params, nz.org.riskscape.problem.ProblemSink problemSink)
  • Method Details

    • run

      public void run()
      Specified by:
      run in interface Runnable
    • allTasksComplete

      public boolean allTasksComplete()
    • stop

      public void stop(boolean join)

      Stop the scheduler from scheduling more work

      Parameters:
      join - if true, this method will only return once all threads have ended. This can block if any workers are blocked, but otherwise should return fairly promptly
    • workerFinished

      public void workerFinished()

      Notifies the scheduler that a task has finished running for now. This doesn't necessarily mean the task is complete - it may have stopped because it's blocked waiting on input or output. But the worker thread is now idle and can start processing another task.

    • queueJob

      public Future<nz.org.riskscape.engine.pipeline.ExecutionResult> queueJob(nz.org.riskscape.engine.output.PipelineJobContext context)
    • getWaitingTasks

      public List<WorkerTask> getWaitingTasks()
    • getRunningTasks

      public List<WorkerTask> getRunningTasks()
    • getCompletedTasks

      public List<WorkerTask> getCompletedTasks()