informatics-lab / aml-jupyterhub

Code work and experiments to integrate Azure Machine Learning with JupyterHub.
6 stars 4 forks source link

Logging out, and releasing resources #29

Open nbarlowATI opened 4 years ago

nbarlowATI commented 4 years ago

One thing to think about is how to handle users logging out, and when/how to stop/deallocate compute instances. Jupyterlab doesn't have a logout button, but could perhaps have an extension to do this. Then, what should happen when a user logs out? They may want to login again soon and carry on working on the same compute instance, but if we always leave the VMs running, this would be expensive.

nbarlowATI commented 4 years ago

Another minor thing that @pierocor has observed is that after logging out (closing Jupyterlab tab), when logging back in again, the user goes straight back to the running CI, skipping the (new) workspace-select screen, which is not the desired behaviour. Maybe cookie-related?

tam203 commented 4 years ago

Hi @nbarlowATI , we discussed this a little bit to re-iterate.

The behaviour you describe is the default behaviour on Jupyter Hub / Pangeo systems:

So. I think what we have is inline with the expected behaviou of Jupyter hub. Things we should do however to improve the situation:

tam203 commented 4 years ago

@pierocor - in middle of checking stop stat works correctly.

If yes then close.

Add a comment about 'clean up servers'

pierocor commented 4 years ago

Stopping a running named server form/hub/homesends signal SIGTERM to JH:

[D 2020-11-09 13:33:55.070 JupyterHub user:739] Stopping piero coronica:A-small
[I 2020-11-09 13:33:55.160 JupyterHub aml_spawner:289] Stopping the compute instance.
[I 2020-11-09 13:34:00.736 JupyterHub aml_spawner:323] Stopping the redirect server route: ('0.0.0.0', 9001).
WARNING:asyncio:Executing <Task pending name='Task-74' coro=<BaseHandler.stop_single_user.<locals>.stop() running at /home/centos/.conda/envs/azml/lib/python3.8/site-packages/jupyterhub/handlers/base.py:1052> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x7fd83aaaecd0>()] created at /home/centos/.conda/envs/azml/lib/python3.8/asyncio/base_events.py:422> cb=[chain_future.<locals>.copy() at /home/centos/.conda/envs/azml/lib/python3.8/site-packages/tornado/concurrent.py:154, with_timeout.<locals>.<lambda>() at /home/centos/.conda/envs/azml/lib/python3.8/site-packages/tornado/gen.py:614] created at /home/centos/.conda/envs/azml/lib/python3.8/site-packages/jupyterhub/handlers/base.py:1081> took 5.776 seconds
[C 2020-11-09 13:34:00.850 JupyterHub app:2684] Received signal SIGTERM, initiating shutdown...
/home/centos/.conda/envs/azml/lib/python3.8/site-packages/jupyterhub/app.py:2686: DeprecationWarning: Task.all_tasks() is deprecated, use asyncio.all_tasks() instead
  t for t in asyncio.Task.all_tasks() if t is not asyncio.Task.current_task()
/home/centos/.conda/envs/azml/lib/python3.8/site-packages/jupyterhub/app.py:2686: DeprecationWarning: Task.current_task() is deprecated, use asyncio.current_task() instead
  t for t in asyncio.Task.all_tasks() if t is not asyncio.Task.current_task()
tam203 commented 4 years ago

When using named servers (as we are doing). You can 'stop' or 'delete' a compute instance. Currently delete is the same as stop but it would be interesting if we could have delete delete the instance and stop just stop it.

Have rased this in gitter: https://gitter.im/jupyterhub/jupyterhub?at=5fa948b2d5a5a635f2ae36d3