|
|
|
@ -30,9 +30,16 @@ especially when some kind of error happens on the server.
|
|
|
|
|
The `worker_registry` class is used to store information about workers, their
|
|
|
|
|
status and the jobs in their queue. It can look up a worker using the headers
|
|
|
|
|
received with a request (a worker is considered suitable if and only if it
|
|
|
|
|
satisfies all the headers). It also uses a basic load balancing algorithm -- the
|
|
|
|
|
satisfies all the headers). The headers are arbitrary key-value pairs, which
|
|
|
|
|
are checked for equality by the broker. However, some headers require special
|
|
|
|
|
handling, namely `threads`, for which we check if the value in the request is
|
|
|
|
|
lesser than or equal to the value advertised by the worker, and `hwgroup`, for
|
|
|
|
|
which we support requesting one of multiple hardware groups by listing multiple
|
|
|
|
|
names separated with a `|` symbol (e.g. `group_1|group_2|group_3`.
|
|
|
|
|
|
|
|
|
|
The registry also implements a basic load balancing algorithm -- the
|
|
|
|
|
workers are contained in a queue and whenever one of them receives a job, it is
|
|
|
|
|
moved to the back, which makes it less likely to receive another job soon.
|
|
|
|
|
moved to its end, which makes it less likely to receive another job soon.
|
|
|
|
|
|
|
|
|
|
When a worker is assigned a job, it will not be assigned another one until we
|
|
|
|
|
receive a `done` message from it.
|
|
|
|
|