Uh oh!
There was an error while loading. Please reload this page.
[13.0] Add storage of context in jobs recordsets - #432
Conversation
Uh oh!
There was an error while loading. Please reload this page.
aefd0b2 to
cd5df7eCompareUh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
cd5df7e to
9b0dbeaCompare9b0dbea to
bfc52a3CompareIt can still be activated by overriding a method.
francesco-ooops
commented
May 20, 2022
simahawk
commented
May 20, 2022
/ocabot merge minor Any plan for v14? |
OCA-git-bot
commented
May 20, 2022
Hey, thanks for contributing! Proceeding to merge this for you. |
OCA-git-bot
commented
May 20, 2022
Congratulations, your PR was merged at b9d89ef. Thanks a lot for contributing to OCA. ❤️ |
francesco-ooops
commented
Jul 6, 2022
Hi @guewen@simahawk@acsonefho , so going back to the original need (from PR #407 ):
How do you suggest to implement this? should we create a new module "base_import_async_lang" here on OCA to set language in the context? |
francesco-ooops
commented
Jul 13, 2022
@OCA/connector-maintainers |
acsonefho
commented
Jul 13, 2022
Maybe you can create a module who contains only this: Then ping Guewen and Simahawk to have review and feedback :) |
francesco-ooops
commented
Jul 13, 2022
@acsonefho thanks a lot! |
simahawk
commented
Jul 13, 2022
Instead of adding a new module, you can make |
hildickethan
commented
Jul 14, 2022
Hello, I've been trying to use this feature to send a context from the creation of the job to the actual job runtime itself but I feel like there's something missing. With this added it runs the jobs with the context that was passed, plus the ones added later for I just want to check if this is intentionally left out (for backwards compatibility I guess?) and is planned for 16.0 or it was an oversight, because I couldn't find any discussion on this part specifically in the various related PRs It can be worked around by searching the |
francesco-ooops
commented
Jul 18, 2022
@simahawk how shall we proceed? |
@francesco-ooops Expanding on @acsonefho 's suggestion, I'd create a module that does only this: queue/queue_job/models/base.py Line 261 in c8b16ff Since that will become the default in v16, it seems reasonable to have module that anticipates the default, which you can install if you are sure that all your jobs are compatible with that.
@hildickethan-S73 that makes sense (disclaimer: I've not tested myself). Would you mind doing a PR with the missing part? |
I totally agree with @acsonefho and @sbidoul proposal, it's like an opt-in to the behavior that will be the default in 16.0 |
francesco-ooops
commented
Jul 18, 2022
@hildickethan-S73 ooch, that's indeed an oversight from my part 🤦. This line that initializes the record(s) from the Json in JobDecoder has to set the context: model = self.env(user=obj.get("uid"), su=obj.get("su"))[obj["model"]] (Sorry, I'm on my phone and can't manage to copy-paste the exact link in the GitHub app😓) |
hildickethan
commented
Jul 18, 2022
AshishHirapara
commented
Jul 27, 2022
GSLabIt
commented
Sep 20, 2022
Hi there, we developed a module to return the Are we missing something? |
GSLabIt
commented
Sep 20, 2022
sorry my fault ..working properly |
francesco-ooops
commented
Oct 14, 2022
|
Alternative to #406.
Adapted from acsone#1 with tests.
This version has a breaking change in the sense that now the basic arguments such as tz, lang, etc in the context are kept, so may bring behavior changes in the existing jobs. In a way, this could be considered a bug so... to discuss (or consider this is the version we want for 16.0, and the list will be empty in earlier versions).
I would not keep all keys by default for several reasons :
prefetch_fields)This implementation may be simple and naive, but I do think it is enough, as people can customize the keys allowed in the context. Also, more smart solutions could easily lead to leaky abstractions, because jobs can have contexts in their
selfrecordset, but also inargsandkwargswhich potentially would all need different handling (hence a global handling works for each case).