-
-
Notifications
You must be signed in to change notification settings - Fork 472
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
delayable
attribute lost when the @job
decorator is not added on base method
#273
Comments
Well, this could be replaced by explicit XML records, and if you use |
On one side, the |
This! This is a side effect which adds a lot of value IMO. Nevertheless, if mod A adds the function, and B and C override it: who wins? You still have the possibility of conflicts between settings. No? |
👍
In such a case, all the overrides are into the call stack but the order into the stack is random for b and c ...
|
Yes, it opens many possibilities and indeed simplify a lot the registration. Not saying that declaring the XML records is optional so in the simplest cases, you only need to use
If you mean 2 modules can create the same xml record for |
Example of error message:
If I have such dependencies:
module_b and module_c have no dependencies on each other.
In
module_a
, we have a methodStockMove._update_foo
.In
module_b
, we add@job
onStockMove._update_foo
.In
module_c
, we have another override ofStockMove._update_foo
, without decorator.It seems that depending on the loading order, we'll lose the properties added by
@job
.AFAIU, it happens because of the way the registry builds a new instance based on a recomposed dependency graph, we can't be sure the kept function will be the one which has been decorated and has the
delayable
attribute. We would need to propagate it.That being said, the
delayable
attribute is there only to check that we decorated the method with@job
. If we remove the check atqueue/queue_job/job.py
Lines 81 to 85 in d465bdd
We can consider removing the need for
@job
(make it optional with default values). That would imply:@job
attributes on the method (queue/queue_job/job.py
Lines 828 to 831 in d465bdd
delayable
could be removed,delay
is deprecated, remainsretry_pattern
anddefault_channel
to store elsewhere, best place would be inqueue.job.function
I think as we could change them from the UIqueue/queue_job/job.py
Lines 897 to 898 in d465bdd
@job
allow listdelayable
is used to find the job methods used to createqueue.job.function
(queue/queue_job/models/base.py
Lines 24 to 35 in d465bdd
queue.job.function
the first time it's delayed? but then we don't have the ability to put default options...)Originally posted by @guewen in #270 (comment)
The text was updated successfully, but these errors were encountered: