Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Syncing from upstream OCA/queue (18.0) #431

Merged
merged 5 commits into from
Jan 17, 2025
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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions queue_job/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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**

Expand Down
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": "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",
Expand Down
17 changes: 8 additions & 9 deletions queue_job/delay.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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__
2 changes: 1 addition & 1 deletion queue_job/readme/USAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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**

Expand Down
4 changes: 2 additions & 2 deletions queue_job/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ <h1 class="title">Job Queue</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:7e20d0bc521475ff7a942da2a2164d22f8b1bb96282f619fb4791a3535f145df
!! source digest: sha256:5bc2b6d0bf91b3c2c67c9039c43a1136704c9c323fa04f8d43166426769579d6
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Mature" src="https://img.shields.io/badge/maturity-Mature-brightgreen.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/lgpl-3.0-standalone.html"><img alt="License: LGPL-3" src="https://img.shields.io/badge/licence-LGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/queue/tree/18.0/queue_job"><img alt="OCA/queue" src="https://img.shields.io/badge/github-OCA%2Fqueue-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/queue-18-0/queue-18-0-queue_job"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/queue&amp;target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This addon adds an integrated Job Queue to Odoo.</p>
Expand Down Expand Up @@ -755,7 +755,7 @@ <h3><a class="toc-backref" href="#toc-entry-7">Configure default options for job
running Odoo</strong></p>
<p>When you are developing (ie: connector modules) you might want to bypass
the queue job and run your code immediately.</p>
<p>To do so you can set QUEUE_JOB__NO_DELAY=1 in your enviroment.</p>
<p>To do so you can set QUEUE_JOB__NO_DELAY=1 in your environment.</p>
<p><strong>Bypass jobs in tests</strong></p>
<p>When writing tests on job-related methods is always tricky to deal with
delayed recordsets. To make your testing life easier you can set
Expand Down
31 changes: 26 additions & 5 deletions queue_job_cron/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 <https://github.com/OCA/queue/issues/612>`__)

Bug Tracker
===========

Expand All @@ -79,10 +100,10 @@ Authors
Contributors
------------

- Cédric Pigeon <[email protected]>
- Nguyen Minh Chien <[email protected]>
- Tran Quoc duong <[email protected]>
- Vo Hong Thien <[email protected]>
- Cédric Pigeon <[email protected]>
- Nguyen Minh Chien <[email protected]>
- Tran Quoc duong <[email protected]>
- Vo Hong Thien <[email protected]>

Other credits
-------------
Expand Down
2 changes: 1 addition & 1 deletion queue_job_cron/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
13 changes: 13 additions & 0 deletions queue_job_cron/readme/HISTORY.md
Original file line number Diff line number Diff line change
@@ -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))
9 changes: 0 additions & 9 deletions queue_job_cron/readme/newsfragments/612.feature

This file was deleted.

