Job Queue Batch
queue_job_batch · OCA/queue
-
Security25/25No findings
-
Activityn/aNo commit data
-
Required by15/251 module depends on it
-
Maturity25/25In 7 Odoo series since 11.0
Heuristic over the facts below, not an audit · How it's computed
Description
This addon adds an a grouper for queue jobs.
It allows to show your jobs in a batched form in order to know better the results.
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'
@api.multi
def button_do_stuff(self):
batch = self.env['queue.job.batch'].get_new_batch('Group')
model = self.env['my.model'].with_context(job_batch=batch)
for i in range(1, 100):
model.with_delay().my_method('a', k=i)
In the snippet of code above, when we call button_do_stuff, 100 jobs
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.
Once all the jobs have finished, the grouper will be marked as finished.
Dependencies
- Odoo dependencies
- Python dependencies
- openupgradelib, requests
- System dependencies
- None
- Required by
- test_queue_job_batch
Code analysis
Extracted from the source by best-effort static analysis (no code is executed); details may be incomplete.
Views touched 5
| XML ID | Name | Model | Type | Status |
|---|---|---|---|---|
view_queue_job_batch_form |
queue.job.batch.form | queue.job.batch | form | New |
view_queue_job_batch_search |
queue.job.batch.search | queue.job.batch | search | New |
view_queue_job_batch_tree |
queue.job.batch.tree | queue.job.batch | list | New |
view_queue_job_form |
queue.job.form | queue.job | form | Inherits queue_job.view_queue_job_form |
view_queue_job_search |
queue.job.search | queue.job | search | Inherits queue_job.view_queue_job_search |
HTTP endpoints 0
No HTTP endpoints found for this module.
Models touched 3
-
job_batch_idMany2one → queue.job.batchargs: 'queue.job.batch'
-
create(self, vals_list)@api.model_create_multi -
write(self, vals)
-
company_idMany2one → res.companyreadonly=True args: 'res.company' -
completenessFloatcompute='_compute_job_count' -
failed_job_countFloatcompute='_compute_job_count' -
failed_percentageFloatcompute='_compute_job_count' -
finished_job_countFloatcompute='_compute_job_count' -
is_readBoolean -
job_countIntegercompute='_compute_job_count' -
job_idsOne2many → queue.jobinverse_name='job_batch_id'readonly=True args: 'queue.job' -
nameCharreadonly=Truerequired=Truetracking=True -
stateSelectiondefault='pending'readonly=Truerequired=Truetracking=True args: [('pending', 'Pending'), ('enqueued', 'Enqueued'), ('progress', 'In Progress'), ('finished', 'Finished')] -
user_idMany2one → res.usersreadonly=Truerequired=Truetracking=True args: 'res.users'
-
check_state(self) -
get_new_batch(self, name, **kwargs)@api.model -
set_read(self)
No new fields.
Public methods (0)No public methods.
Loading…
Loading…
Loading…
Loading…
Loading…
Loading…
Loading…