class

Mosquito::Runners::Overseer

Inherits Mosquito::Runnable < Mosquito::Runners::RunAtMost < Mosquito::Runners::IdleWait < Reference < Object

The Overseer is responsible for managing:

  • a Coordinator
  • an Executor
  • the QueueList
  • any idle state as configured

An overseer manages the loop that each thread or process runs.

Constants

Log = ::Log.for(self)

Constructors

Instance methods

build_executor
Source
check_for_deceased_runners

If an executor dies, it's probably because a bug exists somewhere in Mosquito itself.

When a job fails any exceptions are caught and logged. If a job causes something more catastrophic we can try to recover by spawning a new executor.

Source
coordinator
Source
dequeue_job?

Weaknesses: This implementation sometimes starves queues because it doesn't round robin, prioritize queues, or anything else.

Source
each_run

The goal for the overseer is to:

  • Ensure that the coordinator gets run frequently to schedule delayed/periodic jobs.
  • Wait for an executor to be idle, and dequeue work if possible.
  • Monitor the executor pool for unexpected termination and respawn.
Source
executor_count

The number of executors to start.

Source
executors
Source
idle_notifier

When an executor transitions to idle it will send a True here. The Overseer uses this as a signal to check the queues for more work.

Source
idle_wait
Source
post_run

Notify all subprocesses to stop, and wait until they do.

Source
pre_run

Starts all the subprocesses.

Source
queue_list
Source
runnable_name

Used to print a pretty name for logging.

Source
sleep
Source
work_handout

The channel where job runs which have been dequeued are sent to executors.

Source