Skip to content

[18.0][IMP] queue_job: Configure default subchannel capacity. #767

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: 18.0
Choose a base branch
from

Conversation

amh-mw
Copy link
Contributor

@amh-mw amh-mw commented May 7, 2025

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.

@OCA-git-bot
Copy link
Contributor

Hi @guewen,
some modules you are maintaining are being modified, check this out!

@amh-mw amh-mw force-pushed the 18.0-default_subchannel_capacity branch from 3b234e1 to 317854f Compare June 3, 2025 12:03
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.
@amh-mw amh-mw force-pushed the 18.0-default_subchannel_capacity branch from 317854f to 654f17e Compare June 3, 2025 17:46
Copy link
Member

@sbidoul sbidoul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good, thanks!

Could expand the docstring of parse_simple_config a bit (around line 823).

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.

@amh-mw
Copy link
Contributor Author

amh-mw commented Jun 6, 2025

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants