Othoz/paragraph

Produce useful exception when using ThreadPool

Opened this issue · 0 comments

If the evaluation of an Op instance raises an exception, the associated context is of little use to identify the root cause of the issue.

This issue could be easily solved in single-threaded mode, where the call stack allows to catch the underlying exception in the body of paragraph.session.evaluate. When a ThreadPool is used, the exception is actually raised when the value of the Future is accessed, at which point the call stack does not allow to catch it at a place where the relevant context is available.

The solution consists in refactoring the flow of the submission to the ThreadPool in a way that the value of the futures are collected within the body of paragraph.session.evaluate.