-
Notifications
You must be signed in to change notification settings - Fork 7
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 optional-components/jupyterhub-stop-idle
#389
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -187,4 +187,5 @@ blocked_users = {'authtest', '${CATALOG_USERNAME}', 'anonymous'} | |
c.Authenticator.blacklist = blocked_users # v0.9+ | ||
c.Authenticator.blocked_users = blocked_users # v1.2+ | ||
|
||
${JUPYTERHUB_CONFIG_EXTENDED} # noqa | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not re-use the existing If you want to keep both, please leave 2 lines between the 2 variables so that when both are actually in use, they do not look mixed up. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I tried doing that, but given that some instances already use Because of how |
||
${JUPYTERHUB_CONFIG_OVERRIDE} # noqa |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
#!/bin/sh | ||
|
||
# All env in this default.env can be overridden by env.local. | ||
|
||
# All env in this default.env must NOT depend on any other env. If they do, they | ||
# must use single quotes to avoid early expansion before overrides in env.local | ||
# are applied and must be added to the list of DELAYED_EVAL. | ||
|
||
# idle timeout of a user jupyterhub server to be shut down automatically (default: 1 day) | ||
export JUPYTERHUB_STOP_IDLE_TIMEOUT=${JUPYTERHUB_STOP_IDLE_TIMEOUT:-86400} | ||
|
||
# maximum age before stoping user servers (includiung active/running ones, regardless of last activity status) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this maximum age in seconds? Pleas specify the unit of time. |
||
# if not specified, this will not be defined by the utility | ||
# (i.e.: users that provide activity status before timeout could run their server indefinitely) | ||
export JUPYTERHUB_STOP_IDLE_MAX_AGE= | ||
|
||
# for details about the configuration, see https://github.com/jupyterhub/jupyterhub-idle-culler | ||
# WARNING: be careful about indents here, Python code execution depends on it | ||
export JUPYTERHUB_STOP_IDLE_CONFIG=" | ||
import sys | ||
|
||
jupyterhub_stop_idle_timeout = ${JUPYTERHUB_STOP_IDLE_TIMEOUT} | ||
c.JupyterHub.load_roles = [ | ||
{ | ||
'name': 'jupyterhub-idle-culler-role', | ||
'scopes': [ | ||
'list:users', | ||
'read:users:activity', | ||
'read:servers', | ||
'delete:servers', | ||
], | ||
'services': ['jupyterhub-idle-culler-service'], | ||
} | ||
] | ||
jupyterhub_stop_idle_max_age = ${JUPYTERHUB_STOP_IDLE_MAX_AGE:-None} | ||
jupyterhub_idle_culler_xargs = [] | ||
if jupyterhub_stop_idle_max_age: | ||
jupyterhub_idle_culler_xargs = ['--max-age', jupyterhub_stop_idle_max_age] | ||
c.JupyterHub.services = [ | ||
{ | ||
'name': 'jupyterhub-idle-culler-service', | ||
'command': [ | ||
sys.executable, | ||
'-m', 'jupyterhub_idle_culler', | ||
'--timeout', jupyterhub_stop_idle_timeout, | ||
] + jupyterhub_idle_culler_xargs, | ||
} | ||
] | ||
# we need to ensure that the activity update interval is lower than the stop-idle timeout | ||
# otherwise, the updated information will not be available for the utility to do its job | ||
# however, jupyter has by default 5min intervals, which is usually much lower than 'JUPYTERHUB_STOP_IDLE_TIMEOUT' | ||
c.JupyterHub.last_activity_interval = int(min(jupyterhub_stop_idle_timeout / 2, 300)) | ||
" | ||
|
||
export JUPYTERHUB_CONFIG_EXTENDED=" | ||
${JUPYTERHUB_CONFIG_EXTENDED} | ||
${JUPYTERHUB_STOP_IDLE_CONFIG} | ||
" | ||
|
||
#export DELAYED_EVAL=" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove commented code please |
||
# $DELAYED_EVAL | ||
# JUPYTERHUB_CONFIG_EXTENDED | ||
#" | ||
|
||
OPTIONAL_VARS=" | ||
$OPTIONAL_VARS | ||
\$JUPYTERHUB_STOP_IDLE_TIMEOUT | ||
\$JUPYTERHUB_STOP_IDLE_MAX_AGE | ||
" | ||
|
||
# add any component that this component requires to run | ||
COMPONENT_DEPENDENCIES=" | ||
./config/jupyterhub | ||
" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you mean by "include it back"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doing something in the form: