You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Instead of using a local dict to store the cache entries you should use a module attribute. module attributes (apart from those defined in the __main__ module) are pickled by reference instead of by value, so that should work. Each worker process would have it's own cache.
This issue made me think about improving the cloudpickle pull request: cloudpipe/cloudpickle#309 (comment) . It might be possible to implement re-usable lru_cache for interactively defined functions but this is not trivial work.
When using memoization (not with
functools.lru_cache
because #268) I am unable to getloky
to use the cache.I guess this is because
ex.submit(f, ...)
repicklesf
each time. Is it possible to tellloky
to not do that?In this example below, I show that a
concurrent.futures.ProcessPoolExecutor
uses the cache, whileloky
doesn't do this.The text was updated successfully, but these errors were encountered: