On Sun, Apr 10, 2011 at 4:05 PM, Jason Swails <jason.swa...@gmail.com> wrote: > > > On Sun, Apr 10, 2011 at 12:34 PM, Laszlo Nagy <gand...@shopzeus.com> wrote: >> >> 2011.04.10. 21:25 keltezéssel, Jason Swails írta: >> >> Hello everyone, >> >> This may sound like a bit of a strange desire, but I want to change the >> way in which a python program quits if an exception is not caught. The >> program has many different classes of exceptions (for clarity purposes), and >> they're raised whenever something goes wrong. Most I want to be fatal, but >> others I'd want to catch and deal with. >> >> Well, the application quits when all of it threads are ended. Do you want >> to catch those exception only in the last threads? Or do you want to do it >> in all threads? Or just the main thread? > > The problem here is that the threads in this case are MPI threads, not > threads spawned during execution. (mpi4py). I want exceptions to be fatal > as they normally are, but it *must* call MPI's Abort function instead of > just dying, because that will strand the rest of the processes and cause an > infinite hang if there are any subsequent communication attempts. > > Hopefully this explains it more clearly? > > Thanks! > Jason >
Is there any reason you can't just surround the top level stuff in a try block? Assuming you have any structure at all to your program, there should be a single function call or two that triggers all the MPI stuff- just catch the exceptions up there. > -- > Jason M. Swails > Quantum Theory Project, > University of Florida > Ph.D. Candidate > 352-392-4032 > > -- > http://mail.python.org/mailman/listinfo/python-list > > -- http://mail.python.org/mailman/listinfo/python-list