-
Notifications
You must be signed in to change notification settings - Fork 5.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Data] map_batches
doesn't allow for custom errors to be caught
#46962
Comments
This problem can be solve with debug mode in ray data.
When you set RAY_DEBUG , it will raise udf exception
|
That does seem to work, but is that really the suggested path? Why is debug mode required to be able to surface user defined errors? Are there any other implications (performance or otherwise) to consider when enabling debug mode? |
For this, you'll want to set the DataContext.log_internal_stack_trace_to_stdout attribute. There are two ways to do it:
In later versions of Ray (2.33+), we changed this behavior so that we always show the full internal stack trace: #46647 Feel free to followup with any other questions. |
@scottjlee Thanks for the follow up, but I'm not sure I understand. The example reproduction script is from running Ray 2.34.0. The PR you linked seems to be about seeing the full traceback in logs, but I'm talking about being able to catch the custom error ( The current behavior is that I can only catch a |
Ah i see, I apologize I misunderstood upon initial read. I will mark this as a bug, as we should add another way to expose the full exception. Thanks for reporting I would say enabling the Ray debugger has some negative performance impact (although I am not exactly sure what the impact would be if it is enabled, and no debugger breakpoints are added). Probably not a good idea to enable in production, as you said. |
Sounds good. And thanks for confirming turning on |
## Why are these changes needed? close #46962 ## Related issue number #46962 ## Checks - [√] I've signed off every commit(by using the -s flag, i.e., `git commit -s`) in this PR. - [√] I've run `scripts/format.sh` to lint the changes in this PR. - [√] I've included any doc changes needed for https://docs.ray.io/en/master/. - [ ] I've added any new APIs to the API Reference. For example, if I added a method in Tune, I've added it in `doc/source/tune/api/` under the corresponding `.rst` file. - [ ] I've made sure the tests are passing. Note that there might be a few flaky tests, see the recent failures at https://flakey-tests.ray.io/ - Testing Strategy - [√] Unit tests - [ ] Release tests - [ ] This PR is not tested :( --------- Signed-off-by: zhilong <zhilong.chen@mail.mcgill.ca>
## Why are these changes needed? close ray-project#46962 ## Related issue number ray-project#46962 ## Checks - [√] I've signed off every commit(by using the -s flag, i.e., `git commit -s`) in this PR. - [√] I've run `scripts/format.sh` to lint the changes in this PR. - [√] I've included any doc changes needed for https://docs.ray.io/en/master/. - [ ] I've added any new APIs to the API Reference. For example, if I added a method in Tune, I've added it in `doc/source/tune/api/` under the corresponding `.rst` file. - [ ] I've made sure the tests are passing. Note that there might be a few flaky tests, see the recent failures at https://flakey-tests.ray.io/ - Testing Strategy - [√] Unit tests - [ ] Release tests - [ ] This PR is not tested :( --------- Signed-off-by: zhilong <zhilong.chen@mail.mcgill.ca> Signed-off-by: ujjawal-khare <ujjawal.khare@dream11.com>
What happened + What you expected to happen
As far as I can tell, when wrapping a call to
map_batches
in a try/except block any errors thrown inside the batch function are "swallowed" and cannot be accessed through typical means.The error that gets thrown is a
RayTaskError(UserCodeException)
. The docs suggest that we should be able to extract the original error from aRayTaskError
by accessing itscause
attribute, but that's set to theUserCodeException
error (a Ray library error).The expected behavior is that we can catch user-defined exceptions when they're thrown from the batch function of a
map_batches
call.Versions / Dependencies
Ray v2.34.0 (seen in Ray v2.31.0 as well)
Python 3.12.2
Reproduction script
Script
Current output
Here's the most relevant, abbreviated, output from the script above:
Full logs with exception trace
Issue Severity
High: It blocks me from completing my task.
The text was updated successfully, but these errors were encountered: