Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion .oca/oca-port/blacklist/queue_job.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
{
"pull_requests": {
"475": "Already ported, conflicting",
"519": "Already ported w/o not needed commit 1f9f72a5a2bc14be907eeb4c069b36a8ce9736c2"
"519": "Already ported w/o not needed commit 1f9f72a5a2bc14be907eeb4c069b36a8ce9736c2",
"387": "Reverted by #466",
"413": "Lint",
"403": "Lint, other relevant code already ported",
"440": "Already fixed",
"466": "Reverting #387",
"511": "Icon already updated for v16",
"537": "Already ported"
}
}
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": "16.0.2.6.0",
"version": "16.0.2.6.1",
"author": "Camptocamp,ACSONE SA/NV,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/queue",
"license": "LGPL-3",
Expand Down
10 changes: 10 additions & 0 deletions queue_job/controllers/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,16 @@ def create_test_job(
size=1,
failure_rate=0,
):
"""Create test jobs

Examples of urls:

* http://127.0.0.1:8069/queue_job/create_test_job: single job
* http://127.0.0.1:8069/queue_job/create_test_job?size=10: a graph of 10 jobs
* http://127.0.0.1:8069/queue_job/create_test_job?size=10&failure_rate=0.5:
a graph of 10 jobs, half will fail

"""
if not http.request.env.user.has_group("base.group_erp_manager"):
raise Forbidden(_("Access Denied"))

Expand Down
10 changes: 10 additions & 0 deletions queue_job/migrations/16.0.2.6.1/pre-migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html)

from odoo.tools.sql import table_exists


def migrate(cr, version):
if table_exists(cr, "queue_job"):
# Drop index 'queue_job_identity_key_state_partial_index',
# it will be recreated during the update
cr.execute("DROP INDEX IF EXISTS queue_job_identity_key_state_partial_index;")
2 changes: 1 addition & 1 deletion queue_job/models/queue_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def init(self):
self._cr.execute(
"CREATE INDEX queue_job_identity_key_state_partial_index "
"ON queue_job (identity_key) WHERE state in ('pending', "
"'enqueued') AND identity_key IS NOT NULL;"
"'enqueued', 'wait_dependencies') AND identity_key IS NOT NULL;"
)

@api.depends("records")
Expand Down
6 changes: 6 additions & 0 deletions queue_job/readme/USAGE.rst
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,12 @@ tests), and it makes tests smaller.
The best way to run such assertions on the enqueued jobs is to use
``odoo.addons.queue_job.tests.common.trap_jobs()``.

Inside this context manager, instead of being added in the database's queue,
jobs are pushed in an in-memory list. The context manager then provides useful
helpers to verify that jobs have been enqueued with the expected arguments. It
even can run the jobs of its list synchronously! Details in
``odoo.addons.queue_job.tests.common.JobsTester``.

A very small example (more details in ``tests/common.py``):

.. code-block:: python
Expand Down
5 changes: 5 additions & 0 deletions queue_job/views/queue_job_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,11 @@
string="Failed"
domain="[('state', '=', 'failed')]"
/>
<filter
name="cancelled"
string="Cancelled"
domain="[('state', '=', 'cancelled')]"
/>
<group expand="0" string="Group By">
<filter
name="group_by_channel"
Expand Down