Worker selectors
Allows to bind devices to specific workers.
Every device and some other systems could be binded for processing on
a specific worker. This might be useful when you have go-home
running in
multiple locations and using selectors, you could distribute
devices across these locations.
By default you can use worker name, for additional labels you can use worker properties.
Device binding is looking for workerSelectors
configuration. It expects to get
list of glob-based key:value
pairs.
WARN Only values could be described with wildcards
The following logic is used for selecting device:
- Master load all devices configurations
- Master receives
discovery
message from workers - Master first assigns all devices with
workerSelectors
configuration - For the rest of devices, master tries to evenly distribute them across workers
- If worker has more devices that specified in
maxDevices
configuration, master is not picking this worker
Examples
Given that you have two workers:
system: go-home
provider: worker
name: worker-1
properties:
location: home
---
system: go-home
provider: worker
name: worker-2
properties:
location: work
The following device will be binded to worker-1
:
system: device
provider: hub/hue
name: hue
workerSelectors:
location: "?om*"
And this one will be randomly (depending on number of devices) assigned to one of the workers:
system: device
provider: hub/hue
name: hue
workerSelectors:
name: worker*