add settings[‘activity_sources’]

for extensions to register activity that should prevent shutdown due to inactivity
This commit is contained in:
Min RK 2018-03-06 21:50:43 +01:00
parent ae1f167dc6
commit f0a96b5ffb

View File

@ -232,7 +232,7 @@ class NotebookWebApplication(web.Application):
},
version_hash=version_hash,
ignore_minified_js=jupyter_app.ignore_minified_js,
# rate limits
iopub_msg_rate_limit=jupyter_app.iopub_msg_rate_limit,
iopub_data_rate_limit=jupyter_app.iopub_data_rate_limit,
@ -242,7 +242,7 @@ class NotebookWebApplication(web.Application):
# tornado defaults are 100 MiB, we increase it to 0.5 GiB
max_body_size = 512 * 1024 * 1024,
max_buffer_size = 512 * 1024 * 1024,
# authentication
cookie_secret=jupyter_app.cookie_secret,
login_url=url_path_join(base_url,'/login'),
@ -264,6 +264,8 @@ class NotebookWebApplication(web.Application):
# Jupyter stuff
started=now,
# place for extensions to register activity
activity_sources={},
jinja_template_vars=jupyter_app.jinja_template_vars,
nbextensions_path=jupyter_app.nbextensions_path,
websocket_url=jupyter_app.websocket_url,
@ -360,6 +362,7 @@ class NotebookWebApplication(web.Application):
sources.append(self.settings['terminal_last_activity'])
except KeyError:
pass
sources.extend(self.settings['activity_sources'].values())
return max(sources)