All pastes #2050929 Raw Edit

Miscellany

public python v1 · immutable
#2050929 ·published 2011-04-26 17:07 UTC
rendered paste body
import osimport psycopg2from multiprocessing import Processdef target(args):    # Each forked process will have its own connection    # http://initd.org/psycopg/docs/usage.html#thread-and-process-safety    conn = get_db_connection()        # Stuff seems to execute till this point in all the children    print os.getpid(), os.getppid()    # Do some updates here. After this only one child is active and running    # Others become Zombies after a while.    if __name__ == '__main__':    args = "Foo"    for i in xrange(3):        p = Process(target=target, args=args)        p.start()