Repository navigation
Raise the task's exception from imap() iterators - #480
Open
LuisFigueroaG wants to merge 1 commit into
Open
LuisFigueroaG wants to merge 1 commit into
LuisFigueroaG wants to merge 1 commit into
Conversation
When a task failed, IMapIterator.next() raised Exception(ExceptionInfo)
instead of the exception the task raised, so code iterating over
imap()/imap_unordered() could not catch it by type ('except ValueError'
never matched) and only got a bare Exception whose message was the
remote traceback. apply_async().get() and map() raise the original
exception.
Raise value.exception, as ApplyResult.get() does. The worker's
traceback is still attached as the exception's __cause__.
auvipy
reviewed
Oct 21, 2026
auvipy
left a comment
Member
There was a problem hiding this comment.
is this a follow up of your previous PR?
Contributor
Author
|
Not a follow-up, they're independent. #475 keeps the Supervisor from crashing when a worker exits while an |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When a task fails,
IMapIterator.next()raisesException(value), wherevalueis theExceptionInfo, instead of the exception the task raised. Code iterating overimap()/imap_unordered()can't catch the error by its type (except ValueErrornever matches) and only gets a bareExceptionwrapping theExceptionInfo.apply_async().get()andmap()already raise the original exception.This raises
value.exception, the same asApplyResult.get().With a task that raises
ValueError('bad item 1'):Added a unit test for
imap()andimap_unordered().