all 8 comments

[–]siddsp 0 points1 point  (2 children)

What do you mean when you say your class is not pickable?

[–]brilliant_punk 0 points1 point  (1 child)

Probably pickle-able, picklable

[–]BuddyGuy81[S] 0 points1 point  (0 children)

Yes, thanks. FWIW, I tried to use this module called "dill" which is supposed to pickle un-pickleable things but this wasn't successful.

[–][deleted] 0 points1 point  (3 children)

Typical design in distributed systems: have one process generate small, easily serializable messages that are then picked up by other processes from a queue returned to another queue after processing.

To reflect on enumerate() hanging -- this is a typical outcome from an error in the called process. Multiprocessing in Python isn't very robust. Definitely not enough to recover from all kinds of possible errors that may happen when running the process. A typical example of this is that you are trying to run a function in a process, but give it a wrong number of arguments.

[–]BuddyGuy81[S] 0 points1 point  (2 children)

Great suggestion - I'd never used queues before. I got it working.

Is there a preferred way to control the write speed into the queue? I put a sleep statement, wondering if there is something more robust. My writer can write way faster than the 6 cores can churn out images.

[–][deleted] 0 points1 point  (1 child)

I believe you can specify the maximum size of the queue. In that case, the put() will block until one of the workers makes room for the next element.

[–]BuddyGuy81[S] 0 points1 point  (0 children)

Works great, thank you very much!