Adding support for multiple subgroups #128
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds support for multiple work subgroups.
Subgroups are formed by introducing multiple pubsub topics to which work (roll calls) are published to. Changes are backwards compatible - if no explicit configuration is done, everything should work like before, and all nodes use the default topic as before (
blockless/b7s/general
).Operators can instruct their work nodes to make themselves available to specific topics of work by using CLI parameters, e.g.
node --topic blockless/b7s/topic1 --topic blockless/b7s/topic3
. Note that worker can include a list of topics. The default topic is always included as it's used to transmit some general data like health pings.To direct work to a subgroup, HTTP requests to the head node execution endpoint (
/api/v1/functions/execute
) should include thesubgroup
field, e.g.If the subgroup is not specified, it's published to the general topic, which all worker nodes belong to.
Worker nodes have to have their topics specified on boot, and they will subscribe to all of them. However, head nodes do not. If a head node sees a
subgroup
it has not seen before, it will try to join that topic and publish to it, even if it's new to it (fanout messages). This makes the head node more flexible and doesn't require it to know a lot in advance.Function install messages can also be directed to a specific subgroup.
Since we now have multiple subscriptions for ingress messages, main node run loop has been somewhat tweaked (and can be cleaner, but will be in a later PR).