Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

Check for running server and prompt to restart #84

Closed
wants to merge 2 commits into from

Conversation

minrk
Copy link
Member

@minrk minrk commented Mar 25, 2019

polls /api/status, showing dialog on failure

  • adds restart-server action
  • restart-server action opens new tab pointed to /hub/spawn to trigger the new spawn

Improvements that could be made:

  1. restart with API request instead of new tab (not reliable because API token may not still be valid with the Hub after stop)
  2. use /hub/spawn/:user/:server spawn urls, which are new in Hub 1.0. This PR won't properly restart named servers. This also requires jupyterlab to make the username and server name available to PageConfig (or we can parse the url).
  3. hook into lab's existing Connection Lost event

Fixes #83

Screenshots

Screen Shot 2019-03-25 at 15 36 05

polls /api/status, showing dialog on failure

- adds restart-server action
- restart-server action opens new tab pointed to /hub/spawn to trigger the new spawn

Improvements that could be made:

1. restart with API request instead of new tab (not reliable because API token may not still be valid with the Hub after stop)
2. use `/hub/spawn/:user/:server` spawn urls, which are new in Hub 1.0
3. hook into lab's existing Connection Lost event
@consideRatio
Copy link
Member

Wow @minrk this is an excellent idea I think!

I wonder what happens if this competes with other errors that tend to show when you loose connectivity to the server, will you get two dialog boxes, one after the other, will you only get one?

If this works properly, this would be a big UX win!! 🎉

I cannot do much insightful review of the technical changes though, but I picked up some insights while reading them. I'm excited about this PR! :D

@minrk
Copy link
Member Author

minrk commented Mar 26, 2019

That's what I was referring to with the hook into lab's existing Connection Lost event. That event will can still occur, so there can be a bit of a fight for which dialog the user is shown. Ideally, we would override the connection lost dialog with this as well.

Copy link

@yuvipanda yuvipanda left a comment

Choose a reason for hiding this comment

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

I like it! I'll test this out soon.

// This config is provided by JupyterHub to the single-user server app
// in a dictionary: app.web_app.settings['page_config_data'].
this.hubHost = PageConfig.getOption('hub_host');
this.hubPrefix = PageConfig.getOption('hub_prefix');

Choose a reason for hiding this comment

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

Should this be camelCase or snake_case? I vaguely remember seeing them being all camelCase, but could be wrong.

@ian-r-rose
Copy link

Hey all, jupyterlab/jupyterlab#6399 provides a new IConnectionLost token, which can be overridden by extensions, to handle a lost server connection. This should get around the dialog race. It won't be usable until a release, but should allow this PR to move forwards.

@yuvipanda
Copy link

gotta close this so search results don't include it as an old open PR!

@yuvipanda yuvipanda closed this Jun 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Link to Hub to restart stopped servers
4 participants