[18.0][IMP] queue_job: Configure default subchannel capacity.
This adds a new subcapacity option to channels that allows the configuration of the default capacity for autocreated child channels.
For example, environment ODOO_QUEUE_JOB_CHANNELS=root:8:subcapacity=1 would set the capacity of an autocreated root.sub channel to 1.
Hi @guewen, some modules you are maintaining are being modified, check this out!
The only question I'd have is if we can come up for a better name to convey "default subchannel capacity". I don't have any better idea for now.
Given existing documentation:
Channels: give a capacity for the root channel and its sub-channels and segregate jobs in them. Allow for instance to restrict heavy jobs to be executed one at a time while little ones are executed 4 at a times.
Noodling around in tests:
cm = channels.ChannelManager()
cm.simple_configure("root:2,child")
root = cm.get_channel_by_name("root")
self.assertEqual(root.capacity, 2)
child = cm.get_channel_by_name("child")
self.assertEqual(child.capacity, 1)
auto = cm.get_channel_by_name("auto", autocreate=True)
self.assertEqual(auto.capacity, None)
The difference in capacity between an autocreated subchannel and a configured subchannel was the impetus for the creation of this pull request. Maybe rename subcapacity to autocapacity? Testing shows that the new setting does not change the capacity for configured subchannels.
cm = channels.ChannelManager()
cm.simple_configure("root:4:subcapacity=2,child")
root = cm.get_channel_by_name("root")
self.assertEqual(root.capacity, 4)
child = cm.get_channel_by_name("child")
self.assertEqual(child.capacity, 1)
There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days. If you want this PR to never become stale, please ask a PSC member to apply the "no stale" label.
Hi, awesome feature great job. May you merge? @amh-mw