-
Notifications
You must be signed in to change notification settings - Fork 319
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
Include base_url at start of kernelspec resources path #1124
Conversation
Codecov ReportBase: 80.04% // Head: 79.99% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #1124 +/- ##
==========================================
- Coverage 80.04% 79.99% -0.06%
==========================================
Files 68 68
Lines 8040 8053 +13
Branches 1588 1591 +3
==========================================
+ Hits 6436 6442 +6
- Misses 1182 1186 +4
- Partials 422 425 +3
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. |
hi @bloomsa - thanks for the PR! I've gone ahead and queued myself as a reviewer. At quick glance, I guess I was hoping we could contain these "gateway-related" changes in the gateway directory since the Also, I don't see logic to handle the replacement of a potential |
I totally agree on this point. I initially tried to keep the changes limited to that class but I couldn't figure out how to get the server's base_url from there. I'll go ahead and make that change asap.
With regards to this, I believe that base url would always be part of the Thank you for the quick review and pointing me in the right direction. It's much appreciated :) @kevin-bates |
Correct. Using the example below in which my EG was launched using
Yes. So with
where, if starting jupyter server with Regarding this clause: these changes to jupyter-server would trickle down to EG. Just to clarify, no changes to EG should be required. I suspect you know that and was just stating that the EG resources may also be prefixed with EG's relative base-url. |
This is ready for re-review. I tried to avoid the nested for loop in the helper method but I couldn't figure out a better way of doing it since the json response object from a Gateway has a nested structure. The code now handle the following situations:
screenshots |
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.
Hi @bloomsa - this is looking good and works well. I just had some comments around the logging and perhaps improving on the test at some point. Thanks.
jupyter_server/gateway/managers.py
Outdated
kernel_specs["kernelspecs"][kernel_name]["resources"][ | ||
resource_name | ||
] = url_path_join(self.parent.base_url, "/kernelspecs", split_eg_base_url[1]) | ||
self.log.debug( |
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.
Could we please make this logging conditional on there being a replacement? Otherwise, this will log for 80% of cases when base_url
values are not in play.
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.
good call. I'll add a conditional check.
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.
Thanks @bloomsa!
@meeseeksdev please backport to 1.x |
…pec resources path
…pec resources path) (#1138) Co-authored-by: Sam Bloomquist <[email protected]>
Resolves #1111
This ended up being a pretty minimal change. Now when returning kernelspecs from an EG, jupyter-server prepends its own base_url to the path so that any clients requesting those resources hits the proper endpoint on jupyter-server. I did not have to change anything on the gatewayClient side because
JUPYTER_GATEWAY_KERNELSPECS_RESOURCE_ENDPOINT
is handled already, and the addition of jupyter-server base_url in the resource path doesn't need to be handled because it's already excluded by the gateway resource handler when getting resourcesScreenshots
![Screen Shot 2022-12-08 at 12 09 13 PM](https://user-images.githubusercontent.com/20909250/206532599-6bce52f8-b57d-469f-b821-fec299ed9554.png)
This was taken with Jupyter-lab pointing to my local install of Jupyter-server, which was configured with `--ServerApp.base_url=base`. I also tested the case where no `base_url` was present.Tests
I didn't modify any test cases, but it doesn't look like any failed. I'm guessing that's because the tests don't have a resources block in the kernelspec. Would you like me to add that as part of this PR?