-
Notifications
You must be signed in to change notification settings - Fork 231
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
Can't execute multiprocessing tasks using wrapt.decorator functions - not pickle serializable #158
Comments
I thought a workaround to the problem, if it is too hard to fix this, would be to disable the decorator and the following workaround works if the value passed to
then the below won't code throw any error
however - to dynamically set
I see on other issue threads (mainly #102) that perhaps an ObjectProxy is picklable/serializable if we explicitly define the |
For dynamic function to specify whether enabled, should be:
Not sure if you just cut and paste the wrong thing. But yes, it may not work as the function wrapper is still present when disabled using a function call, as is only evaluated at the time of the call. For the decorator to be applied at all, can only supply literal value.
So call has to be evaluated at time of code import. Anyway, I will think about pickle issue. For this narrow case of a function wrapper decorator (as opposed to general case of object proxy), there may be a way to get it to work. Will need some investigation though. The analysis was never done for dill since that was a third party package, and so not necessarily commonly used. |
Sorry yes I had a typo there - just edited/corrected it ...
This would be extremely helpful - thank you for this - please let me know if I can help in the process in any way. |
Hi @marwan116 have you given this any more thought? |
The error I'm getting on python 3.11 is that Or just add the following to it: def __reduce_ex__( self, protocol ):
return (
object.__new__,
(type(self),),
object.__getstate__(self),
) |
@twiddli I would need to see an actual small code example of what you are trying to do to suggest anything including any explanation if it can already be done as not sure what I am trying to suggest a modification to. FWIW. Trying to pickle code is not generally a great idea. And there is no generic single |
I am posting this to share the issue I face when trying to use multiple processes with a function wrapped with a
wrapt.decorator
.I am using the following libraries:
wrapt==1.12.1
joblib=0.14.1
python=3.7.6
Please see the dummy example below to reproduce the error
So first I try the code using multithreading and it works fine
I get the following output:
Then when I try to use processes instead of threads:
I get an error mainly:
NotImplementedError: object proxy must define __reduce_ex__()
below is the full traceback:
The text was updated successfully, but these errors were encountered: