Skip to content

Commit

Permalink
[BOT] post-merge updates
Browse files Browse the repository at this point in the history
  • Loading branch information
OCA-git-bot committed Dec 16, 2024
1 parent a5f5cfd commit f565ac0
Show file tree
Hide file tree
Showing 4 changed files with 120 additions and 122 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Available addons
----------------
addon | version | maintainers | summary
--- | --- | --- | ---
[queue_job](queue_job/) | 17.0.1.0.6 | [![guewen](https://github.com/guewen.png?size=30px)](https://github.com/guewen) | Job Queue
[queue_job](queue_job/) | 17.0.1.1.0 | [![guewen](https://github.com/guewen.png?size=30px)](https://github.com/guewen) | Job Queue
[queue_job_cron](queue_job_cron/) | 17.0.1.0.0 | | Scheduled Actions as Queue Jobs
[queue_job_cron_jobrunner](queue_job_cron_jobrunner/) | 17.0.1.0.0 | [![ivantodorovich](https://github.com/ivantodorovich.png?size=30px)](https://github.com/ivantodorovich) | Run jobs without a dedicated JobRunner
[queue_job_subscribe](queue_job_subscribe/) | 17.0.1.0.0 | | Control which users are subscribed to queue job notifications
Expand Down
217 changes: 108 additions & 109 deletions queue_job/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Job Queue
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:90ef2e94e001a4e0c15ae8fb76c7030d0a4091667b03a3ba2ad4ac470f91bbe3
!! source digest: sha256:7dc494e8d061d4e95ebda9de587fd059bc427afe90683f7cfe468a078519a461
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Mature-brightgreen.png
Expand Down Expand Up @@ -61,20 +61,20 @@ instantaneous if no other job is running.

Features:

- Views for jobs, jobs are stored in PostgreSQL
- Jobrunner: execute the jobs, highly efficient thanks to PostgreSQL's
NOTIFY
- Channels: give a capacity for the root channel and its sub-channels
and segregate jobs in them. Allow for instance to restrict heavy jobs
to be executed one at a time while little ones are executed 4 at a
times.
- Retries: Ability to retry jobs by raising a type of exception
- Retry Pattern: the 3 first tries, retry after 10 seconds, the 5 next
tries, retry after 1 minutes, ...
- Job properties: priorities, estimated time of arrival (ETA), custom
description, number of retries
- Related Actions: link an action on the job view, such as open the
record concerned by the job
- Views for jobs, jobs are stored in PostgreSQL
- Jobrunner: execute the jobs, highly efficient thanks to PostgreSQL's
NOTIFY
- Channels: give a capacity for the root channel and its sub-channels
and segregate jobs in them. Allow for instance to restrict heavy jobs
to be executed one at a time while little ones are executed 4 at a
times.
- Retries: Ability to retry jobs by raising a type of exception
- Retry Pattern: the 3 first tries, retry after 10 seconds, the 5 next
tries, retry after 1 minutes, ...
- Job properties: priorities, estimated time of arrival (ETA), custom
description, number of retries
- Related Actions: link an action on the job view, such as open the
record concerned by the job

**Table of contents**

Expand All @@ -98,18 +98,18 @@ retries.

Here are some community usage examples:

- Mass sending invoices:
`account_invoice_mass_sending <https://github.com/OCA/account-invoicing/tree/17.0/account_invoice_mass_sending>`__
- Import data in the background:
`base_import_async <https://github.com/OCA/queue/tree/17.0/base_import_async>`__
- Export data in the background:
`base_export_async <https://github.com/OCA/queue/tree/17.0/base_export_async>`__
- Generate contract invoices with jobs:
`contract_queue_job <https://github.com/OCA/contract/tree/17.0/contract_queue_job>`__
- Generate partner invoices with
jobs:`partner_invoicing_mode <https://github.com/OCA/account-invoicing/tree/17.0/partner_invoicing_mode>`__
- Process the Sales Automatic Workflow actions with jobs:
`sale_automatic_workflow_job <https://github.com/OCA/sale-workflow/tree/17.0/sale_automatic_workflow_job>`__
- Mass sending invoices:
`account_invoice_mass_sending <https://github.com/OCA/account-invoicing/tree/17.0/account_invoice_mass_sending>`__
- Import data in the background:
`base_import_async <https://github.com/OCA/queue/tree/17.0/base_import_async>`__
- Export data in the background:
`base_export_async <https://github.com/OCA/queue/tree/17.0/base_export_async>`__
- Generate contract invoices with jobs:
`contract_queue_job <https://github.com/OCA/contract/tree/17.0/contract_queue_job>`__
- Generate partner invoices with
jobs:`partner_invoicing_mode <https://github.com/OCA/account-invoicing/tree/17.0/partner_invoicing_mode>`__
- Process the Sales Automatic Workflow actions with jobs:
`sale_automatic_workflow_job <https://github.com/OCA/sale-workflow/tree/17.0/sale_automatic_workflow_job>`__

Installation
============
Expand All @@ -119,18 +119,18 @@ Be sure to have the ``requests`` library.
Configuration
=============

- Using environment variables and command line:
- Using environment variables and command line:

- Adjust environment variables (optional):
- Adjust environment variables (optional):

- ``ODOO_QUEUE_JOB_CHANNELS=root:4`` or any other channels
configuration. The default is ``root:1``
- if ``xmlrpc_port`` is not set: ``ODOO_QUEUE_JOB_PORT=8069``
- ``ODOO_QUEUE_JOB_CHANNELS=root:4`` or any other channels
configuration. The default is ``root:1``
- if ``xmlrpc_port`` is not set: ``ODOO_QUEUE_JOB_PORT=8069``

- Start Odoo with ``--load=web,queue_job`` and ``--workers`` greater
than 1. [1]_
- Start Odoo with ``--load=web,queue_job`` and ``--workers`` greater
than 1. [1]_

- Using the Odoo configuration file:
- Using the Odoo configuration file:

.. code:: ini
Expand All @@ -143,8 +143,8 @@ Configuration
[queue_job]
channels = root:2
- Confirm the runner is starting correctly by checking the odoo log
file:
- Confirm the runner is starting correctly by checking the odoo log
file:

::

Expand All @@ -153,10 +153,10 @@ Configuration
...INFO...queue_job.jobrunner.runner: queue job runner ready for db <dbname>
...INFO...queue_job.jobrunner.runner: database connections ready

- Create jobs (eg using ``base_import_async``) and observe they start
immediately and in parallel.
- Tip: to enable debug logging for the queue job, use
``--log-handler=odoo.addons.queue_job:DEBUG``
- Create jobs (eg using ``base_import_async``) and observe they start
immediately and in parallel.
- Tip: to enable debug logging for the queue job, use
``--log-handler=odoo.addons.queue_job:DEBUG``

.. [1]
It works with the threaded Odoo server too, although this way of
Expand Down Expand Up @@ -280,20 +280,20 @@ would be shown).
Enqueing Job Options
~~~~~~~~~~~~~~~~~~~~

- priority: default is 10, the closest it is to 0, the faster it will
be executed
- eta: Estimated Time of Arrival of the job. It will not be executed
before this date/time
- max_retries: default is 5, maximum number of retries before giving up
and set the job state to 'failed'. A value of 0 means infinite
retries.
- description: human description of the job. If not set, description is
computed from the function doc or method name
- channel: the complete name of the channel to use to process the
function. If specified it overrides the one defined on the function
- identity_key: key uniquely identifying the job, if specified and a
job with the same key has not yet been run, the new job will not be
created
- priority: default is 10, the closest it is to 0, the faster it will be
executed
- eta: Estimated Time of Arrival of the job. It will not be executed
before this date/time
- max_retries: default is 5, maximum number of retries before giving up
and set the job state to 'failed'. A value of 0 means infinite
retries.
- description: human description of the job. If not set, description is
computed from the function doc or method name
- channel: the complete name of the channel to use to process the
function. If specified it overrides the one defined on the function
- identity_key: key uniquely identifying the job, if specified and a job
with the same key has not yet been run, the new job will not be
created

Configure default options for jobs
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -364,11 +364,11 @@ dictionary on the job function:
"kwargs": {"name": "Partner"},
}
- ``enable``: when ``False``, the button has no effect (default:
``True``)
- ``func_name``: name of the method on ``queue.job`` that returns an
action
- ``kwargs``: extra arguments to pass to the related action method
- ``enable``: when ``False``, the button has no effect (default:
``True``)
- ``func_name``: name of the method on ``queue.job`` that returns an
action
- ``kwargs``: extra arguments to pass to the related action method

Example of related action code:

Expand Down Expand Up @@ -412,10 +412,10 @@ integers:
Based on this configuration, we can tell that:

- 5 first retries are postponed 10 seconds later
- retries 5 to 10 postponed 20 seconds later
- retries 10 to 15 postponed 30 seconds later
- all subsequent retries postponed 5 minutes later
- 5 first retries are postponed 10 seconds later
- retries 5 to 10 postponed 20 seconds later
- retries 10 to 15 postponed 30 seconds later
- all subsequent retries postponed 5 minutes later

**Job Context**

Expand Down Expand Up @@ -462,11 +462,11 @@ Testing
The recommended way to test jobs, rather than running them directly and
synchronously is to split the tests in two parts:

- one test where the job is mocked (trap jobs with ``trap_jobs()``
and the test only verifies that the job has been delayed with the
expected arguments
- one test that only calls the method of the job synchronously, to
validate the proper behavior of this method only
- one test where the job is mocked (trap jobs with ``trap_jobs()``
and the test only verifies that the job has been delayed with the
expected arguments
- one test that only calls the method of the job synchronously, to
validate the proper behavior of this method only

Proceeding this way means that you can prove that jobs will be enqueued
properly at runtime, and it ensures your code does not have a different
Expand Down Expand Up @@ -590,14 +590,14 @@ synchronously
Tips and tricks
~~~~~~~~~~~~~~~
- **Idempotency**
(https://www.restapitutorial.com/lessons/idempotency.html): The
queue_job should be idempotent so they can be retried several times
without impact on the data.
- **The job should test at the very beginning its relevance**: the
moment the job will be executed is unknown by design. So the first
task of a job should be to check if the related work is still
relevant at the moment of the execution.
- **Idempotency**
(https://www.restapitutorial.com/lessons/idempotency.html): The
queue_job should be idempotent so they can be retried several times
without impact on the data.
- **The job should test at the very beginning its relevance**: the
moment the job will be executed is unknown by design. So the first
task of a job should be to check if the related work is still relevant
at the moment of the execution.
Patterns
~~~~~~~~
Expand All @@ -614,20 +614,19 @@ Through the time, two main patterns emerged:
Known issues / Roadmap
======================
- After creating a new database or installing ``queue_job`` on an
existing database, Odoo must be restarted for the runner to detect
it.
- When Odoo shuts down normally, it waits for running jobs to finish.
However, when the Odoo server crashes or is otherwise force-stopped,
running jobs are interrupted while the runner has no chance to know
they have been aborted. In such situations, jobs may remain in
``started`` or ``enqueued`` state after the Odoo server is halted.
Since the runner has no way to know if they are actually running or
not, and does not know for sure if it is safe to restart the jobs, it
does not attempt to restart them automatically. Such stale jobs
therefore fill the running queue and prevent other jobs to start. You
must therefore requeue them manually, either from the Jobs view, or
by running the following SQL statement *before starting Odoo*:
- After creating a new database or installing ``queue_job`` on an
existing database, Odoo must be restarted for the runner to detect it.
- When Odoo shuts down normally, it waits for running jobs to finish.
However, when the Odoo server crashes or is otherwise force-stopped,
running jobs are interrupted while the runner has no chance to know
they have been aborted. In such situations, jobs may remain in
``started`` or ``enqueued`` state after the Odoo server is halted.
Since the runner has no way to know if they are actually running or
not, and does not know for sure if it is safe to restart the jobs, it
does not attempt to restart them automatically. Such stale jobs
therefore fill the running queue and prevent other jobs to start. You
must therefore requeue them manually, either from the Jobs view, or by
running the following SQL statement *before starting Odoo*:
.. code:: sql
Expand All @@ -639,11 +638,11 @@ Changelog
Next
----
- [ADD] Run jobrunner as a worker process instead of a thread in the
main process (when running with --workers > 0)
- [REF] ``@job`` and ``@related_action`` deprecated, any method can be
delayed, and configured using ``queue.job.function`` records
- [MIGRATION] from 13.0 branched at rev. e24ff4b
- [ADD] Run jobrunner as a worker process instead of a thread in the
main process (when running with --workers > 0)
- [REF] ``@job`` and ``@related_action`` deprecated, any method can be
delayed, and configured using ``queue.job.function`` records
- [MIGRATION] from 13.0 branched at rev. e24ff4b
Bug Tracker
===========
Expand All @@ -667,19 +666,19 @@ Authors
Contributors
------------
- Guewen Baconnier <guewen.baconnier@camptocamp.com>
- Stéphane Bidoul <stephane.bidoul@acsone.eu>
- Matthieu Dietrich <matthieu.dietrich@camptocamp.com>
- Jos De Graeve <Jos.DeGraeve@apertoso.be>
- David Lefever <dl@taktik.be>
- Laurent Mignon <laurent.mignon@acsone.eu>
- Laetitia Gangloff <laetitia.gangloff@acsone.eu>
- Cédric Pigeon <cedric.pigeon@acsone.eu>
- Tatiana Deribina <tatiana.deribina@avoin.systems>
- Souheil Bejaoui <souheil.bejaoui@acsone.eu>
- Eric Antones <eantones@nuobit.com>
- Simone Orsi <simone.orsi@camptocamp.com>
- Nguyen Minh Chien <chien@trobz.com>
- Guewen Baconnier <guewen.baconnier@camptocamp.com>
- Stéphane Bidoul <stephane.bidoul@acsone.eu>
- Matthieu Dietrich <matthieu.dietrich@camptocamp.com>
- Jos De Graeve <Jos.DeGraeve@apertoso.be>
- David Lefever <dl@taktik.be>
- Laurent Mignon <laurent.mignon@acsone.eu>
- Laetitia Gangloff <laetitia.gangloff@acsone.eu>
- Cédric Pigeon <cedric.pigeon@acsone.eu>
- Tatiana Deribina <tatiana.deribina@avoin.systems>
- Souheil Bejaoui <souheil.bejaoui@acsone.eu>
- Eric Antones <eantones@nuobit.com>
- Simone Orsi <simone.orsi@camptocamp.com>
- Nguyen Minh Chien <chien@trobz.com>
Maintainers
-----------
Expand Down
2 changes: 1 addition & 1 deletion queue_job/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

{
"name": "Job Queue",
"version": "17.0.1.0.6",
"version": "17.0.1.1.0",
"author": "Camptocamp,ACSONE SA/NV,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/queue",
"license": "LGPL-3",
Expand Down
Loading

0 comments on commit f565ac0

Please sign in to comment.