-
Notifications
You must be signed in to change notification settings - Fork 134
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
Quell async warning, and POST with body for jupyterhub 3.0 #247
Conversation
This fails tests for python 3.5, but the latest jupyterhub has a test framework starting at python 3.7. Two years ago the oldest was python 3.6. Thoughts? |
Odd, I haven't had this problem with 3.0.0b1 (Python 3.9). My notebook server starts and I'm redirected without needing to make a change to singleuser. |
@rcthomas Okay, thanks. Do you see the warning message that I'm on python 3.8. |
I do not see that warning message, no... |
I deployed a new singleuser venv and a new hub container, both based on python 3.10. I still had the issue without the patch, and it went away with the patch. So if something in my environment is causing it, it seems like it isn't some version-specific async-y thing in python. Apparently the |
Just realized that while my hub is running JupyterHub 3.0.0b1, the separate environment where singleuser is executing isn't (they're separate deployments). When I upgrade that test environment I bet I see the same problem you're talking about. |
I now confirm the bug with the same warning and failure to redirect, sorry about the earlier false negative! I can at least confirm this doesn't appear through JupyterHub 2.3.1 but starts at 3.x.
@mbmilligan thoughts on the test matrix? |
@rcthomas No worries, and thanks for testing! I'm relieved that it is reproducible. |
Thanks for chasing this down! Regarding the version matrix, two years ago takes you back to Hub 1.3.0. Digging further, it appears that 1.2 is the last Hub that included Python 3.5 in the test matrix, although later versions do claim to support Python 3.5 (earlier pythons don't work because of the new async syntax iirc). I would be very surprised if anyone upgrading batchspawner is still using a Hub that old. Coming from another angle, the oldest widely used distribution among our userbase is probably RHEL/CentOS 7. Python 3.6 is available there (formerly via scl, in newer point releases it's in the base distro). So yes, I think I'm okay with dropping testing support for Python 3.5. I wouldn't drop 3.6 support for a while yet though. As that's currently the newest Python that can easily be installed on those CentOS 7 systems, I think we're stuck with it until those systems go EOL in 2024. |
@mbmilligan Okay, thanks! I'll make a new issue about the matrix because I'm curious about the coverage you'd like there. I think I'll need to update this PR to account for the case (<jh3) when the call is not async. |
Discussed in monthly meeting, let's discuss with JHub upstream to see if there's a better way to do this. |
Hi @minrk, there was some discussion at the last JupyterHub HPC meeting about how batchspawner currently invokes HubAuth's It came up because |
There should be a better way! A stable public ~all of the code in import requests
url = url_path_join(hub_auth.api_url, "batchspawner")
headers = {"Authorization": f"token {hub_auth.api_token}"}
# internal_ssl kwargs
kwargs = {}
if hub_auth.certfile and hub_auth.keyfile:
kwargs["cert"] = (hub_auth.certfile, hub_auth.keyfile)
if hub_auth.client_ca:
kwargs["verify"] = hub_auth.client_ca
r = requests.post(url, headers={"Authorization": f"token {hub_auth.api_token}"}, json=..., **kwargs) |
Okay, thanks @minrk ! I'll adjust this PR. |
I also ran through `black`.
Hi @mbmilligan I don't think we discussed this PR at the recent HPC call directly but I was wondering what we need to do to move this to a release? I think updaring the test matrix was one element. |
There is another suggestion here #250 |
And another which looks as if it should work nicely for both cases #251 |
Is there any update on this pull request yet? I also find this solution more elegant. We have a JupyterHub > v.3.0 in our HPC environment and have the possibility to start Jupyter notebook within custom Singularity containers. The changes would help to solve the problem communicating to the Hubs API. |
Hi @mawigh , this may check cleanly once 3.5 is no longer in the test matrix. Once that PR is merged we'll see if all of the tests in this PR will pass. People may be less available this time of year however so you might check in in January. |
Hi, just letting you know that #252 is merged now so you might want to try the tests on this again. |
…nto jupyterhub-3.0.0b1
for more information, see https://pre-commit.ci
Thanks @mbmilligan ! It reran checks after I merged master into this branch, but it is failing on what looks like unrelated code. (ORM, sqlalchemy) |
Okay my strong suspicion is that this is working correctly. I'm merging this so that people working from the main branch have this solution for 3.0 hubs while we work to sort out the test situation. |
The tests fail because the "install dependencies" step installs SQLAlchemy 2.x which is incompatible with JupyterHub < 3.1.1. |
Hi, I have the same issue using JupyterHub 4.0.0 with the last Batchspawner release 1.2 using pip/conda. Is there any schedule date to launch another release that contain the patch? |
I upgraded a development hub to jupyterhub 3.0.0b1 from 1.5.x and ran into a couple of issues. I'm using slurm and these issues were present with the latest release and latest in git:
Initially I was seeing the following warning:
It did start the server, however the hub wouldn't redirect me to it.
This patch quells the warning, but more importantly causes hub to redirect me to the server properly. I don't know if anyone else has been able to use batchspawner as-is with jupyterhub 3.0.0b1.
This also updates the api request call to post data via the
body
parameter which seems like the right way to do that now according to tornado HTTPRequest docs.