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

Misc updates on testing hub server spawing of binderhubs and documentation #4263

Merged
merged 8 commits into from
Jun 21, 2024

Conversation

GeorgianaElena
Copy link
Member

@GeorgianaElena GeorgianaElena commented Jun 20, 2024

Fixes #4167

This is currently failing for unauthenticated binderhubs because of some issue with the token being passed to /user/api/kernelspecs or dropped. Seeing this in the notebook logs:

[I 2024-06-20 14:22:15.949 ServerApp] 302 GET /user/deployment-service-check/ (@192.168.15.175) 0.51ms
[W 2024-06-20 14:22:21.607 ServerApp] wrote error: 'Forbidden'
    Traceback (most recent call last):
      File "/srv/conda/envs/notebook/lib/python3.10/site-packages/tornado/web.py", line 1788, in _execute
        result = method(*self.path_args, **self.path_kwargs)
      File "/srv/conda/envs/notebook/lib/python3.10/site-packages/tornado/web.py", line 3289, in wrapper
        url = self.get_login_url()
      File "/srv/conda/envs/notebook/lib/python3.10/site-packages/jupyter_server/base/handlers.py", line 782, in get_login_url
        raise web.HTTPError(403)
    tornado.web.HTTPError: HTTP 403: Forbidden
[W 2024-06-20 14:22:21.608 ServerApp] 403 GET /user/deployment-service-check/api/kernelspecs (@192.168.14.203) 1.89ms referer=None

But in that get request, the token should be passed because it's done under the same session here

https://github.com/Quansight/jhub-client/blob/860dff7365bdccc5208724390529b00b8198ccef/jhub_client/api.py#L226

Which gets called by https://github.com/Quansight/jhub-client/blob/860dff7365bdccc5208724390529b00b8198ccef/jhub_client/execute.py#L87
so not sure what's that about.

Can it be because of aio-libs/aiohttp#5783? I do see a 302 in the logs

This comment was marked as resolved.

Comment on lines 49 to 51
user_options={
"token": service_api_token,
"image": "quay.io/2i2c-projectpythia/binderhub-ui-binder-2dexamples-2drequirements-55ab5c:50533eb470ee6c24e872043d30b2fee463d6943f",
Copy link
Member Author

Choose a reason for hiding this comment

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

This should be special-cased for hubs not requiring authentication because of where the Spawner expects to find the token:

if self.auth_enabled:
args = super().get_args()
else:
args = [
"--ip=0.0.0.0",
f"--port={self.port}",
f"--NotebookApp.base_url={self.server.base_url}",
f"--NotebookApp.token={self.user_options['token']}",
"--NotebookApp.trust_xheaders=True",
]

Comment on lines +26 to +50
cmd:
- python3
- "-c"
- |
import os
import sys

try:
import jupyterlab
import jupyterlab.labapp
major = int(jupyterlab.__version__.split(".", 1)[0])
except Exception as e:
print("Failed to import jupyterlab: {e}", file=sys.stderr)
have_lab = False
else:
have_lab = major >= 3

if have_lab:
# technically, we could accept another jupyter-server-based frontend
print("Launching jupyter-lab", file=sys.stderr)
exe = "jupyter-lab"
else:
print("jupyter-lab not found, launching jupyter-notebook", file=sys.stderr)
exe = "jupyter-notebook"

Copy link
Member Author

Choose a reason for hiding this comment

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

This is what binderhub does too. Otherwise, in images that don't have jupyter-lab installed, spawning a server will fail

@GeorgianaElena GeorgianaElena changed the title [WIP] Test binderhubs hub server spawing Misc updates on testing hub server spawing of binderhubs and documentation Jun 21, 2024
@GeorgianaElena
Copy link
Member Author

Based on @yuvipanda's feedback in #4167 I've updated this PR to:

  • skip health tests for binderhubs that don't use authentication
  • updated the singleuser cmd to cover the cases when jupyter-lab is not installed in the image being launched (similar to what binderhub does) and updated the docs
  • updated the docs to mention that in the cluster.yaml we should enter the hub's domain rather than the binderhub's so that the tests work (for authenticated setups)

@GeorgianaElena GeorgianaElena merged commit 3b025c1 into 2i2c-org:main Jun 21, 2024
38 checks passed
@GeorgianaElena GeorgianaElena deleted the test-binderhubs branch June 21, 2024 11:27
Copy link

🎉🎉🎉🎉

Monitor the deployment of the hubs here 👉 https://github.com/2i2c-org/infrastructure/actions/runs/9612884778

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

Successfully merging this pull request may close these issues.

Handle healthchecks hubs with binderhub-service set up to launch
1 participant