2

I'm wondering if it is possible to make stdout works with Parallel Python? It's really hard to debug without seeing any print-out.

For example, given the following code snippets:

import pp

def printit(s):
    print s

job_server = pp.Server()
for i in xrange(100):
    job_server.submit(printit, (i,))
job_server.wait()

There is not any print out. Any ideas?

Drake Guan
  • 14,514
  • 15
  • 67
  • 94

1 Answers1

1

Look into using the logging module. Set up your "parent" program to listen on a network port, and have your "jobs" send debug info (using logging) to that port. An example of how to set this up is given here: http://docs.python.org/2/howto/logging-cookbook.html#sending-and-receiving-logging-events-across-a-network

bkanuka
  • 907
  • 7
  • 18
  • Thank you. The similar answer was mentioned in http://stackoverflow.com/questions/15096090/python-separate-processes-logging-to-same-file. – Drake Guan Mar 29 '14 at 16:33