Note that there are some explanatory texts on larger screens.

plurals
  1. POpython different child processes and communication
    primarykey
    data
    text
    <p>Initial question <a href="https://stackoverflow.com/questions/19745075/python-multiprocessing-pipes-how-to-call-callback-function-if-child-process-sent">here</a>.</p> <p>I have an architecture in my python project: main application process spawns many child processes. Main process listening to network connection and then data received main process passes that data to ALL child processes without listening to each other. Child processes may perform an action or not (depends on received) data, and if they need to perform action - they have to send message to main process to let it send data to server through it's network connection. For my architecture, I guess, it would be nice to have a callback architecture which usually realizes by <code>observer pattern from head of four</code>.</p> <p>I have a processes which is not just parallel workers - it is different child processes that can do different actions on the same data that they may receive from pipe/queue, but if I adapt my code to queues then child processes must use task_queue.get() to get data from parent process, but if one of many child processes will get any task from task_queue - others will not receive that data and will not perform action. I need to pass each task from task_queue to all child processes and listen answer from them.</p> <p>I've already tried to realize that functionality by pipes - but it needs a lot of data(store pipes at least) and I don't know how to realize pipes functionality with many processes - everywhere I saw examples it was with one pipe and it was <code>while True:</code>inifinite loop - therefore I can't use that because main process don't know which of all child processes to listen at this moment (actually only one of old child processes will perform an action).</p> <p>I've also tried to realize it by queues - but if one of child processes will call 'task_queue.get()' - it will remove this item from task queue but I need to pass that data to ALL of my child processes. Also, in these both methods I need to listen to all child processes, but I want to be as observer of their actions - if some of child processes want to perform an action - it send data to main process, then in main process calls callback-function and ...</p> <p>I'm knew to python, please, give me the way how can I realize this thing.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload