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

Add kernel culling and server shutdown timeouts #34

Merged
merged 1 commit into from
Jun 21, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions tljh-voila-gallery/tljh_voila_gallery/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,11 @@ def options_form(spawner):
return jinja2.Template(f.read()).render(examples=gallery['examples'])

class GallerySpawner(DockerSpawner):
# FIXME: What to do about idle culling?!
cmd = 'jupyter-notebook'

# rm containers when they stop
remove = True
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 not picked up when the server is shut down (still shows in docker ps -a).

Probably because it is used only when its stop method is called, not when the notebook server (pid 1) stops.


events = False

def get_args(self):
Expand All @@ -45,7 +47,12 @@ def get_args(self):
'--port=%i' % self.port,
'--NotebookApp.base_url=%s' % self.server.base_url,
'--NotebookApp.token=%s' % self.user_options['token'],
'--NotebookApp.trust_xheaders=True',
'--NotebookApp.tornado_settings.trust_xheaders=True',
# stop idle servers
'--NotebookApp.shutdown_no_activity_timeout=600',
'--MappingKernelManager.cull_idle_timeout=600',
'--MappingKernelManager.cull_interval=60',
'--MappingKernelManager.cull_connected=True',
]
return args + self.args

Expand Down Expand Up @@ -75,9 +82,6 @@ def tljh_custom_jupyterhub_config(c):
# Don't kill servers when hub restarts
c.JupyterHub.cleanup_servers = False

# rm containers when they stop
c.DockerSpawner.remove = True

c.JupyterHub.services = [{
'name': 'gallery',
'admin': True,
Expand Down