View Source AntikytheraCore.ExecutorPool.AsyncJobBroker (antikythera v0.5.1)
A broker that finds a pair of "a runnable job in job queue" and "an available AsyncJobRunner
process in worker pool".
This GenServer
becomes :active
when both antikythera and the job queue for the same executor pool are ready.
When entering :active
phase it notifies AntikytheraCore.TerminationManager
of the pid
so that it will be notified afterward.
Before host termination it becomes :inactive
on receipt of a message from AntikytheraCore.TerminationManager
;
from then on it won't start new jobs.
During :active
phase it checks out a process from the async job worker pool of the same executor pool,
fetches a job from the job queue, and tells the process to run the job.
Communications between broker and job queue are basically event-driven, i.e., no polling mechanism is needed for them to work, most of the time. However, in rare occasions, messages between them may be lost due to e.g. failure of majority members in the job queue's consensus group. Therefore we also use periodic polling to recover from this kind of troubles.
Summary
Functions
Returns a specification to start this module under a supervisor.
Functions
Returns a specification to start this module under a supervisor.
See Supervisor
.
@spec deactivate(pid()) :: :ok
@spec notify_job_registered(pid()) :: :ok
@spec notify_pool_capacity_may_have_changed(atom()) :: :ok