-
-
Notifications
You must be signed in to change notification settings - Fork 522
[19.0] [MIG] queue_job: migrate + tests #840
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
base: 19.0
Are you sure you want to change the base?
Conversation
Scope: queue_job, test_queue_job only
…config.yaml excluded-addons update\n- Prettier reformat XML/JS/SCSS and pyproject changes\n- Fix ruff UP031 in controllers and job repr/exception
…._ in controller\n- Use self.env._ + lazy %% formatting in models\n- Paginate channel search in autovacuum\n- Avoid raise in unlink; skip root channel\n- Fix tests: avoid search([]) and correct pylint disable id
|
/ocabot migration queue_job |
|
/ocabot migration test_queue_job |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
appreciate all the work you done here! please review the comments since I notice many weird comments and many changes should be in another PR instead of a migration one
… error messages; keep logging/i18n/SQL intact
…(guard remains in ondelete)
…where appropriate
…ncer (#no-search-all)
…locally (#no-search-all)
…/-7d/-30d) per core v19 behavior
…Users)\n\n- Places the privilege below typical user/security items (e.g., OAuth providers at 30)\n- Functional change limited to security.xml data\n- pre-commit: all hooks pass locally
1bb209c to
6d330f2
Compare
|
@hoangtrann quick update:
I’d also really appreciate it if you could take a look at PR #842—specifically the tests: You can run the suite locally with (use any throwaway DB name in place of ./odoo/odoo-bin -c odoo.conf -d <DB_NAME> Thanks again for the thorough and detailed review—really grateful for your contributions and feedback 🙏 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there are still some comments stating odoo 19 scattered across the changes which I thing we should removed.
for anyone comes after these are removed, I think it's good to just summarized the major changes to the description of the pr which can also works as a good resource for reference in other mig pr
queue_job/models/base.py
Outdated
| # carry over wrapper attributes (name, doc, etc.) | ||
| wrapped = functools.update_wrapper(method, origin) | ||
| # propagate common decorator metadata used by the framework | ||
| for attr in ( | ||
| "_constrains", | ||
| "_depends", | ||
| "_onchange", | ||
| "_ondelete", | ||
| "_api_model", | ||
| "_api_private", | ||
| ): | ||
| if hasattr(origin, attr): | ||
| setattr(wrapped, attr, getattr(origin, attr)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know what the best to do here, but hard coding a list of apis here also don't work as a proper propagation. because if there is another api being added through customization, it will be skipped by this implementation I think 🤔
Comment-only cleanup; no functional changes.
…iate variables Address review nit: split complex f-strings into clearer parts; no functional change.
Resolved in: d27f83d |
…ssing Drop flat options merge; config-only change per review guidance.
Align with review: create_index already checks existence; no functional change.
6b95a96 to
038c334
Compare
…register_hook; fix auto-delay wrapper - Remove unused `_patch_method` from Base per review - Update docstring example to patch methods in `_register_hook` - Adjust test models to patch using `functools.update_wrapper` - Fix auto-delay wrapper to store unbound origin and bind at call time Functional change limited to patching helper/tests; no manifest changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
|
From my checks and tests, this is all ready to go. Can it be merged? |
|
@tishmen have you tested this version with the preforkserver configuration (using Additionally, there is an error due to the upstream config refactoring in this method: |
|
@PieterPaulussen fyi, workers mode working fine here, is the runner starting properly on your end?
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tishmen Thanks for your effort on this. On the whole, this PR does the trick, but there are a lot of additional changes that are not essential to the module migration. In my opinion, you will get faster approvals if you slim down the changes to the bare minimum given the complexity of this module.
If you want to keep the translations in this PR, can we go one step further and use positional arguments for all translated string variables? This results in more flexibility for other languages during translating.
On the refactoring of the tests to remove the reliance on the demo_user, I would beg to differ. Unittests should rely on the presence of the demo data, just as the core does.
Finally, I would like to stress the following issue that I encountered during a local test with your code: #840 (comment)
The jobrunner does not seem to enqueue AND process the queue jobs when running is preforked server configuration. This issue should be addressed first.
| uuids = [uuid for uuid in self.mapped("graph_uuid") if uuid] | ||
| ids_per_graph_uuid = {} | ||
| if uuids: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| uuids = [uuid for uuid in self.mapped("graph_uuid") if uuid] | |
| ids_per_graph_uuid = {} | |
| if uuids: | |
| ids_per_graph_uuid = {} | |
| if any(self.mapped("graph_uuid")): |
Isn't any faster in this case?
| "company_ids": [(6, 0, [main_company.id])], | ||
| "group_ids": [(6, 0, [group_user.id])], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be replaced by Command.set() to be consistent with the rest of your PR.
| User = cls.env["res.users"] | ||
| main_company = cls.env.ref("base.main_company") | ||
| group_user = cls.env.ref("base.group_user") | ||
| cls.demo_user = User.create( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| User = cls.env["res.users"] | |
| main_company = cls.env.ref("base.main_company") | |
| group_user = cls.env.ref("base.group_user") | |
| cls.demo_user = User.create( | |
| main_company = cls.env.ref("base.main_company") | |
| group_user = cls.env.ref("base.group_user") | |
| cls.demo_user = cls.env["res.users"].create( |
A bit opnionated, but the User variable is unnecessary and Camel cased variables should not be used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Camelcase is ok in this case as cls.env["res.users"] is (roughly) a class.
| def test_decoder_recordset_list_without_user(self): | ||
| value_json = ( | ||
| '["a", 1, {"_type": "odoo_recordset",' '"model": "res.users", "ids": [1]}]' | ||
| '["a", 1, {"_type": "odoo_recordset","model": "res.users", "ids": [1]}]' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| '["a", 1, {"_type": "odoo_recordset","model": "res.users", "ids": [1]}]' | |
| '["a", 1, {"_type": "odoo_recordset", "model": "res.users", "ids": [1]}]' |
| "company_ids": [(6, 0, [main_company.id])], | ||
| "group_ids": [(6, 0, [group_user.id])], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be replaced by Command.set()
| "company_ids": [(6, 0, [main_company.id])], | ||
| "group_ids": [(6, 0, [group_user.id])], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be replaced by Command.set()
| "company_ids": [(6, 0, [main_company.id])], | ||
| "group_ids": [(6, 0, [group_user.id])], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be replaced by Command.set()
| User = cls.env["res.users"] | ||
| main_company = cls.env.ref("base.main_company") | ||
| group_user = cls.env.ref("base.group_user") | ||
| cls.demo_user = User.create( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| User = cls.env["res.users"] | |
| main_company = cls.env.ref("base.main_company") | |
| group_user = cls.env.ref("base.group_user") | |
| cls.demo_user = User.create( | |
| main_company = cls.env.ref("base.main_company") | |
| group_user = cls.env.ref("base.group_user") | |
| cls.demo_user = cls.env["res.users"].create( |
| User = cls.env["res.users"] | ||
| main_company = cls.env.ref("base.main_company") | ||
| group_user = cls.env.ref("base.group_user") | ||
| cls.demo_user = User.create( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| User = cls.env["res.users"] | |
| main_company = cls.env.ref("base.main_company") | |
| group_user = cls.env.ref("base.group_user") | |
| cls.demo_user = User.create( | |
| main_company = cls.env.ref("base.main_company") | |
| group_user = cls.env.ref("base.group_user") | |
| cls.demo_user = cls.env["res.users"].create( |
@nilshamerlinck Curious, could you share your worker and channel configuration please? In my test, the jobs got enqueued, but were never actually processed. |


Scope
Summary
Pre-commit
Tests
./odoo/odoo-bin -c odoo.conf -d odoo_queue_pr_queue_job_base_001 --init queue_job,test_queue_job --test-tags="/queue_job,/test_queue_job" --stop-after-init