Skip to content

Commit 91189f0

Browse files
committed
[REF] queue_job: documentation cleanup
1 parent da1494b commit 91189f0

2 files changed

Lines changed: 14 additions & 108 deletions

File tree

queue_job/jobrunner/runner.py

Lines changed: 1 addition & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -16,111 +16,7 @@
1616
* It maintains an in-memory priority queue of jobs that
1717
is populated from the queue_job tables in all databases.
1818
* It does not run jobs itself, but asks Odoo to run them through an
19-
anonymous ``/queue_job/runjob`` HTTP request. [1]_
20-
21-
How to use it?
22-
--------------
23-
24-
* Optionally adjust your configuration through environment variables:
25-
26-
- ``ODOO_QUEUE_JOB_CHANNELS=root:4`` (or any other channels
27-
configuration), default ``root:1``.
28-
- ``ODOO_QUEUE_JOB_SCHEME=https``, default ``http``.
29-
- ``ODOO_QUEUE_JOB_HOST=load-balancer``, default ``http_interface``
30-
or ``localhost`` if unset.
31-
- ``ODOO_QUEUE_JOB_PORT=443``, default ``http_port`` or 8069 if unset.
32-
- ``ODOO_QUEUE_JOB_HTTP_AUTH_USER=jobrunner``, default empty.
33-
- ``ODOO_QUEUE_JOB_HTTP_AUTH_PASSWORD=s3cr3t``, default empty.
34-
- ``ODOO_QUEUE_JOB_JOBRUNNER_DB_HOST=master-db``, default ``db_host``
35-
or ``False`` if unset.
36-
- ``ODOO_QUEUE_JOB_JOBRUNNER_DB_PORT=5432``, default ``db_port``
37-
or ``False`` if unset.
38-
- ``ODOO_QUEUE_JOB_JOBRUNNER_DB_USER=userdb``, default ``db_user``
39-
or ``False`` if unset.
40-
- ``ODOO_QUEUE_JOB_JOBRUNNER_DB_PASSWORD=passdb``, default ``db_password``
41-
or ``False`` if unset.
42-
43-
* Alternatively, configure the channels through the Odoo configuration
44-
file, like:
45-
46-
.. code-block:: ini
47-
48-
[queue_job]
49-
channels = root:4
50-
scheme = https
51-
host = load-balancer
52-
port = 443
53-
http_auth_user = jobrunner
54-
http_auth_password = s3cr3t
55-
jobrunner_db_host = master-db
56-
jobrunner_db_port = 5432
57-
jobrunner_db_user = userdb
58-
jobrunner_db_password = passdb
59-
60-
* Or, if using ``anybox.recipe.odoo``, add this to your buildout configuration:
61-
62-
.. code-block:: ini
63-
64-
[odoo]
65-
recipe = anybox.recipe.odoo
66-
(...)
67-
queue_job.channels = root:4
68-
queue_job.scheme = https
69-
queue_job.host = load-balancer
70-
queue_job.port = 443
71-
queue_job.http_auth_user = jobrunner
72-
queue_job.http_auth_password = s3cr3t
73-
74-
* Start Odoo with ``--load=web,web_kanban,queue_job``
75-
and ``--workers`` greater than 1 [2]_, or set the ``server_wide_modules``
76-
option in The Odoo configuration file:
77-
78-
.. code-block:: ini
79-
80-
[options]
81-
(...)
82-
workers = 4
83-
server_wide_modules = web,web_kanban,queue_job
84-
(...)
85-
86-
* Or, if using ``anybox.recipe.odoo``:
87-
88-
.. code-block:: ini
89-
90-
[odoo]
91-
recipe = anybox.recipe.odoo
92-
(...)
93-
options.workers = 4
94-
options.server_wide_modules = web,web_kanban,queue_job
95-
96-
* Confirm the runner is starting correctly by checking the odoo log file:
97-
98-
.. code-block:: none
99-
100-
...INFO...queue_job.jobrunner.runner: starting
101-
...INFO...queue_job.jobrunner.runner: initializing database connections
102-
...INFO...queue_job.jobrunner.runner: queue job runner ready for db <dbname>
103-
...INFO...queue_job.jobrunner.runner: database connections ready
104-
105-
* Create jobs (eg using base_import_async) and observe they
106-
start immediately and in parallel.
107-
108-
* Tip: to enable debug logging for the queue job, use
109-
``--log-handler=odoo.addons.queue_job:DEBUG``
110-
111-
Caveat
112-
------
113-
114-
* After creating a new database or installing queue_job on an
115-
existing database, Odoo must be restarted for the runner to detect it.
116-
117-
.. rubric:: Footnotes
118-
119-
.. [1] From a security standpoint, it is safe to have an anonymous HTTP
120-
request because this request only accepts to run jobs that are
121-
enqueued.
122-
.. [2] It works with the threaded Odoo server too, although this way
123-
of running Odoo is obviously not for production purposes.
19+
anonymous ``/queue_job/runjob`` HTTP request.
12420
"""
12521

12622
import logging

queue_job/readme/CONFIGURE.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,14 @@
22
- Adjust environment variables (optional):
33
- `ODOO_QUEUE_JOB_CHANNELS=root:4` or any other channels
44
configuration. The default is `root:1`
5-
- if `xmlrpc_port` is not set: `ODOO_QUEUE_JOB_PORT=8069`
6-
- Start Odoo with `--load=web,queue_job` and `--workers` greater than
7-
1.[^1]
5+
- `ODOO_QUEUE_JOB_PORT=8069`, default `--http-port`
6+
- `ODOO_QUEUE_JOB_SCHEME=https`, default `http`
7+
- `ODOO_QUEUE_JOB_HOST=load-balancer`, default `--http-interface`
8+
or `localhost` if unset
9+
- `ODOO_QUEUE_JOB_HTTP_AUTH_USER=jobrunner`, default empty
10+
- `ODOO_QUEUE_JOB_HTTP_AUTH_PASSWORD=s3cr3t`, default empty
11+
- Start Odoo with `--load=web,queue_job` and `--workers` greater than
12+
1.[^1]
813
- Using the Odoo configuration file:
914

1015
``` ini
@@ -16,6 +21,11 @@ server_wide_modules = web,queue_job
1621
(...)
1722
[queue_job]
1823
channels = root:2
24+
scheme = https
25+
host = load-balancer
26+
port = 443
27+
http_auth_user = jobrunner
28+
http_auth_password = s3cr3t
1929
```
2030

2131
- Confirm the runner is starting correctly by checking the odoo log

0 commit comments

Comments
 (0)