-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
[serve] Fix traceback string for RayTaskErrors when deploying serve app #33120
Conversation
Signed-off-by: Cindy Zhang <[email protected]>
Does anyone know how to get the lint checker to ignore a file? |
self.app_msg = f"Deployment failed:\n{traceback.format_exc()}" | ||
self.app_msg = f"Deployment failed:\n{str(e)}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how does this change the formatting & why is it required?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added an example of how it changes the formatting in the PR description. I haven't dug into why yet (only saw this custom formatting function), I can look into it more later today.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh -- thanks for doing that :)
that's fine, let's leave a comment indicating that it is important and shouldn't be changed to traceback.format_exc()
(which is more standard in my experience)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sg, will do!
Signed-off-by: Cindy Zhang <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you! nice fix
Signed-off-by: Cindy Zhang <[email protected]>
I'm not sure if it's possible to get linter to ignore a file with syntax error, since it can't even parse the file :( |
Can you give a try? https://docs.pylint.org/faq.html#how-can-i-tell-pylint-to-never-check-a-given-module |
Signed-off-by: Cindy Zhang <[email protected]>
Signed-off-by: Cindy Zhang <[email protected]>
@zcin looks like the linter error is now coming from |
This looks like the place: Line 151 in 7bb5d64
|
Signed-off-by: Cindy Zhang <[email protected]>
Something that could work if this doesn't is pylint: disable-next = ... |
Signed-off-by: Cindy Zhang <[email protected]>
Signed-off-by: Cindy Zhang <[email protected]>
'--force-exclude' 'python/ray/cloudpickle/*' | ||
'--force-exclude' 'python/build/*' | ||
'--force-exclude' 'python/ray/core/src/ray/gcs/*' | ||
'--force-exclude' 'python/ray/thirdparty_files/*' | ||
'--force-exclude' 'python/ray/_private/thirdparty/*' | ||
'--force-exclude' | ||
'python/ray/cloudpickle/*|'` | ||
`'python/build/*|'` | ||
`'python/ray/core/src/ray/gcs/*|'` | ||
`'python/ray/thirdparty_files/*|'` | ||
`'python/ray/_private/thirdparty/*|'` | ||
`'python/ray/serve/tests/test_config_files/syntax_error\.py' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm pretty sure --force-exclude
only takes one regex string, so all the files need to be in that single regex string. When I tried adding python/ray/serve/tests/test_config_files/syntax_error.py
as a --force-exclude
here, the linter ignored syntax_error.py
but started reformatting a bunch of files in python/ray/_private/thirdparty/*
, so the last --force-exclude
probably overrides all the previous ones. @ericl for approval on this code change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work!
…pp (ray-project#33120) If a syntax error occurs when Serve tries to import a Serve application and deploy it, the error will not show up correctly on `serve status`. Specifically it just shows `ray.exceptions.RayTaskError(SyntaxError): <no detail available>`. This makes it hard for users to debug. This is because for some reason `traceback.format_exc()` does not get the traceback string correctly for `RayTaskError`s; it seems to have it's own way of getting the traceback string [here](https://github.com/ray-project/ray/blob/a892241ca7574af47f278a667e6493a4b03686d7/python/ray/exceptions.py#L163). So we need to change `str(e)`. Previously: ``` name: '' app_status: status: DEPLOY_FAILED message: | Deployment failed: Traceback (most recent call last): File "/Users/cindyz/ray/python/ray/serve/_private/application_state.py", line 162, in update ray.get(finished[0]) File "/Users/cindyz/ray/python/ray/_private/client_mode_hook.py", line 105, in wrapper return func(*args, **kwargs) File "/Users/cindyz/ray/python/ray/_private/worker.py", line 2384, in get raise value.as_instanceof_cause() ray.exceptions.RayTaskError(SyntaxError): <no detail available> deployment_timestamp: 1678228862.220114 deployment_statuses: [] ``` With `str(e)`: ``` name: '' app_status: status: DEPLOY_FAILED message: |- Deployment failed: ray::run_graph() (pid=81000, ip=10.104.98.7) File "/Users/cindyz/ray/python/ray/serve/controller.py", line 859, in run_graph graph = import_attr(import_path) File "/Users/cindyz/miniforge3/envs/ray/lib/python3.8/importlib/__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1014, in _gcd_import File "<frozen importlib._bootstrap>", line 991, in _find_and_load File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 671, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 839, in exec_module File "<frozen importlib._bootstrap_external>", line 976, in get_code File "<frozen importlib._bootstrap_external>", line 906, in source_to_code File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed File "/Users/cindyz/Desktop/fail.py", line 4 print("yo") ^ SyntaxError: invalid syntax deployment_timestamp: 1678228961.0310981 deployment_statuses: [] ``` Signed-off-by: Jack He <[email protected]>
…pp (ray-project#33120) If a syntax error occurs when Serve tries to import a Serve application and deploy it, the error will not show up correctly on `serve status`. Specifically it just shows `ray.exceptions.RayTaskError(SyntaxError): <no detail available>`. This makes it hard for users to debug. This is because for some reason `traceback.format_exc()` does not get the traceback string correctly for `RayTaskError`s; it seems to have it's own way of getting the traceback string [here](https://github.com/ray-project/ray/blob/a892241ca7574af47f278a667e6493a4b03686d7/python/ray/exceptions.py#L163). So we need to change `str(e)`. Previously: ``` name: '' app_status: status: DEPLOY_FAILED message: | Deployment failed: Traceback (most recent call last): File "/Users/cindyz/ray/python/ray/serve/_private/application_state.py", line 162, in update ray.get(finished[0]) File "/Users/cindyz/ray/python/ray/_private/client_mode_hook.py", line 105, in wrapper return func(*args, **kwargs) File "/Users/cindyz/ray/python/ray/_private/worker.py", line 2384, in get raise value.as_instanceof_cause() ray.exceptions.RayTaskError(SyntaxError): <no detail available> deployment_timestamp: 1678228862.220114 deployment_statuses: [] ``` With `str(e)`: ``` name: '' app_status: status: DEPLOY_FAILED message: |- Deployment failed: ray::run_graph() (pid=81000, ip=10.104.98.7) File "/Users/cindyz/ray/python/ray/serve/controller.py", line 859, in run_graph graph = import_attr(import_path) File "/Users/cindyz/miniforge3/envs/ray/lib/python3.8/importlib/__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1014, in _gcd_import File "<frozen importlib._bootstrap>", line 991, in _find_and_load File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 671, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 839, in exec_module File "<frozen importlib._bootstrap_external>", line 976, in get_code File "<frozen importlib._bootstrap_external>", line 906, in source_to_code File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed File "/Users/cindyz/Desktop/fail.py", line 4 print("yo") ^ SyntaxError: invalid syntax deployment_timestamp: 1678228961.0310981 deployment_statuses: [] ```
…pp (ray-project#33120) If a syntax error occurs when Serve tries to import a Serve application and deploy it, the error will not show up correctly on `serve status`. Specifically it just shows `ray.exceptions.RayTaskError(SyntaxError): <no detail available>`. This makes it hard for users to debug. This is because for some reason `traceback.format_exc()` does not get the traceback string correctly for `RayTaskError`s; it seems to have it's own way of getting the traceback string [here](https://github.com/ray-project/ray/blob/a892241ca7574af47f278a667e6493a4b03686d7/python/ray/exceptions.py#L163). So we need to change `str(e)`. Previously: ``` name: '' app_status: status: DEPLOY_FAILED message: | Deployment failed: Traceback (most recent call last): File "/Users/cindyz/ray/python/ray/serve/_private/application_state.py", line 162, in update ray.get(finished[0]) File "/Users/cindyz/ray/python/ray/_private/client_mode_hook.py", line 105, in wrapper return func(*args, **kwargs) File "/Users/cindyz/ray/python/ray/_private/worker.py", line 2384, in get raise value.as_instanceof_cause() ray.exceptions.RayTaskError(SyntaxError): <no detail available> deployment_timestamp: 1678228862.220114 deployment_statuses: [] ``` With `str(e)`: ``` name: '' app_status: status: DEPLOY_FAILED message: |- Deployment failed: ray::run_graph() (pid=81000, ip=10.104.98.7) File "/Users/cindyz/ray/python/ray/serve/controller.py", line 859, in run_graph graph = import_attr(import_path) File "/Users/cindyz/miniforge3/envs/ray/lib/python3.8/importlib/__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1014, in _gcd_import File "<frozen importlib._bootstrap>", line 991, in _find_and_load File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 671, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 839, in exec_module File "<frozen importlib._bootstrap_external>", line 976, in get_code File "<frozen importlib._bootstrap_external>", line 906, in source_to_code File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed File "/Users/cindyz/Desktop/fail.py", line 4 print("yo") ^ SyntaxError: invalid syntax deployment_timestamp: 1678228961.0310981 deployment_statuses: [] ``` Signed-off-by: Edward Oakes <[email protected]>
…pp (ray-project#33120) If a syntax error occurs when Serve tries to import a Serve application and deploy it, the error will not show up correctly on `serve status`. Specifically it just shows `ray.exceptions.RayTaskError(SyntaxError): <no detail available>`. This makes it hard for users to debug. This is because for some reason `traceback.format_exc()` does not get the traceback string correctly for `RayTaskError`s; it seems to have it's own way of getting the traceback string [here](https://github.com/ray-project/ray/blob/a892241ca7574af47f278a667e6493a4b03686d7/python/ray/exceptions.py#L163). So we need to change `str(e)`. Previously: ``` name: '' app_status: status: DEPLOY_FAILED message: | Deployment failed: Traceback (most recent call last): File "/Users/cindyz/ray/python/ray/serve/_private/application_state.py", line 162, in update ray.get(finished[0]) File "/Users/cindyz/ray/python/ray/_private/client_mode_hook.py", line 105, in wrapper return func(*args, **kwargs) File "/Users/cindyz/ray/python/ray/_private/worker.py", line 2384, in get raise value.as_instanceof_cause() ray.exceptions.RayTaskError(SyntaxError): <no detail available> deployment_timestamp: 1678228862.220114 deployment_statuses: [] ``` With `str(e)`: ``` name: '' app_status: status: DEPLOY_FAILED message: |- Deployment failed: ray::run_graph() (pid=81000, ip=10.104.98.7) File "/Users/cindyz/ray/python/ray/serve/controller.py", line 859, in run_graph graph = import_attr(import_path) File "/Users/cindyz/miniforge3/envs/ray/lib/python3.8/importlib/__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1014, in _gcd_import File "<frozen importlib._bootstrap>", line 991, in _find_and_load File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 671, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 839, in exec_module File "<frozen importlib._bootstrap_external>", line 976, in get_code File "<frozen importlib._bootstrap_external>", line 906, in source_to_code File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed File "/Users/cindyz/Desktop/fail.py", line 4 print("yo") ^ SyntaxError: invalid syntax deployment_timestamp: 1678228961.0310981 deployment_statuses: [] ```
…pp (ray-project#33120) If a syntax error occurs when Serve tries to import a Serve application and deploy it, the error will not show up correctly on `serve status`. Specifically it just shows `ray.exceptions.RayTaskError(SyntaxError): <no detail available>`. This makes it hard for users to debug. This is because for some reason `traceback.format_exc()` does not get the traceback string correctly for `RayTaskError`s; it seems to have it's own way of getting the traceback string [here](https://github.com/ray-project/ray/blob/a892241ca7574af47f278a667e6493a4b03686d7/python/ray/exceptions.py#L163). So we need to change `str(e)`. Previously: ``` name: '' app_status: status: DEPLOY_FAILED message: | Deployment failed: Traceback (most recent call last): File "/Users/cindyz/ray/python/ray/serve/_private/application_state.py", line 162, in update ray.get(finished[0]) File "/Users/cindyz/ray/python/ray/_private/client_mode_hook.py", line 105, in wrapper return func(*args, **kwargs) File "/Users/cindyz/ray/python/ray/_private/worker.py", line 2384, in get raise value.as_instanceof_cause() ray.exceptions.RayTaskError(SyntaxError): <no detail available> deployment_timestamp: 1678228862.220114 deployment_statuses: [] ``` With `str(e)`: ``` name: '' app_status: status: DEPLOY_FAILED message: |- Deployment failed: ray::run_graph() (pid=81000, ip=10.104.98.7) File "/Users/cindyz/ray/python/ray/serve/controller.py", line 859, in run_graph graph = import_attr(import_path) File "/Users/cindyz/miniforge3/envs/ray/lib/python3.8/importlib/__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1014, in _gcd_import File "<frozen importlib._bootstrap>", line 991, in _find_and_load File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 671, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 839, in exec_module File "<frozen importlib._bootstrap_external>", line 976, in get_code File "<frozen importlib._bootstrap_external>", line 906, in source_to_code File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed File "/Users/cindyz/Desktop/fail.py", line 4 print("yo") ^ SyntaxError: invalid syntax deployment_timestamp: 1678228961.0310981 deployment_statuses: [] ```
…pp (ray-project#33120) If a syntax error occurs when Serve tries to import a Serve application and deploy it, the error will not show up correctly on `serve status`. Specifically it just shows `ray.exceptions.RayTaskError(SyntaxError): <no detail available>`. This makes it hard for users to debug. This is because for some reason `traceback.format_exc()` does not get the traceback string correctly for `RayTaskError`s; it seems to have it's own way of getting the traceback string [here](https://github.com/ray-project/ray/blob/a892241ca7574af47f278a667e6493a4b03686d7/python/ray/exceptions.py#L163). So we need to change `str(e)`. Previously: ``` name: '' app_status: status: DEPLOY_FAILED message: | Deployment failed: Traceback (most recent call last): File "/Users/cindyz/ray/python/ray/serve/_private/application_state.py", line 162, in update ray.get(finished[0]) File "/Users/cindyz/ray/python/ray/_private/client_mode_hook.py", line 105, in wrapper return func(*args, **kwargs) File "/Users/cindyz/ray/python/ray/_private/worker.py", line 2384, in get raise value.as_instanceof_cause() ray.exceptions.RayTaskError(SyntaxError): <no detail available> deployment_timestamp: 1678228862.220114 deployment_statuses: [] ``` With `str(e)`: ``` name: '' app_status: status: DEPLOY_FAILED message: |- Deployment failed: ray::run_graph() (pid=81000, ip=10.104.98.7) File "/Users/cindyz/ray/python/ray/serve/controller.py", line 859, in run_graph graph = import_attr(import_path) File "/Users/cindyz/miniforge3/envs/ray/lib/python3.8/importlib/__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1014, in _gcd_import File "<frozen importlib._bootstrap>", line 991, in _find_and_load File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 671, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 839, in exec_module File "<frozen importlib._bootstrap_external>", line 976, in get_code File "<frozen importlib._bootstrap_external>", line 906, in source_to_code File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed File "/Users/cindyz/Desktop/fail.py", line 4 print("yo") ^ SyntaxError: invalid syntax deployment_timestamp: 1678228961.0310981 deployment_statuses: [] ```
…pp (ray-project#33120) If a syntax error occurs when Serve tries to import a Serve application and deploy it, the error will not show up correctly on `serve status`. Specifically it just shows `ray.exceptions.RayTaskError(SyntaxError): <no detail available>`. This makes it hard for users to debug. This is because for some reason `traceback.format_exc()` does not get the traceback string correctly for `RayTaskError`s; it seems to have it's own way of getting the traceback string [here](https://github.com/ray-project/ray/blob/a892241ca7574af47f278a667e6493a4b03686d7/python/ray/exceptions.py#L163). So we need to change `str(e)`. Previously: ``` name: '' app_status: status: DEPLOY_FAILED message: | Deployment failed: Traceback (most recent call last): File "/Users/cindyz/ray/python/ray/serve/_private/application_state.py", line 162, in update ray.get(finished[0]) File "/Users/cindyz/ray/python/ray/_private/client_mode_hook.py", line 105, in wrapper return func(*args, **kwargs) File "/Users/cindyz/ray/python/ray/_private/worker.py", line 2384, in get raise value.as_instanceof_cause() ray.exceptions.RayTaskError(SyntaxError): <no detail available> deployment_timestamp: 1678228862.220114 deployment_statuses: [] ``` With `str(e)`: ``` name: '' app_status: status: DEPLOY_FAILED message: |- Deployment failed: ray::run_graph() (pid=81000, ip=10.104.98.7) File "/Users/cindyz/ray/python/ray/serve/controller.py", line 859, in run_graph graph = import_attr(import_path) File "/Users/cindyz/miniforge3/envs/ray/lib/python3.8/importlib/__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1014, in _gcd_import File "<frozen importlib._bootstrap>", line 991, in _find_and_load File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 671, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 839, in exec_module File "<frozen importlib._bootstrap_external>", line 976, in get_code File "<frozen importlib._bootstrap_external>", line 906, in source_to_code File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed File "/Users/cindyz/Desktop/fail.py", line 4 print("yo") ^ SyntaxError: invalid syntax deployment_timestamp: 1678228961.0310981 deployment_statuses: [] ``` Signed-off-by: elliottower <[email protected]>
…pp (ray-project#33120) If a syntax error occurs when Serve tries to import a Serve application and deploy it, the error will not show up correctly on `serve status`. Specifically it just shows `ray.exceptions.RayTaskError(SyntaxError): <no detail available>`. This makes it hard for users to debug. This is because for some reason `traceback.format_exc()` does not get the traceback string correctly for `RayTaskError`s; it seems to have it's own way of getting the traceback string [here](https://github.com/ray-project/ray/blob/a892241ca7574af47f278a667e6493a4b03686d7/python/ray/exceptions.py#L163). So we need to change `str(e)`. Previously: ``` name: '' app_status: status: DEPLOY_FAILED message: | Deployment failed: Traceback (most recent call last): File "/Users/cindyz/ray/python/ray/serve/_private/application_state.py", line 162, in update ray.get(finished[0]) File "/Users/cindyz/ray/python/ray/_private/client_mode_hook.py", line 105, in wrapper return func(*args, **kwargs) File "/Users/cindyz/ray/python/ray/_private/worker.py", line 2384, in get raise value.as_instanceof_cause() ray.exceptions.RayTaskError(SyntaxError): <no detail available> deployment_timestamp: 1678228862.220114 deployment_statuses: [] ``` With `str(e)`: ``` name: '' app_status: status: DEPLOY_FAILED message: |- Deployment failed: ray::run_graph() (pid=81000, ip=10.104.98.7) File "/Users/cindyz/ray/python/ray/serve/controller.py", line 859, in run_graph graph = import_attr(import_path) File "/Users/cindyz/miniforge3/envs/ray/lib/python3.8/importlib/__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1014, in _gcd_import File "<frozen importlib._bootstrap>", line 991, in _find_and_load File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 671, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 839, in exec_module File "<frozen importlib._bootstrap_external>", line 976, in get_code File "<frozen importlib._bootstrap_external>", line 906, in source_to_code File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed File "/Users/cindyz/Desktop/fail.py", line 4 print("yo") ^ SyntaxError: invalid syntax deployment_timestamp: 1678228961.0310981 deployment_statuses: [] ``` Signed-off-by: Jack He <[email protected]>
Why are these changes needed?
If a syntax error occurs when Serve tries to import a Serve application and deploy it, the error will not show up correctly on
serve status
. Specifically it just showsray.exceptions.RayTaskError(SyntaxError): <no detail available>
. This makes it hard for users to debug.This is because for some reason
traceback.format_exc()
does not get the traceback string correctly forRayTaskError
s; it seems to have it's own way of getting the traceback string here. So we need to changestr(e)
.Previously:
With
str(e)
:Related issue number
Closes #33118
Checks
git commit -s
) in this PR.scripts/format.sh
to lint the changes in this PR.