diff --git a/README.md b/README.md index 719eebaa27..66070a078a 100644 --- a/README.md +++ b/README.md @@ -21,8 +21,8 @@ Available addons ---------------- addon | version | maintainers | summary --- | --- | --- | --- -[queue_job](queue_job/) | 18.0.1.1.2 | [![guewen](https://github.com/guewen.png?size=30px)](https://github.com/guewen) | Job Queue -[queue_job_cron](queue_job_cron/) | 18.0.1.0.0 | | Scheduled Actions as Queue Jobs +[queue_job](queue_job/) | 18.0.1.2.0 | [![guewen](https://github.com/guewen.png?size=30px)](https://github.com/guewen) | Job Queue +[queue_job_cron](queue_job_cron/) | 18.0.1.1.0 | | Scheduled Actions as Queue Jobs [queue_job_subscribe](queue_job_subscribe/) | 18.0.1.0.0 | | Control which users are subscribed to queue job notifications [test_queue_job](test_queue_job/) | 18.0.1.0.0 | | Queue Job Tests diff --git a/queue_job/README.rst b/queue_job/README.rst index 8fe8ec405c..88014d7418 100644 --- a/queue_job/README.rst +++ b/queue_job/README.rst @@ -7,7 +7,7 @@ Job Queue !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:7e20d0bc521475ff7a942da2a2164d22f8b1bb96282f619fb4791a3535f145df + !! source digest: sha256:5bc2b6d0bf91b3c2c67c9039c43a1136704c9c323fa04f8d43166426769579d6 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Mature-brightgreen.png @@ -434,7 +434,7 @@ running Odoo** When you are developing (ie: connector modules) you might want to bypass the queue job and run your code immediately. -To do so you can set QUEUE_JOB\__NO_DELAY=1 in your enviroment. +To do so you can set QUEUE_JOB\__NO_DELAY=1 in your environment. **Bypass jobs in tests** diff --git a/queue_job/__manifest__.py b/queue_job/__manifest__.py index 162386a031..61b348d777 100644 --- a/queue_job/__manifest__.py +++ b/queue_job/__manifest__.py @@ -2,7 +2,7 @@ { "name": "Job Queue", - "version": "18.0.1.1.2", + "version": "18.0.1.2.0", "author": "Camptocamp,ACSONE SA/NV,Odoo Community Association (OCA)", "website": "https://github.com/OCA/queue", "license": "LGPL-3", diff --git a/queue_job/delay.py b/queue_job/delay.py index 251e4f7a84..0ba54e48a9 100644 --- a/queue_job/delay.py +++ b/queue_job/delay.py @@ -232,7 +232,7 @@ def _ensure_same_graph_uuid(jobs): elif jobs_count == 1: if jobs[0].graph_uuid: raise ValueError( - f"Job {jobs[0]} is a single job, it should not" " have a graph uuid" + f"Job {jobs[0]} is a single job, it should not have a graph uuid" ) else: graph_uuids = {job.graph_uuid for job in jobs if job.graph_uuid} @@ -483,11 +483,10 @@ def _tail(self): return [self] def __repr__(self): - return "Delayable({}.{}({}, {}))".format( - self.recordset, - self._job_method.__name__ if self._job_method else "", - self._job_args, - self._job_kwargs, + return ( + f"Delayable({self.recordset}." + f"{self._job_method.__name__ if self._job_method else ''}" + f"({self._job_args}, {self._job_kwargs}))" ) def __del__(self): @@ -656,9 +655,9 @@ def _delay_delayable(*args, **kwargs): return _delay_delayable def __str__(self): - return "DelayableRecordset({}{})".format( - self.delayable.recordset._name, - getattr(self.delayable.recordset, "_ids", ""), + return ( + f"DelayableRecordset({self.delayable.recordset._name}" + f"{getattr(self.delayable.recordset, '_ids', '')})" ) __repr__ = __str__ diff --git a/queue_job/readme/USAGE.md b/queue_job/readme/USAGE.md index c08374b9fc..deb6fe2aca 100644 --- a/queue_job/readme/USAGE.md +++ b/queue_job/readme/USAGE.md @@ -290,7 +290,7 @@ running Odoo** When you are developing (ie: connector modules) you might want to bypass the queue job and run your code immediately. -To do so you can set QUEUE_JOB\_\_NO_DELAY=1 in your enviroment. +To do so you can set QUEUE_JOB\_\_NO_DELAY=1 in your environment. **Bypass jobs in tests** diff --git a/queue_job/static/description/index.html b/queue_job/static/description/index.html index 05893ddef0..43590ee6d8 100644 --- a/queue_job/static/description/index.html +++ b/queue_job/static/description/index.html @@ -367,7 +367,7 @@

Job Queue

!! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!! source digest: sha256:7e20d0bc521475ff7a942da2a2164d22f8b1bb96282f619fb4791a3535f145df +!! source digest: sha256:5bc2b6d0bf91b3c2c67c9039c43a1136704c9c323fa04f8d43166426769579d6 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->

Mature License: LGPL-3 OCA/queue Translate me on Weblate Try me on Runboat

This addon adds an integrated Job Queue to Odoo.

@@ -755,7 +755,7 @@

Configure default options for job running Odoo

When you are developing (ie: connector modules) you might want to bypass the queue job and run your code immediately.

-

To do so you can set QUEUE_JOB__NO_DELAY=1 in your enviroment.

+

To do so you can set QUEUE_JOB__NO_DELAY=1 in your environment.

Bypass jobs in tests

When writing tests on job-related methods is always tricky to deal with delayed recordsets. To make your testing life easier you can set diff --git a/queue_job_cron/README.rst b/queue_job_cron/README.rst index c877c5d95e..1723fc4de0 100644 --- a/queue_job_cron/README.rst +++ b/queue_job_cron/README.rst @@ -7,7 +7,7 @@ Scheduled Actions as Queue Jobs !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:e594f92f3f64913a677efe2ec1a6873402737045411b1f83ff3a672377cbc7cb + !! source digest: sha256:f60ceee0fe0f89efc0c8e032cecd8fab6b3cd80fde8f419fd5b99f8563a892b1 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png @@ -58,6 +58,27 @@ Channels can be used to manage sequential jobs and prevent concurrency accesses. To do that you just have to define a channel per cron limited to 1 at time. +Changelog +========= + +18.0.1.1.0 (2025-01-16) +----------------------- + +Features +~~~~~~~~ + +- By default prevent parallel run of the same cron job when run as queue + job. + + When a cron job is run by odoo, the odoo runner will prevent parallel + run of the same cron job. Before this change, this was not the case + when the cron job was run as a queue job. A new option is added to the + cron job when run as a queue job to prevent parallel run. This option + is set to True by default. In this way, the behavior is now the same + as when the cron job is run by odoo but you keep the possibility to + disable this restriction when run as a queue job. + (`#612 `__) + Bug Tracker =========== @@ -79,10 +100,10 @@ Authors Contributors ------------ -- Cédric Pigeon -- Nguyen Minh Chien -- Tran Quoc duong -- Vo Hong Thien +- Cédric Pigeon +- Nguyen Minh Chien +- Tran Quoc duong +- Vo Hong Thien Other credits ------------- diff --git a/queue_job_cron/__manifest__.py b/queue_job_cron/__manifest__.py index b996cc4d48..9abbd5634a 100644 --- a/queue_job_cron/__manifest__.py +++ b/queue_job_cron/__manifest__.py @@ -3,7 +3,7 @@ { "name": "Scheduled Actions as Queue Jobs", - "version": "18.0.1.0.0", + "version": "18.0.1.1.0", "author": "ACSONE SA/NV,Odoo Community Association (OCA)", "website": "https://github.com/OCA/queue", "license": "AGPL-3", diff --git a/queue_job_cron/readme/HISTORY.md b/queue_job_cron/readme/HISTORY.md new file mode 100644 index 0000000000..8b83f021a4 --- /dev/null +++ b/queue_job_cron/readme/HISTORY.md @@ -0,0 +1,13 @@ +## 18.0.1.1.0 (2025-01-16) + +### Features + +- By default prevent parallel run of the same cron job when run as queue job. + + When a cron job is run by odoo, the odoo runner will prevent parallel run + of the same cron job. Before this change, this was not the case when the + cron job was run as a queue job. A new option is added to the cron job when + run as a queue job to prevent parallel run. This option is set to True by + default. In this way, the behavior is now the same as when the cron job is run + by odoo but you keep the possibility to disable this restriction when run as + a queue job. ([#612](https://github.com/OCA/queue/issues/612)) diff --git a/queue_job_cron/readme/newsfragments/612.feature b/queue_job_cron/readme/newsfragments/612.feature deleted file mode 100644 index 9c521620a2..0000000000 --- a/queue_job_cron/readme/newsfragments/612.feature +++ /dev/null @@ -1,9 +0,0 @@ -By default prevent parallel run of the same cron job when run as queue job. - -When a cron job is run by odoo, the odoo runner will prevent parallel run -of the same cron job. Before this change, this was not the case when the -cron job was run as a queue job. A new option is added to the cron job when -run as a queue job to prevent parallel run. This option is set to True by -default. In this way, the behavior is now the same as when the cron job is run -by odoo but you keep the possibility to disable this restriction when run as -a queue job. diff --git a/queue_job_cron/static/description/index.html b/queue_job_cron/static/description/index.html index 83e2c51810..de5bd592f2 100644 --- a/queue_job_cron/static/description/index.html +++ b/queue_job_cron/static/description/index.html @@ -367,7 +367,7 @@

Scheduled Actions as Queue Jobs

!! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!! source digest: sha256:e594f92f3f64913a677efe2ec1a6873402737045411b1f83ff3a672377cbc7cb +!! source digest: sha256:f60ceee0fe0f89efc0c8e032cecd8fab6b3cd80fde8f419fd5b99f8563a892b1 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->

Beta License: AGPL-3 OCA/queue Translate me on Weblate Try me on Runboat

This module extends the functionality of queue_job and allows to run an @@ -377,12 +377,19 @@

Scheduled Actions as Queue Jobs