librelist archives

« back to archive

Clarification of exception wrapping

Clarification of exception wrapping

From:
Peter Prettenhofer
Date:
2014-05-28 @ 12:27
Hi list,

joblib.Parallel wraps exceptions raised in the parallel function with a new
type ``Joblib<OriginalExceptionType>``. What is the reason for doing that
rather than propagating the same type that was raised in the function? I
assume it has something to do with providing nice tracebacks...

thanks for the clarification,
 Peter

-- 
Peter Prettenhofer

Re: [joblib] Clarification of exception wrapping

From:
Gael Varoquaux
Date:
2014-05-28 @ 12:30
> joblib.Parallel wraps exceptions raised in the parallel function with a
> new type ``Joblib<OriginalExceptionType>``. What is the reason for
> doing that rather than propagating the same type that was raised in the
> function? I assume it has something to do with providing nice
> tracebacks...

Because these are not the same exceptions. But they are a subtype, so
testing for the original exception will work.

Re: [joblib] Clarification of exception wrapping

From:
Peter Prettenhofer
Date:
2014-05-28 @ 12:46
I didn't realize that they are actually subtypes... nice
Anyhow, all attributes of the original exception are lost -- I wonder what
you think if we would provide exception chaining by piggybacking the
original exception with the Joblib error?


2014-05-28 14:30 GMT+02:00 Gael Varoquaux <gael.varoquaux@normalesup.org>:

> > joblib.Parallel wraps exceptions raised in the parallel function with a
> > new type ``Joblib<OriginalExceptionType>``. What is the reason for
> > doing that rather than propagating the same type that was raised in the
> > function? I assume it has something to do with providing nice
> > tracebacks...
>
> Because these are not the same exceptions. But they are a subtype, so
> testing for the original exception will work.
>



-- 
Peter Prettenhofer

Re: [joblib] Clarification of exception wrapping

From:
Gael Varoquaux
Date:
2014-05-28 @ 12:48
> I didn't realize that they are actually subtypes... nice
> Anyhow, all attributes of the original exception are lost -- I wonder what you
> think if we would provide exception chaining by piggybacking the original
> exception with the Joblib error?

Possibly partly. We'd have to pickle them in the subprocess, and send
them back. Probably a fair amount of work.