
Job Queue
This Odoo addon introduces a comprehensive Job Queue system, enabling deferred execution of method calls in an asynchronous manner. With this feature, users can manage and execute tasks efficiently, enhancing the overall performance and scalability of their Odoo applications.
This addon adds an integrated Job Queue to Odoo. It allows to postpone method calls executed asynchronously. Jobs are executed in the background by a Jobrunner, in their own transaction.
Example:
from odoo import models, fields, api
class MyModel(models.Model):
_name = 'my.model'
def my_method(self, a, k=None):
_logger.info('executed with a: %s and k: %s', a, k)
class MyOtherModel(models.Model):
_name = 'my.other.model'
def button_do_stuff(self):
self.env['my.model'].with_delay().my_method('a', k=2)
In the snippet of code above, when we call button_do_stuff, a job capturing the method and arguments will be postponed. It will be executed as soon as the Jobrunner has a free bucket, which can be instantaneous if no other job is running.
Key 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
Implement user interface views for managing and monitoring jobs, allowing users to view job details, statuses, and perform actions related to jobs.
Jobrunner
component responsible for executing jobs efficiently, leveraging PostgreSQL's NOTIFY feature to handle job execution and notifications
Queued jobs

Form view for Job Queue

Jobs to done wizard

Jobs cancel wizard

[options]
(...)
workers = 6
server_wide_modules = web,queue_job
(...)
[queue_job]
channels = root:2
GNU Lesser General Public License v3.0 This software and associated files (the "Software") may only be used (executed, modified, executed after modifications) if you comply with the terms of the GNU Lesser General Public License, version 3.0, available at https://www.gnu.org/licenses/lgpl-3.0.html. You may develop software that uses the Software as a library (typically by depending on it, importing it and using its resources), but without copying any source code or material from the Software. You may distribute those software under the terms of the GNU Lesser General Public License, version 3.0. It is forbidden to publish, distribute, sublicense, or sell copies of the Software or modified copies of the Software without including the complete text of the GNU Lesser General Public License, version 3.0, along with any applicable additional permissions. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- base_sparse_field
- web