class Mosquito::Runners::Overseer
- Mosquito::Runners::Overseer
- Reference
- Object
Overview
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.
Included Modules
Defined in:
mosquito/runners/overseer.crConstant Summary
-
Log =
::Log.for(self)
Constructors
Instance Method Summary
- #build_executor : Executor
-
#check_for_deceased_runners : Nil
If an executor dies, it's probably because a bug exists somewhere in Mosquito itself.
- #coordinator : Mosquito::Runners::Coordinator
-
#dequeue_job? : Tuple(JobRun, Queue) | Nil
Weaknesses: This implementation sometimes starves queues because it doesn't round robin, prioritize queues, or anything else.
-
#each_run : Nil
The goal for the overseer is to: - Ensure that the coordinator gets run frequently to schedule delayed/periodic jobs.
-
#executor_count : Int32
The number of executors to start.
- #executors : Array(Mosquito::Runners::Executor)
-
#idle_notifier : Channel(Bool)
When an executor transitions to idle it will send a True here.
- #idle_wait : Time::Span
-
#post_run : Nil
Notify all subprocesses to stop, and wait until they do.
-
#pre_run : Nil
Starts all the subprocesses.
- #queue_list : QueueList
-
#runnable_name : String
Used to print a pretty name for logging.
- #sleep
-
#work_handout : Channel({Mosquito::JobRun, Mosquito::Queue})
The channel where job runs which have been dequeued are sent to executors.
Instance methods inherited from module Mosquito::Runnable
dead? : Bool
dead?,
each_run : Nil
each_run,
fiber : Fiber | Nil
fiber,
my_name : String
my_name,
post_run : Nil
post_run,
pre_run : Nil
pre_run,
run
run,
runnable_name : String
runnable_name,
state : State
state,
stop : Channel(Bool)
stop
Instance methods inherited from module Mosquito::Runners::RunAtMost
execution_timestamps
execution_timestamps
Instance methods inherited from module Mosquito::Runners::IdleWait
with_idle_wait(idle_wait : Time::Span, &)
with_idle_wait
Constructor Detail
Instance Method Detail
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.
Weaknesses: This implementation sometimes starves queues because it doesn't round robin, prioritize queues, or anything else.
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.
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.
Used to print a pretty name for logging.
The channel where job runs which have been dequeued are sent to executors.