Open
Conversation
Contributor
42bea53 to
4fa5df7
Compare
4fa5df7 to
42bea53
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR proposes an Odoo.sh-oriented adjustment to
queue_jobso the runnercan still start and call back into Odoo in deployments where the traditional
server-wide assumptions do not hold.
Context
While validating
queue_jobon Odoo.sh, I ran into two practical limitationsin the current implementation:
Odoo.sh
queue_jobis not always loaded as a server-wide modulelocalhost,--http-interface,--http-port) are not a safe default for Odoo.sh workers, where the stableexternally reachable target is usually the canonical Odoo.sh hostname for the
database and stage
That combination means jobs can remain enqueued even though the addon is
installed and the queue is otherwise configured correctly.
What this PR does
queue_jobis not loaded inserver_wide_moduleshost is configured
https://<db_name>.dev.odoo.comfor non-production stages andhttps://<db_name>.odoo.comfor productionODOO_QUEUE_JOB_SCHEME,ODOO_QUEUE_JOB_HOST, andODOO_QUEUE_JOB_PORToverrides as the highest-priority behavior so customdomains or proxies can still be configured manually
/queue_job/runjob?db=...database resolution path workingso the lazy-started runner can still target the correct database
requirement around hostname reachability
How the limitations were handled
1. Runner bootstrap on Odoo.sh
The first limitation was that the runner was coupled to the usual server-wide
startup path. This branch handles that by adding a lazy bootstrap path:
queue_job/jobrunner/__init__.py_should_start_runner_thread_lazily(...)maybe_start_runner_thread(...)queue_job/post_load.pymaybe_start_runner_thread(...)fromRequest._serve_dbdbcapture monkey patch for/queue_job/runjobThis gives Odoo.sh a way to start the runner from an HTTP worker without
changing the traditional server-wide behavior for deployments that already load
queue_jobthere.2. Callback hostname selection
The second limitation was the default callback target. This branch handles that
in
queue_job/jobrunner/runner.pyby:_odoo_sh_stage()_odoo_sh_host(db_name, stage=None)_jobrunner_target(db_name, scheme=None, host=None, port=None)localhost:8069The fallback on Odoo.sh is the canonical hostname for the database and stage.
If operators need a different host, explicit env/config overrides still win.
Remaining limitations
This PR intentionally does not try to solve every possible hosting topology.
The main remaining limitations are:
ODOO_QUEUE_JOB_HOSTexplicitlyno explicit override is configured
host/scheme/port override mechanism already supported by env/config
I think that is the safer tradeoff for now: use a deterministic Odoo.sh default
and keep custom routing as an explicit operator choice rather than guessing
from website domains or
web.base.url.Main files changed
queue_job/jobrunner/__init__.pyqueue_job/jobrunner/runner.pyqueue_job/post_load.pyqueue_job/tests/test_runner_runner.pyqueue_job/readme/CONFIGURE.mdqueue_job/README.rstqueue_job/static/description/index.htmlValidation
selection
ODOO_QUEUE_JOB_HOSTexplicit: if no explicit host override is configured, the canonical Odoo.sh
hostname must remain reachable from the workers
Feedback welcome
I would especially appreciate feedback on two points:
Request._serve_dbis the right placeto bootstrap the runner on Odoo.sh
boundary for this fix, instead of trying to auto-discover a public host