Skip to content

Instantly share code, notes, and snippets.

View rikonaka's full-sized avatar
😜
To see a world in a grain of sand

isinstance rikonaka

😜
To see a world in a grain of sand
  • Moon
View GitHub Profile
@rikonaka
rikonaka / parent_child_mp_reduction
Created August 31, 2016 14:19 — forked from sunilmallya/parent_child_mp_reduction
multiprocessing.reduction socket server with parent processing passing connections to client after accepting connections
#!/usr/bin/env python
"""
@author Sunil Mallya
Sample code to show a parent - child like process communication model where parent listens on a port and passes the pickled file descriptor
to the child process to read the bytes off the socket. The communication in this snippet is via a Queue which is thread/process safe
Just to be clear, the parent process is still accepting the connection and we are sending a live fd to the child
"""
import os
import sys