Skip to content
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

Added error propagation to gateway_request function #1233

Merged
merged 2 commits into from
Mar 7, 2023

Conversation

broden-wanner
Copy link
Contributor

Summary

Feature for #1231. With this change, error messages from Enterprise Gateway will be propagated through Jupyter Server to the frontend. Looking through the Enterprise Gateway code, it seems that the JSON payload returned should only contain a reason field or a message field (or both possibly). See the code for the log_and_raise method of the processproxy here where the reason field is populated, and also see the swagger spec that lists only reason and message as possible properties. However, in my own testing, I've noticed the message and reason fields might not be in the body of the error (it's usually only one of them), so I've added logic to account for the fields missing or non-JSON payloads being returned. See relevant discussion on the Jupyter community forum here.

Screenshots

The following screenshots show the before and after error messages displayed on Jupyter lab when kernel creation times out.

Before

image
Error message in text: HTTP 500: Internal Server Error (Error attempting to connect to Gateway server url 'https://mygatewayurl'. Ensure gateway url is valid and the Gateway instance is running.)

After

image
Error message: HTTP 500: Internal Server Error (Error from Gateway: [Internal Server Error] KernelID: '094f5160-163a-4025-94cf-5d8922808dd3' launch timeout due to: Waited too long (40.0s) to get connection file. Ensure gateway url is valid and the Gateway instance is running.)

Tests

No test cases were modified, and it doesn't seem that any have failed. I noticed that the gateway_request function is mocked in testing and doesn't seem to be directly used in the tests. Let me know if you'd like any tests to be added for this error propagation.

@welcome
Copy link

welcome bot commented Mar 7, 2023

Thanks for submitting your first pull request! You are awesome! 🤗

If you haven't done so already, check out Jupyter's Code of Conduct. Also, please make sure you followed the pull request template, as this will help us review your contribution more quickly.
welcome
You can meet the other Jovyans by joining our Discourse forum. There is also a intro thread there where you can stop by and say Hi! 👋

Welcome to the Jupyter community! 🎉

@codecov
Copy link

codecov bot commented Mar 7, 2023

Codecov Report

Patch coverage has no change and project coverage change: -0.13 ⚠️

Comparison is base (4513527) 80.47% compared to head (e11e27e) 80.35%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1233      +/-   ##
==========================================
- Coverage   80.47%   80.35%   -0.13%     
==========================================
  Files          68       68              
  Lines        8252     8261       +9     
  Branches     1599     1600       +1     
==========================================
- Hits         6641     6638       -3     
- Misses       1189     1200      +11     
- Partials      422      423       +1     
Impacted Files Coverage Δ
jupyter_server/gateway/gateway_client.py 76.41% <0.00%> (-2.11%) ⬇️
...ter_server/services/kernels/connection/channels.py 61.72% <0.00%> (-0.45%) ⬇️
jupyter_server/serverapp.py 80.63% <0.00%> (-0.09%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Member

@kevin-bates kevin-bates left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes look good - thank you @broden-wanner!

@lresende
Copy link
Member

lresende commented Mar 7, 2023

Can we also backport this to 1.x branch?

@blink1073 blink1073 merged commit 9d5e1f6 into jupyter-server:main Mar 7, 2023
@welcome
Copy link

welcome bot commented Mar 7, 2023

Congrats on your first merged pull request in this project! 🎉
congrats
Thank you for contributing, we are very proud of you! ❤️

@blink1073
Copy link
Contributor

@meeseeksdev please backport to 1.x

meeseeksmachine pushed a commit to meeseeksmachine/jupyter_server that referenced this pull request Mar 7, 2023
blink1073 added a commit that referenced this pull request Mar 8, 2023
…equest function) (#1234)Co-authored-by: Broden Wanner <broden.wanner@outlook.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Steven Silvester <steven.silvester@ieee.org>

* Backport PR #1233: Added error propagation to gateway_request function

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* lint

---------

Co-authored-by: Broden Wanner <broden.wanner@outlook.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Steven Silvester <steven.silvester@ieee.org>
@kevin-bates
Copy link
Member

Hi @blink1073 - Is there a chance we could get a 1.x release that contains this change?

@blink1073
Copy link
Contributor

Done: https://github.com/jupyter-server/jupyter_server/releases/tag/v1.24.0

@kevin-bates
Copy link
Member

Thank you @blink1073!

@broden-wanner
Copy link
Contributor Author

Thank you @kevin-bates and @blink1073! Much appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants