How to use ProcessPoolExecutor? #1304
-
|
Hello, I'm trying to run a task using ProcessPoolExecutor, but I'm encountering an AttributeError, I believe, related to pickling. I've tried several approaches but haven't been able to get any of them to work. (defn foo [x] x)
(binding [*executor-pool* (basilisp.lang.futures/ProcessPoolExecutor)]
(def fut (future (foo 1))))
@futThe error: AttributeError: Can't get local object 'bound_fn__STAR__.<locals>.__bound_fn__STAR____lisp_fn_2730'I've tried to call .submit directly, but it didn't work either. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
I tried this locally and can confirm I'm getting the same error. I admit when I added the process executor, I didn't really test it -- it was just something Python supported so I added it without much further though. I think given the limitations of what can be pickled that it won't be possible to use |
Beta Was this translation helpful? Give feedback.
I tried this locally and can confirm I'm getting the same error. I admit when I added the process executor, I didn't really test it -- it was just something Python supported so I added it without much further though.
I think given the limitations of what can be pickled that it won't be possible to use
future,future-call,bound-fn*, orbound-fnwith a process pool executor. They create anonymous functions which contain the state of the current thread bindings, so my guess is there's not really any way of recreating that functionality usingpickle(which is howconcurrent.futures.ProcessPoolExecutorworks).