-
-
Notifications
You must be signed in to change notification settings - Fork 535
[15.0][MIG] 'queue_job' module #378
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
Conversation
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.
In addition to the ODOO_CONNECTOR_CHANNELS environment variable, for
backward compatibility, we can configure the runner channels through
the ODOO_QUEUE_JOB_CHANNELS and in the odoo configuration file like this:
[options-job_queue]
channels = root:4
For backward compatibility, the section `[options-connector]` is also
accepted.
Moreover, it's now also possible to preload the module in the config
file, like:
[options]
server_wide_modules = web,web_kanban,queue_job
As such we can configure the job runner using only the Odoo config file.
Ignore whitespace around values, and tolerate missing entries that would be caused by trailing commas or commented lines when the channel configuration is provided through the Odoo configuration file. Also, accept line breaks channel entry separators along with commas, which make the configuration file more readable.
Or replace them with references to queue_job. Also, rip off the barely useful modicum of backward compatibility.
Useful for debugging if jobs when we want to know if and when a job is
being enqueued. It will log something like:
odoo.addons.queue_job.job: enqueued model.name(1, 2, 3, ):method_name(*(arg1, arg2, ...), **{'kwarg1': 'value1', 'kwarg2': 'value2', ...}) with uuid: fdec21f5-7579-49b3-a80c-1ba91a6f3cfa
Instead of trying to parse error messages from postgres, check the existence of the module table with a non-exception-raising query. The `unicode(err)` cast failed with postgres in locales that generated error messages with non-ascii chars.
Add JSON encoder and decoder for datetime and date values in the jobs so we can use these types in job arguments.
When a job is enqueued with recordsets in args/kwargs, they are serialized as json. When they are deserialized, until now the recorsets were read using the admin user. With this change, the original user is included in the json, so we can read the recordset with the original user.
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: queue-14.0/queue-14.0-queue_job Translate-URL: https://translation.odoo-community.org/projects/queue-14-0/queue-14-0-queue_job/
…inate a job + test"
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: queue-14.0/queue-14.0-queue_job Translate-URL: https://translation.odoo-community.org/projects/queue-14-0/queue-14-0-queue_job/
This patch method has to be called in ``_register_hook``. When a method is patched, any call to the method will not directly execute the method's body, but will instead enqueue a job. When a ``context_key`` is set when calling ``_patch_job_auto_delay``, the patched method is automatically delayed only when this key is ``True`` in the caller's context. It is advised to patch the method with a ``context_key``, because making the automatic delay *in any case* can produce nasty and unexpected side effects (e.g. another module calls the method and expects it to be computed before doing something else, expecting a result, ...). A typical use case is when a method in a module we don't control is called synchronously in the middle of another method, and we'd like all the calls to this method become asynchronous. It relies on OCA#274 that deprecates the `@job` decorator.
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: queue-14.0/queue-14.0-queue_job Translate-URL: https://translation.odoo-community.org/projects/queue-14-0/queue-14-0-queue_job/
a322778 to
d37c8cf
Compare
|
@pedrobaeza looks like workflow is not running, because @romi477 is first time contributor. Could you, please, check and approve workflows? |
d37c8cf to
81579a7
Compare
|
@guewen could you, please, review and approve |
guewen
left a comment
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.
Thanks for the work!
|
This PR has the |
|
@guewen I guess you need to merge it now? |
|
@ventor-dev usually in this repository, we keep the branch and set modules as uninstallable, I didn't had the opportunity to prepare the branch this way. I'm about to force-push the branch to restore the history, then, I cherry-picked your commits in a new branch. I'll open a PR with this branch to check the CI. |
|
BTW, I didn't see before, you missed the module |
|
Note that this flow is an exception made by the maintainers of this repository, not the usual OCA flow. |
No description provided.