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

[17.0][MIG] queue_job + test_queue_job: Migration to 17.0 #593

Merged
merged 1,160 commits into from
Dec 5, 2023

Conversation

nguyenminhchien
Copy link

@nguyenminhchien nguyenminhchien commented Nov 25, 2023

Ref: BSRD-729

guewen and others added 30 commits November 24, 2023 14:17
Currently translated at 3.7% (5 of 135 strings)

Translation: queue-15.0/queue-15.0-queue_job
Translate-URL: https://translation.odoo-community.org/projects/queue-15-0/queue-15-0-queue_job/es/
Currently translated at 100.0% (135 of 135 strings)

Translation: queue-15.0/queue-15.0-queue_job
Translate-URL: https://translation.odoo-community.org/projects/queue-15-0/queue-15-0-queue_job/es/
Currently translated at 83.2% (114 of 137 strings)

Translation: queue-15.0/queue-15.0-queue_job
Translate-URL: https://translation.odoo-community.org/projects/queue-15-0/queue-15-0-queue_job/zh_CN/
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: queue-16.0/queue-16.0-queue_job
Translate-URL: https://translation.odoo-community.org/projects/queue-16-0/queue-16-0-queue_job/
It can still be activated by overriding a method.
Co-authored-by: Stéphane Bidoul <stephane.bidoul@acsone.eu>
simahawk and others added 11 commits December 4, 2023 18:01
Current situation:

* multiple keys for no good reason
* half baked: not all of them used everywhere
* no centralization
* poor naming

With this change we'll have:

* 1 and only one key to disable via ctx: ``queue_job__no_delay``
* 1 and only one key to disable via os env: ``QUEUE_JOB__NO_DELAY``
* backward compatibility with deprecation for old keys
The trap_jobs() test helper accepts any model/recordset as long
as the job function is the same, which is not enough to verify that
the job has been delayed on the expected recordset or model.

Tested job functions are "bound methods" so we can compare their `__self__`.

Example of assertion that would be valid:

  partner = self.env["res.partner"].create({"name": "foo"})
  with trap_jobs() as trap:
    partner.with_delay().do_something(42)
    trap.assert_enqueued_job(
        self.env["res.partner"].do_something,
        args=(42,)
    )
    trap.assert_jobs_count(1, only=self.env["res.partner"].do_something)

Now, it would fail with an error message like:

E           AssertionError: Job <res.partner()>.do_something(42) with properties (channel=root.test, description=Do something, eta=15, identity_key=<function identity_exact at 0x7f01bfb54cb0>, max_retries=1, priority=15) was not enqueued.
E           Actual enqueued jobs:
E            * <res.partner(64,)>.do_something(42) with properties (priority=15, max_retries=1, eta=15, description=Do something, channel=root.test, identity_key=<function identity_exact at 0x7f01bfb54cb0>)
Currently translated at 100.0% (13 of 13 strings)

Translation: queue-16.0/queue-16.0-test_queue_job
Translate-URL: https://translation.odoo-community.org/projects/queue-16-0/queue-16-0-test_queue_job/es/
1. In production, a job which is waiting dependencies or which
has started, but not completed, should not be repeated if
the identity_key matches.

2. In tests, the mock queue handler is now enhanced to allow
better mimicking of the identity_key blocks from production.

3. In tests, the mock queue handler now clears the enqueued jobs
after performing them, to better reproduce what a production
environment would do.
@nguyenminhchien
Copy link
Author

Please note that the following deprecation warning occurs in Odoo 17: DeprecationWarning: XML declarations in HTML module descriptions are deprecated since Odoo 17, queue_job can just have a UTF8 description with not need for a declaration.

Triggered by line 1 in queue_job/static/description/index.html

fixed, tks.

@ventor-dev
Copy link

Can it be merged? Or smth else is missing?

@AlexanderPashuk
Copy link
Contributor

@guewen can we help somehow to finish migration of this module?

Copy link
Member

@guewen guewen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your work!

@guewen
Copy link
Member

guewen commented Dec 5, 2023

/ocabot merge nobump

@OCA-git-bot
Copy link
Contributor

What a great day to merge this nice PR. Let's do it!
Prepared branch 17.0-ocabot-merge-pr-593-by-guewen-bump-nobump, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit 3d5b74b into OCA:17.0 Dec 5, 2023
5 checks passed
@OCA-git-bot
Copy link
Contributor

Congratulations, your PR was merged at a70fda8. Thanks a lot for contributing to OCA. ❤️

@okuryan
Copy link

okuryan commented Dec 5, 2023

@pedrobaeza can you (or who is responsible?) publish it on Odoo App store?

@pedrobaeza
Copy link
Member

Someone from board should do it.

@simahawk
Copy link
Contributor

simahawk commented Dec 5, 2023

I can have a look

@simahawk
Copy link
Contributor

simahawk commented Dec 5, 2023

image

@nguyenminhchien nguyenminhchien deleted the 17.0-mig-queue_job branch December 6, 2023 01:38
@gurneyalex
Copy link
Member

/ocabot migration test_queue_job

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.