mirror of
https://github.com/jupyterhub/the-littlest-jupyterhub.git
synced 2025-12-18 21:54:05 +08:00
Merge pull request #881 from consideRatio/curvenote/main
added `remove_named_servers` setting for jupyterhub-idle-culler
This commit is contained in:
@@ -40,6 +40,12 @@ the users will not be culled alongside their notebooks and will continue to exis
|
|||||||
services.cull.users = False
|
services.cull.users = False
|
||||||
```
|
```
|
||||||
|
|
||||||
|
If named servers are in use, they are not removed after being culled.
|
||||||
|
|
||||||
|
```python
|
||||||
|
services.cull.remove_named_servers = False
|
||||||
|
```
|
||||||
|
|
||||||
## Configuring the idle culler
|
## Configuring the idle culler
|
||||||
|
|
||||||
The available configuration options are:
|
The available configuration options are:
|
||||||
@@ -76,6 +82,16 @@ sudo tljh-config set services.cull.max_age <server-max-age>
|
|||||||
sudo tljh-config reload
|
sudo tljh-config reload
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Remove Named Servers
|
||||||
|
|
||||||
|
Remove named servers after they are shutdown. Only applies if named servers are
|
||||||
|
enabled on the hub installation:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo tljh-config set services.cull.remove_named_servers True
|
||||||
|
sudo tljh-config reload
|
||||||
|
```
|
||||||
|
|
||||||
### User culling
|
### User culling
|
||||||
|
|
||||||
In addition to servers, it is also possible to cull the users. This is usually
|
In addition to servers, it is also possible to cull the users. This is usually
|
||||||
|
|||||||
@@ -220,6 +220,43 @@ def test_set_cull_service():
|
|||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
def test_cull_service_named():
|
||||||
|
"""
|
||||||
|
Test default cull service settings with named server removal
|
||||||
|
"""
|
||||||
|
c = apply_mock_config(
|
||||||
|
{
|
||||||
|
"services": {
|
||||||
|
"cull": {
|
||||||
|
"every": 10,
|
||||||
|
"cull_users": True,
|
||||||
|
"remove_named_servers": True,
|
||||||
|
"max_age": 60,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
cull_cmd = [
|
||||||
|
sys.executable,
|
||||||
|
"-m",
|
||||||
|
"jupyterhub_idle_culler",
|
||||||
|
"--timeout=600",
|
||||||
|
"--cull-every=10",
|
||||||
|
"--concurrency=5",
|
||||||
|
"--max-age=60",
|
||||||
|
"--cull-users",
|
||||||
|
"--remove-named-servers",
|
||||||
|
]
|
||||||
|
assert c.JupyterHub.services == [
|
||||||
|
{
|
||||||
|
"name": "cull-idle",
|
||||||
|
"admin": True,
|
||||||
|
"command": cull_cmd,
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
def test_load_secrets(tljh_dir):
|
def test_load_secrets(tljh_dir):
|
||||||
"""
|
"""
|
||||||
Test loading secret files
|
Test loading secret files
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ default = {
|
|||||||
"concurrency": 5,
|
"concurrency": 5,
|
||||||
"users": False,
|
"users": False,
|
||||||
"max_age": 0,
|
"max_age": 0,
|
||||||
|
"remove_named_servers": False,
|
||||||
},
|
},
|
||||||
"configurator": {"enabled": False},
|
"configurator": {"enabled": False},
|
||||||
},
|
},
|
||||||
@@ -256,6 +257,8 @@ def set_cull_idle_service(config):
|
|||||||
cull_cmd += ["--max-age=%d" % cull_config["max_age"]]
|
cull_cmd += ["--max-age=%d" % cull_config["max_age"]]
|
||||||
if cull_config["users"]:
|
if cull_config["users"]:
|
||||||
cull_cmd += ["--cull-users"]
|
cull_cmd += ["--cull-users"]
|
||||||
|
if cull_config["remove_named_servers"]:
|
||||||
|
cull_cmd += ["--remove-named-servers"]
|
||||||
|
|
||||||
cull_service = {
|
cull_service = {
|
||||||
"name": "cull-idle",
|
"name": "cull-idle",
|
||||||
|
|||||||
Reference in New Issue
Block a user