1

I'd like to log the output of several processes I start with multiprocessing. My question is related to Log output of multiprocessing.Process .

However, the difficulty is, that I'm using some library that calls external programs which output to stdout. Is there a way of capturing the output of these external programs called within python session opened by multiprocessor without altering the code of that library that calls these programs?

Edit: The processes of python started by multiprocessing seem to have some more subprocesses I guess that's why some of the output is still printed to stdout. I get output files for PIDs 4491, 4490, and 4489 I get output files for PIDs 4491, 4490, and 4489

Community
  • 1
  • 1
dba
  • 453
  • 3
  • 16
  • But aren't these all child processes inheriting your parent processes stdout channel? How did your attempt fail, any error traces that could give us hints? As I understand the referenced page, the trick offered there is to redfine sys.stdout – Dilettant Jun 14 '16 at 17:25
  • That's the question. Apparently not, otherwise I wouldn't see all the output of these subprocesses in `stdout` whereass all python output is succesfully written to these output files – dba Jun 14 '16 at 17:52
  • So, no error trace, no complaints, just displaying a bunch of stuff in stdout, which is of course screwed up to to the parallel workers. I could redirect `stdout/err` to `/dev/null` but then I'd loose information I'd actually like to capture – dba Jun 14 '16 at 18:00
  • Off console for now, I am, will try later again. – Dilettant Jun 14 '16 at 18:02

0 Answers0