I\'m having deadlock problems with this piece of code:
def _entropy_split_parallel(data_train, answers_train, weights):
CPUS = 1 #multiprocessing.cpu_co
I think the problem is the parent thread joining a child thread to which it has passed a Queue. This is discussed the the multiprocessing module's programming guidelines section.
At any rate, I encountered the same symptom that you describe, and when I refactored my logic so that the master thread did not join the child threads, there was no deadlock. My refactored logic involved knowing the number of items that I should get from the results or "done" queue (which can be predicted based on either the number of child threads or the number of items on the work queue, etc.), and looping infinitely till all of these were collected.
"Toy" illustration of the logic:
num_items_expected = figure_it_out(work_queue, num_threads)
items_received = []
while len(items_received) < num_items_expected:
items_received.append(done_queue.get())
time.sleep(5)
The above logic avoids the need for the parent thread to join the child thread, yet allows the parent thread to block until all the children are done. This approach avoided my deadlock problems.
This problem went away with newer versions of Python, so I'm assuming it was a problem with the backport. Anyways, it's no longer an issue.