Allow exceptions that fail pickle deserialisation to be easily identified downstream. #8882
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.
Something we see quite a lot in our production dask (Coiled-powered) setup is exceptions failing to be deserialised when sent from the cluster to the client. This is usually due to either version mismatch or code being present within the cluster software environment that is not there on the client. Obviously this is not an ideal situation and one we're working to resolve.
However, the below change should make it easier to handle this situation in the meantime, as it makes such errors obvious (and able to be easily caught and handled, e.g. by adding a sensible user-facing message) rather than having to catch
Exception
and fish about for if the first argument is a bytestring that looks like a pickled object.I think this change should be compatible with any existing code that is attempting to do the above. If a breaking change were possible, would be nicer to add a "Unreadable pickled exception received" message to UnreadablePickledException and attach the actual pickled output as a separate field.
Closes #xxxx
pre-commit run --all-files
(I hope all the tests will pass on CI, seeing failures locally but I think that's due to not having working IPv6.)