Skip to content
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

fix(queue_job): out-of-the-box support in test environments #470

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

Conversation

yajo
Copy link
Contributor

@yajo yajo commented May 17, 2024

When you use queue_job, it is common to add some configuration to it.

The canonical way to do that with doodba would be to put a file in some path such as odoo/custom/conf.d/queue_job.conf and contents like these:

[options]
(...)
workers = 6
server_wide_modules = base,web,queue_job

(...)
[queue_job]
channels = root:3

However, in that case, the file would be used too by a test environment.

Test environments have 2 workers hardcoded, to save computational power for the production instance:

However, if you configure 2 workers with channels = root:3, you're doomed. Any delayed action in a test environment will block the server. At least, if the amount of delayed actions in batch is more than the current workers.

I'm adding docs to queue_job in OCA/queue#650 to make this behavior clear. Also, here I'm adding an environment variable that will be harmless in test environments without queue_job, but will provide a sane default for those that use it.

@moduon MT-6106

@pedrobaeza
Copy link
Member

And what happen if you define other subchannels with more capacity? Are all of them limited by the general one?

The CI is also broken, don't know why.

@yajo
Copy link
Contributor Author

yajo commented Jun 12, 2024

And what happen if you define other subchannels with more capacity? Are all of them limited by the general one?

The docs say that the number of workers should be greater than the number of channels. How you segregate those channels won't change that sentence AFAIK.

Since environment variables get higher priority than file configs, in the test environment there'll be no other channels with this fix.

I ammended to see if the tests were failing just temporarily.

When you use queue_job, it is common to add some configuration to it.

The canonical way to do that with doodba would be to put a file in some path such as `odoo/custom/conf.d/queue_job.conf` and contents like these:

```ini
[options]
(...)
workers = 6
server_wide_modules = base,web,queue_job

(...)
[queue_job]
channels = root:3
```

However, in that case, the file would be used too by a test environment.

Test environments have 2 workers hardcoded, to save computational power for the production instance: https://github.com/Tecnativa/doodba-copier-template/blob/e2f4efdab336d5cd32c327a007983011e1e4edbb/test.yaml.jinja#L50

However, if you configure 2 workers with `channels = root:3`, you're doomed. Any delayed action in a test environment will block the server. At least, if the amount of delayed actions in batch is more than the current workers.

I'm adding docs to queue_job in OCA/queue#650 to make this behavior clear. Also, here I'm adding an environment variable that will be harmless in test environments without `queue_job`, but will provide a sane default for those that use it.

Also I configure 3 workers by default because, if you use `queue_job` to print a report, one worker would be for printing, other for queue_job, and you'd still need another one to use the UI.

@moduon MT-6106
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.

2 participants