Fix: Preserve Pydantic details when serialization fails#59401
Conversation
83d2a7b to
9c1916b
Compare
edoakes
left a comment
There was a problem hiding this comment.
looks good, just one minor comment
python/ray/exceptions.py
Outdated
| logger.warning( | ||
| f"The original cause of the RayTaskError ({err_type}) " | ||
| f"isn't serializable: {e}. Preserving error details." | ||
| ) |
There was a problem hiding this comment.
| logger.warning( | |
| f"The original cause of the RayTaskError ({err_type}) " | |
| f"isn't serializable: {e}. Preserving error details." | |
| ) | |
| logger.exception( | |
| f"The original cause of the RayTaskError ({err_type}) couldn't be serialized." | |
| ) |
There was a problem hiding this comment.
no need for "preserving error details", and logger.exception will include and format stack trace automatically
There was a problem hiding this comment.
Thanks for the review. Pushed the new change
|
@eicherseiji PTAL to help validate this solves your original issue |
…ion fails Fixes ray-project#59357 ## Description The Pydantic error is not serializable, making it difficult to root cause the bug. When a Pydantic ValidationError containing ArgsKwargs objects cannot be serialized, Ray now preserves the original error details including the ValidationError message and full traceback in the error message. ## Details Modified RayTaskError.__init__ to include the full traceback_str in the error message when serialization fails, allowing users to see the original ValidationError details even when the exception itself cannot be pickled. Signed-off-by: mgchoi239 <mg.choi.239@example.com>
58b7869 to
8285b9f
Compare
|
Hi @mgchoi239, thanks for the PR! The change works well. However, further investigation showed that #59357 root cause was missing ServeController logs. When the ServeController logs are present, Serve correctly surfaces the Pydantic validation error. In particular, it's not immediately clear why the ServeController logs were missing from the Ray service stdout in the KubeRay setup used for #59357, and launched identically with tl;dr: in the case where ServeController logs are for some reason missing, this change would immediately solve my debugging issue. But in general, users should not need this. @edoakes with that context I will let you make the call on this change. I will update the original issue. |
3620183 to
508d609
Compare
|
There was a test failure, likely due to the exception message changing: https://buildkite.com/ray-project/premerge/builds/55778#019b1927-7b54-4c26-8738-eb1f9117a6ae/622-1360 |
…dation-error-serialization
9290aca to
eb6dc29
Compare
Fixes #59357 ## Description The Pydantic error is not serializable, making it difficult to root cause the bug. When a Pydantic ValidationError containing ArgsKwargs objects cannot be serialized, Ray now preserves the original error details including the ValidationError message and full traceback in the error message. ## Details Modified RayTaskError.__init__ to include the full traceback_str in the error message when serialization fails, allowing users to see the original ValidationError details even when the exception itself cannot be pickled. ## Testing - Created test script that verifies original error details are preserved - Confirmed wrapped error is serializable - Verified original ValidationError information survives round-trip serialization Signed-off-by: mgchoi239 <mg.choi.239@example.com> Co-authored-by: MG <mg@MGs-MacBook-Air.local> Co-authored-by: mgchoi239 <mg.choi.239@example.com>
…59401) Fixes ray-project#59357 ## Description The Pydantic error is not serializable, making it difficult to root cause the bug. When a Pydantic ValidationError containing ArgsKwargs objects cannot be serialized, Ray now preserves the original error details including the ValidationError message and full traceback in the error message. ## Details Modified RayTaskError.__init__ to include the full traceback_str in the error message when serialization fails, allowing users to see the original ValidationError details even when the exception itself cannot be pickled. ## Testing - Created test script that verifies original error details are preserved - Confirmed wrapped error is serializable - Verified original ValidationError information survives round-trip serialization Signed-off-by: mgchoi239 <mg.choi.239@example.com> Co-authored-by: MG <mg@MGs-MacBook-Air.local> Co-authored-by: mgchoi239 <mg.choi.239@example.com>
…59401) Fixes ray-project#59357 ## Description The Pydantic error is not serializable, making it difficult to root cause the bug. When a Pydantic ValidationError containing ArgsKwargs objects cannot be serialized, Ray now preserves the original error details including the ValidationError message and full traceback in the error message. ## Details Modified RayTaskError.__init__ to include the full traceback_str in the error message when serialization fails, allowing users to see the original ValidationError details even when the exception itself cannot be pickled. ## Testing - Created test script that verifies original error details are preserved - Confirmed wrapped error is serializable - Verified original ValidationError information survives round-trip serialization Signed-off-by: mgchoi239 <mg.choi.239@example.com> Co-authored-by: MG <mg@MGs-MacBook-Air.local> Co-authored-by: mgchoi239 <mg.choi.239@example.com>
Fixes #59357
Description
The Pydantic error is not serializable, making it difficult to root cause the bug. When a Pydantic ValidationError containing ArgsKwargs objects cannot be serialized, Ray now preserves the original error details including the ValidationError message and full traceback in the error message.
Details
Modified RayTaskError.init to include the full traceback_str in the error message when serialization fails, allowing users to see the original ValidationError details even when the exception itself cannot be pickled.
Testing