55 changes: 42 additions & 13 deletions queue_job_cron/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ <h1 class="title">Scheduled Actions as Queue Jobs</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:e594f92f3f64913a677efe2ec1a6873402737045411b1f83ff3a672377cbc7cb
!! source digest: sha256:f60ceee0fe0f89efc0c8e032cecd8fab6b3cd80fde8f419fd5b99f8563a892b1
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/queue/tree/18.0/queue_job_cron"><img alt="OCA/queue" src="https://img.shields.io/badge/github-OCA%2Fqueue-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/queue-18-0/queue-18-0-queue_job_cron"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/queue&amp;target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module extends the functionality of queue_job and allows to run an
Expand All @@ -377,12 +377,19 @@ <h1 class="title">Scheduled Actions as Queue Jobs</h1>
<ul class="simple">
<li><a class="reference internal" href="#installation" id="toc-entry-1">Installation</a></li>
<li><a class="reference internal" href="#usage" id="toc-entry-2">Usage</a></li>
<li><a class="reference internal" href="#bug-tracker" id="toc-entry-3">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="toc-entry-4">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="toc-entry-5">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="toc-entry-6">Contributors</a></li>
<li><a class="reference internal" href="#other-credits" id="toc-entry-7">Other credits</a></li>
<li><a class="reference internal" href="#maintainers" id="toc-entry-8">Maintainers</a></li>
<li><a class="reference internal" href="#changelog" id="toc-entry-3">Changelog</a><ul>
<li><a class="reference internal" href="#section-1" id="toc-entry-4">18.0.1.1.0 (2025-01-16)</a><ul>
<li><a class="reference internal" href="#features" id="toc-entry-5">Features</a></li>
</ul>
</li>
</ul>
</li>
<li><a class="reference internal" href="#bug-tracker" id="toc-entry-6">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="toc-entry-7">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="toc-entry-8">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="toc-entry-9">Contributors</a></li>
<li><a class="reference internal" href="#other-credits" id="toc-entry-10">Other credits</a></li>
<li><a class="reference internal" href="#maintainers" id="toc-entry-11">Maintainers</a></li>
</ul>
</li>
</ul>
Expand All @@ -406,24 +413,46 @@ <h1><a class="toc-backref" href="#toc-entry-2">Usage</a></h1>
accesses. To do that you just have to define a channel per cron limited
to 1 at time.</p>
</div>
<div class="section" id="changelog">
<h1><a class="toc-backref" href="#toc-entry-3">Changelog</a></h1>
<div class="section" id="section-1">
<h2><a class="toc-backref" href="#toc-entry-4">18.0.1.1.0 (2025-01-16)</a></h2>
<div class="section" id="features">
<h3><a class="toc-backref" href="#toc-entry-5">Features</a></h3>
<ul>
<li><p class="first">By default prevent parallel run of the same cron job when run as queue
job.</p>
<p>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.
(<a class="reference external" href="https://github.com/OCA/queue/issues/612">#612</a>)</p>
</li>
</ul>
</div>
</div>
</div>
<div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#toc-entry-3">Bug Tracker</a></h1>
<h1><a class="toc-backref" href="#toc-entry-6">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/queue/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/queue/issues/new?body=module:%20queue_job_cron%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
<h1><a class="toc-backref" href="#toc-entry-4">Credits</a></h1>
<h1><a class="toc-backref" href="#toc-entry-7">Credits</a></h1>
<div class="section" id="authors">
<h2><a class="toc-backref" href="#toc-entry-5">Authors</a></h2>
<h2><a class="toc-backref" href="#toc-entry-8">Authors</a></h2>
<ul class="simple">
<li>ACSONE SA/NV</li>
</ul>
</div>
<div class="section" id="contributors">
<h2><a class="toc-backref" href="#toc-entry-6">Contributors</a></h2>
<h2><a class="toc-backref" href="#toc-entry-9">Contributors</a></h2>
<ul class="simple">
<li>Cédric Pigeon &lt;<a class="reference external" href="mailto:cedric.pigeon&#64;acsone.eu">cedric.pigeon&#64;acsone.eu</a>&gt;</li>
<li>Nguyen Minh Chien &lt;<a class="reference external" href="mailto:chien&#64;trobz.com">chien&#64;trobz.com</a>&gt;</li>
Expand All @@ -432,12 +461,12 @@ <h2><a class="toc-backref" href="#toc-entry-6">Contributors</a></h2>
</ul>
</div>
<div class="section" id="other-credits">
<h2><a class="toc-backref" href="#toc-entry-7">Other credits</a></h2>
<h2><a class="toc-backref" href="#toc-entry-10">Other credits</a></h2>
<p>The migration of this module from 17.0 to 18.0 was financially supported
by Camptocamp.</p>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#toc-entry-8">Maintainers</a></h2>
<h2><a class="toc-backref" href="#toc-entry-11">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org">
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
Expand Down
2 changes: 1 addition & 1 deletion queue_job_cron/views/ir_cron_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<field name="run_as_queue_job" />
<field
name="no_parallel_queue_job_run"
invisible="run_as_queue_job == False"
invisible="not run_as_queue_job"
/>
<field
name="channel_id"
Expand Down
Loading