Action and Build dispatcher

Those two are simple systemd services (daemons) performing infinite loop of taking tasks and processing them (see the diagram below). They use WorkerManager class abstraction that has it’s internal priority queue (each task is object from QueueTask class, and provides task.priority attribute).

../_images/dispatchers.uml.png

The important thing here is that each task needs to have unique task.id (among all other tasks). Then, even though we read the same set of tasks from frontend repeatedly, WorkerManager is able to track each task only once.

Frontend (or the dispatcher itself) can update the task priority between subsequent calls to get_frontend_tasks(). WorkerManager respects that, and silently re-orders the priority queue.

Note that add_task() method filters-out the tasks which are currently processed by any worker.