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

[Question] queue_job when multiple odoo servers are used with load balancing (and single postgres) #422

Open
JordiBForgeFlow opened this issue Apr 8, 2022 · 12 comments · May be fixed by #668
Labels
no stale Use this label to prevent the automated stale action from closing this PR/Issue. question

Comments

@JordiBForgeFlow
Copy link
Member

In the scenario where multiple odoo servers are used with load balancing, and a single postgres server is used, will all of the odoo servers try to run all the jobs?

@sbidoul
Copy link
Member

sbidoul commented Jul 1, 2022

@JordiBForgeFlow you need to make sure that only one Odoo instance has queue_job in --load / server_wide_modules. This is very important.

Alternatively, you can launch a separate job runner process with something like #409.

@sbidoul sbidoul added question and removed bug labels Jul 1, 2022
@sbidoul
Copy link
Member

sbidoul commented Jul 1, 2022

See also #256

@github-actions
Copy link

github-actions bot commented Jan 1, 2023

There hasn't been any activity on this issue in the past 6 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 issue to never become stale, please ask a PSC member to apply the "no stale" label.

@github-actions github-actions bot added the stale PR/Issue without recent activity, it'll be soon closed automatically. label Jan 1, 2023
@daemonblade
Copy link

daemonblade commented Jan 24, 2023

@sbidoul having to tweak the configuration for one instance can become an issue when we have to deploy to a variable number of Odoo instances. Is it not possible to namescope the NOTIFY payload with host/main-odoo-pid/dbname to allow multiple job-runners to be active?

@sbidoul sbidoul added no stale Use this label to prevent the automated stale action from closing this PR/Issue. and removed stale PR/Issue without recent activity, it'll be soon closed automatically. labels Jan 24, 2023
@sbidoul
Copy link
Member

sbidoul commented Jan 25, 2023

@sbidoul having to tweak the configuration for one instance can become an issue when we have to deploy to a variable number of Odoo instances. Is it not possible to namescope the NOTIFY payload with host/main-odoo-pid/dbname to allow multiple job-runners to be active?

@daemonblade in such situations, I don't add queue_job to server_wide_modules, and instead start the job runner independently, so all Odoo instances can share the same config.

Multiple job runners is tricky because it is currently all based on the queue being in memory.

@b1zzu
Copy link

b1zzu commented Sep 7, 2023

Hi @sbidoul how can I run the queue_job independently? I've tried this PYTHONPATH=/opt/odoo/ python3 -m queue_job.jobrunner but doesn't work, it fails with this error:

AssertionError: Invalid import of queue_job.models.base.Base, it should start with 'odoo.addons'.

@sbidoul
Copy link
Member

sbidoul commented Sep 7, 2023

Try python3 -m odoo.addons.queue_job.jobrunner.

You'll need to add {queue-job-repo-dir}/setup/queue_job to PYTHONPATH or install odoo-addon-queue_job with pip.

@daemonblade
Copy link

daemonblade commented Oct 29, 2024

I've reviewed our logs for multi-node systems with queue_job. We have one instance configured with queue_job in server_wide_modules. What I have noticed is that the instances that do NOT have queue_job in server_wide_modules will never run any jobs at all. Is this intended?

@LordSouza
Copy link

Try python3 -m odoo.addons.queue_job.jobrunner.

You'll need to add {queue-job-repo-dir}/setup/queue_job to PYTHONPATH or install odoo-addon-queue_job with pip.

this 'odoo-addon-queue_job' is asking for python>=3.10 or higher, but we use 3.8 and when I try to use the PYTHONPATH it doesn't work because the job_queue path is different than odoo.addons, is there a way to run as a external module?

@sbidoul
Copy link
Member

sbidoul commented Jan 31, 2025

With #668 we will not need to worry about this, as queue job will manage a leader election automatically. The only constraint will be that all instances manage the same list of databases.

@daemonblade
Copy link

Will this commit allow the same configuration file for all Odoo instances, or will it require that only ONE instance have queue_job in server_wide_modules?

@sbidoul
Copy link
Member

sbidoul commented Jan 31, 2025

Yes, same config on all instances will work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no stale Use this label to prevent the automated stale action from closing this PR/Issue. question
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants