Skip to content

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

Closed

Description

@JordiBForgeFlow

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?

Activity

  1. sbidoul commented on Jul 1, 2022

    @sbidoul
    Member

    @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.

  2. sbidoul commented on Jul 1, 2022

    @sbidoul
    Member

    See also #256

  3. github-actions commented on Jan 1, 2023

    @github-actions

    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.

  4. added
    stalePR/Issue without recent activity, it'll be soon closed automatically.
    on Jan 1, 2023
  5. daemonblade commented on Jan 24, 2023

    @daemonblade

    @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?

  6. added
    no staleUse this label to prevent the automated stale action from closing this PR/Issue.
    and removed
    stalePR/Issue without recent activity, it'll be soon closed automatically.
    on Jan 24, 2023
  7. sbidoul commented on Jan 25, 2023

    @sbidoul
    Member

    @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.

  8. b1zzu commented on Sep 7, 2023

    @b1zzu

    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'.
    
  9. sbidoul commented on Sep 7, 2023

    @sbidoul
    Member

    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.

  10. daemonblade commented on Oct 29, 2024

    @daemonblade

    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?

  11. LordSouza commented on Jan 31, 2025

    @LordSouza

    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?

  12. sbidoul commented on Jan 31, 2025

    @sbidoul
    Member

    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.

  13. daemonblade commented on Jan 31, 2025

    @daemonblade

    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?

  14. sbidoul commented on Jan 31, 2025

    @sbidoul
    Member

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    no staleUse this label to prevent the automated stale action from closing this PR/Issue.question

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions