how to test for running server?

36 views
Skip to first unread message

Tim Harsch

unread,
Dec 19, 2017, 5:44:35 PM12/19/17
to Project Jupyter
Hi all,
I see with JupyterHub API you can POST or DELETE to  /users/{name}/server but there doesn't seem to be a GET.  If that's true is there another way I can test for a running server other than POST or DELETE which have their side effects?..

Thanks,
Tim

Lawrence D’Oliveiro

unread,
Dec 20, 2017, 6:26:32 PM12/20/17
to Project Jupyter
On Wednesday, December 20, 2017 at 11:44:35 AM UTC+13, Tim Harsch wrote:
I see with JupyterHub API you can POST or DELETE to  /users/{name}/server but there doesn't seem to be a GET.  If that's true is there another way I can test for a running server other than POST or DELETE which have their side effects?..

Whether POST and GET have “side” effects or not is entirely up to how the server interprets the request.

Tim Harsch

unread,
Dec 20, 2017, 7:14:33 PM12/20/17
to Project Jupyter
Right.  Sorry, I should have been more clear.  In the case of DELETE, if you attempt to DELETE when no server is running you will get a HTTP 400 and no action taken.  But, if you DELETE and a server is running then the server stops and you will get HTTP 204(I think).   Similar logic for POST.  I really just want to check the status, without causing stop or start of the server.

Since there seems to be no GET method, could I possibly something using the services?  or maybe I could implement the GET ?  Just looking for advice on best way forward..

Thanks,
Tim

MinRK

unread,
Jan 16, 2018, 1:40:50 PM1/16/18
to Project Jupyter

A GET on the user shows their server status(es). If the user is not running, the server value will be null. If it is running, the server value will be the URL of the running server.

The below results are with the named-servers extension enabled. If it is not enabled, then the servers key may be omitted. Only the 'default' server will show up in user.server, so user.servers will have a dict of all running servers for a given user, keyed by name.

Running:

GET /users/:name
    {
      "kind": "user",
      "name": "name",
      "admin": true,
      "groups": [],
      "server": "/user/name/",
      "pending": null,
      "last_activity": "2018-01-16T18:31:36.151369",
      "servers": {
        "": {
          "name": "",
          "url": "/user/name/"
        }
      }
    }

Not running:

    {
      "kind": "user",
      "name": "name",
      "admin": true,
      "groups": [],
      "server": null,
      "pending": null,
      "last_activity": "2018-01-16T18:35:54.491154",
      "servers": {}
    }

On Wed, Dec 20, 2017 at 4:14 PM, Tim Harsch <harsc...@gmail.com> wrote:
Right.  Sorry, I should have been more clear.  In the case of DELETE, if you attempt to DELETE when no server is running you will get a HTTP 400 and no action taken.  But, if you DELETE and a server is running then the server stops and you will get HTTP 204(I think).   Similar logic for POST.  I really just want to check the status, without causing stop or start of the server.

Since there seems to be no GET method, could I possibly something using the services?  or maybe I could implement the GET ?  Just looking for advice on best way forward.

I think it would be fine to add a GET for individual servers.
 

Thanks,
Tim

On Wednesday, December 20, 2017 at 3:26:32 PM UTC-8, Lawrence D’Oliveiro wrote:
On Wednesday, December 20, 2017 at 11:44:35 AM UTC+13, Tim Harsch wrote:
I see with JupyterHub API you can POST or DELETE to  /users/{name}/server but there doesn't seem to be a GET.  If that's true is there another way I can test for a running server other than POST or DELETE which have their side effects?..

Whether POST and GET have “side” effects or not is entirely up to how the server interprets the request.

--
You received this message because you are subscribed to the Google Groups "Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jupyter+unsubscribe@googlegroups.com.
To post to this group, send email to jup...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jupyter/4de7b283-659c-4d63-ad8e-ca5c432f5b12%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Tim Harsch

unread,
Jan 18, 2018, 6:43:49 PM1/18/18
to Project Jupyter
Thank you!  I will try to find some time to submit a PR for additional GET method for servers.
To unsubscribe from this group and stop receiving emails from it, send an email to jupyter+u...@googlegroups.com.

To post to this group, send email to jup...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages