Skip to content

Commit cbfd948

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

File tree

3 files changed

+28
-117
lines changed

3 files changed

+28
-117
lines changed

queue_job/README.rst

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
.. image:: https://odoo-community.org/readme-banner-image
2-
:target: https://odoo-community.org/get-involved?utm_source=readme
3-
:alt: Odoo Community Association
4-
51
=========
62
Job Queue
73
=========
@@ -17,7 +13,7 @@ Job Queue
1713
.. |badge1| image:: https://img.shields.io/badge/maturity-Mature-brightgreen.png
1814
:target: https://odoo-community.org/page/development-status
1915
:alt: Mature
20-
.. |badge2| image:: https://img.shields.io/badge/license-LGPL--3-blue.png
16+
.. |badge2| image:: https://img.shields.io/badge/licence-LGPL--3-blue.png
2117
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
2218
:alt: License: LGPL-3
2319
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fqueue-lightgray.png?logo=github
@@ -99,10 +95,14 @@ Configuration
9995

10096
- ``ODOO_QUEUE_JOB_CHANNELS=root:4`` or any other channels
10197
configuration. The default is ``root:1``
102-
- if ``xmlrpc_port`` is not set: ``ODOO_QUEUE_JOB_PORT=8069``
103-
104-
- Start Odoo with ``--load=web,queue_job`` and ``--workers`` greater
105-
than 1. [1]_
98+
- ``ODOO_QUEUE_JOB_PORT=8069``, default ``--http-port``
99+
- ``ODOO_QUEUE_JOB_SCHEME=https``, default ``http``
100+
- ``ODOO_QUEUE_JOB_HOST=load-balancer``, default
101+
``--http-interface`` or ``localhost`` if unset
102+
- ``ODOO_QUEUE_JOB_HTTP_AUTH_USER=jobrunner``, default empty
103+
- ``ODOO_QUEUE_JOB_HTTP_AUTH_PASSWORD=s3cr3t``, default empty
104+
- Start Odoo with ``--load=web,queue_job`` and ``--workers`` greater
105+
than 1. [1]_
106106

107107
- Using the Odoo configuration file:
108108

@@ -116,6 +116,11 @@ Configuration
116116
(...)
117117
[queue_job]
118118
channels = root:2
119+
scheme = https
120+
host = load-balancer
121+
port = 443
122+
http_auth_user = jobrunner
123+
http_auth_password = s3cr3t
119124
120125
- Confirm the runner is starting correctly by checking the odoo log
121126
file:

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)