Repository navigation
[20.0][MIG] queue_job_subscribe, test_queue_job; [IMP] queue_job: align with OCA 20.0 - #10
Merged
Merged
Conversation
Separate tests that need special methods in a dedicated test_queue_job module. Rework the registry of the jobs. The 'job' decorator is applied on functions before they are bound to their class, so we don't know the class yet. Now, the decorator marks job methods with 'delayable' and when a model is registered (Base._register_hook), it looks for the marked methods and register them.
To avoid to pollute 'queue.job.function' with a test job.
The model name, method name, recordset ids, arguments and keyword arguments must never ever be modified after the creation of a job. This change fix a bug when a job with a mutable argument see the content of the argument being modified during the execution of a job.
The automatic registration of job methods and their defaut channel has been a bit chaotic. The initial version for the new Odoo API could crashing as soon as a method was decorated by @Property. There is such a property in the code code, the method '_cache'. The problem of the crash was that, the introspection basically uses a 'getattr' on every attribute of the instance. The '_cache' method could then be called on an empty recordset, which is not supported by '_cache'. A first correction (49d8f37) was to naively skip the '_cache' method from the introspection. In any case, it is wrong to access the property of an instance only to instrospect its members. That's why the correction 4ebb245 changed the inspection from the instance to the class. Properties are no longer accessed, however this correction was not correct for Python 3. When members of the class are introspected, they are neither bound neither unbound methods. they are mere functions. The change here is to lookup for functions. _register_job must now takes the model as input argument, because there is no way to get the name of the model from the function. Closes OCA#64 Follows OCA#50
The related action button now opens by default the record on which the job is working. It uses the default views of the job. The exact behavior depends of the number of records in the job: * No record (job called on a model): display a message indicating that there is no available action * One record: open the default view in form * Several records: open the default view in list The related action can still be overridden by the 'related_action' decorator.
Currently translated at 100.0% (12 of 12 strings) Translation: queue-12.0/queue-12.0-test_queue_job Translate-URL: https://translation.odoo-community.org/projects/queue-12-0/queue-12-0-test_queue_job/zh_CN/
The former syntax is deprecated
This change has been done and accepted on the component and connector addons: OCA/connector#356 This is a low-level technical module, we may need to use jobs on enterprise features.
…assword for tests
In this commit we cleanly separate the job acquisition (i.e. verifying the job is in the exepected state, marking it started and locking it) from job execution. We also avoid trying to start the job if it is already locked by using SKIP LOCKED and exiting early. Indeed in such situations the job is likely already being handled by another worker so there is no point trying to start it, so we exit early and let it be handled either by the other worker or the dead job requeuer.
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: queue-18.0/queue-18.0-queue_job_subscribe Translate-URL: https://translation.odoo-community.org/projects/queue-18-0/queue-18-0-queue_job_subscribe/
Since we are not going to delete records nor modify foreign keys, we can take a weaker lock.
Every time a job is done, even if it is not part of a graph, it runs a query to look for dependents to enqueue. Storing the dependent uuids in the "dependencies" field was on purpose to know that we have no further jobs in the graph and that we can skip the check entirely and have no overhead in this case. It looks like an oversight, we can add the missing condition.
queue_job_cron_jobrunner and queue_job_subscribe are installable on 19.0: drop them from the excluded addons and regenerate the README. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Aligned with OCA#1036 (Command.link in tests). Assisted-by: Claude Opus 5.5
Code of OCA/queue@20.0 (8ef3956): the fork was a copy of an older OCA 19.0 and missed the later 19.0 work (old jobs removed by the base autovacuum, per channel removal interval, cancel all dependent jobs of a cancelled job, weaker locks, job acquisition refactor, runjob controller tests, X-Odoo-Database header instead of the post_load router patch). Fork deltas kept: version 20.0.2.4.0 (above the fork's 20.0.2.0.2), and migrations/20.0.2.4.0 dropping ir_cron_autovacuum_queue_jobs for the databases already on the fork 20.0, which skip the 19.0.2.2.0 step. Assisted-by: Claude Opus 5.5
queue_job 20.0 no longer exposes PG_CONCURRENCY_ERRORS_TO_RETRY: retry on the exception classes of odoo.sql_db, as in OCA#1008. Assisted-by: Claude Opus 5.5
Assisted-by: Claude Opus 5.5
With queue_job aligned on OCA/queue 20.0, take the remaining tests of OCA#1021: autovacuum per channel and from the base autovacuum, cancel of dependent jobs, recordset arguments rebound on commit. Assisted-by: Claude Opus 5.5
dhongu
marked this pull request as ready for review
November 28, 2026 03:14
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Lot OCA
queue→ 20.0 (branch20.0-mig-lot-oca,merge --no-ffdin20.0-mig-queue_job_subscribe,20.0-mig-test_queue_job,20.0-sync-queue_job-oca).date_cancelled), lock-uri mai slabe, refactorizarea achiziției de joburi, header-ulX-Odoo-Databaseîn locul patch-uluipost_loadpe router, testele controlleruluirunjob. Delta fork-ului păstrată:migrations/20.0.2.4.0ștergeir_cron_autovacuum_queue_jobsși pe bazele deja pe fork-ul 20.0 (sar pasul19.0.2.2.0; metodaautovacuum()nu mai există).openupgradelib(înrequirements.txt, deja folosită înothers_addons).PG_CONCURRENCY_ERRORS_TO_RETRYa dispărut din controller →odoo.sql_db.PG_CONCURRENCY_EXCEPTIONS_TO_RETRYcuisinstance, ca în [20.0][MIG] queue_job_cron_jobrunner: Migration to 20.0 OCA/queue#1008; portul nostruRetryableJobError.secondsrămâne.mig_module.sh --skip-fisa, fork OCA), aliniat cu [MIG] queue_job_subscribe: Migration to 20.0 OCA/queue#1036.ir.accessșiwith_company()din 20).Dublura
queue_job_subscribedindhongu/others_addonsnu se migrează: pe 20.0 suita sursă pentruqueue_job*equeue(auditlog: dhongu/others_addons#12).Teste locale (baze noi,
--skip-auto-install):test20_qsync_queue: queue_job 81, queue_job_cron_jobrunner 10, queue_job_subscribe 4, test_queue_job 166, auditlog 80 → 0 eșecuri, 0 WARNING;test20_qsync_dt:deltatech_queue_job50 teste, 0 eșecuri (dependent: patch peJob.cancel_dependent_jobs, devenit redundant, dar inofensiv);test20_qsync_mkt:deltatech_marketplace_queue_job17 teste, 0 eșecuri;queue_job20.0.2.0.2 (fork vechi) → 20.0.2.4.0: migrarea rulează, cronul vechi dispare, 0 WARNING.Preexistent, neschimbat: cu
deltatech_queue_jobinstalat, 2 teste dinqueue_job_cron_jobrunner(test_queue_job_cron_trigger*) pică și pe vechiul 20.0 —deltatech_queue_jobîși înlocuiește_cron_trigger.pre-commit run -acurat.Assisted-by: Claude Opus 5.5