ipython / ipyparallel

IPython Parallel: Interactive Parallel Computing in Python
https://ipyparallel.readthedocs.io/
Other
2.59k stars 1.01k forks source link

Cluster API: Improve feedback when things go wrong #497

Open minrk opened 3 years ago

minrk commented 3 years ago

The Cluster API traps stdout/stderr of controller and engines because it's meant to be used interactively. But that's where information about why connection failures occurred is going to be, and it's frustrating to need to start a whole new cluster with log_level=logging.DEBUG to get a run with output you can see.

It would be good to be able to get this info after a process died that you didn't expect to. The answer to this is probably to pipe process output to a file and keep track of that file and provide an API to retrieve it.

minrk commented 3 years ago

The SSH launchers are piping to a file and have a get_output() method. This seems to be working well, and we can promote it to the base lanucher and e.g. show output on failure.

Thing I just learned that I thought would be trickier:

f = open("outputfile.txt", "wb")
p = Popen(["command"], stdout=f.fileno())
sys.exit()

works and the subprocess continues to produce output to the file even after the parent exits. That means we can have a very simple implementation of getting output that writes to a file and just read that file when an engine dies.