diff --git a/.oca/oca-port/blacklist/queue_job.json b/.oca/oca-port/blacklist/queue_job.json index ea81034b3d..adf99c8ae9 100644 --- a/.oca/oca-port/blacklist/queue_job.json +++ b/.oca/oca-port/blacklist/queue_job.json @@ -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" } } diff --git a/queue_job/__manifest__.py b/queue_job/__manifest__.py index f36fdb1263..f92bb3c8cb 100644 --- a/queue_job/__manifest__.py +++ b/queue_job/__manifest__.py @@ -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", diff --git a/queue_job/controllers/main.py b/queue_job/controllers/main.py index 0fbfee98c1..0e58e52628 100644 --- a/queue_job/controllers/main.py +++ b/queue_job/controllers/main.py @@ -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")) diff --git a/queue_job/migrations/16.0.2.6.1/pre-migration.py b/queue_job/migrations/16.0.2.6.1/pre-migration.py new file mode 100644 index 0000000000..53d9690caa --- /dev/null +++ b/queue_job/migrations/16.0.2.6.1/pre-migration.py @@ -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;") diff --git a/queue_job/models/queue_job.py b/queue_job/models/queue_job.py index bc280b39e4..0098ffeeac 100644 --- a/queue_job/models/queue_job.py +++ b/queue_job/models/queue_job.py @@ -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") diff --git a/queue_job/readme/USAGE.rst b/queue_job/readme/USAGE.rst index e43872fdce..0ac17f7b10 100644 --- a/queue_job/readme/USAGE.rst +++ b/queue_job/readme/USAGE.rst @@ -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 diff --git a/queue_job/views/queue_job_views.xml b/queue_job/views/queue_job_views.xml index c37c739f9d..a7099254d0 100644 --- a/queue_job/views/queue_job_views.xml +++ b/queue_job/views/queue_job_views.xml @@ -245,6 +245,11 @@ string="Failed" domain="[('state', '=', 'failed')]" /> +