Merge pull request #202 from betatim/no-mem-limit-cont

No memory limit (continued)
This commit is contained in:
Min RK
2018-10-15 16:50:59 +02:00
committed by GitHub
3 changed files with 20 additions and 2 deletions

View File

@@ -81,7 +81,8 @@ User Server Limits
* ``limits.memory`` Specifies the maximum memory that can be used by each
individual user. It can be specified as an absolute byte value. You can use
individual user. By default there is no memory limit. The limit can be
specified as an absolute byte value. You can use
the suffixes K, M, G or T to mean Kilobyte, Megabyte, Gigabyte or Terabyte
respectively. Setting it to ``None`` disables memory limits.
@@ -95,6 +96,7 @@ User Server Limits
handedly take down the machine accidentally by OOMing it.
* ``limits.cpu`` A float representing the total CPU-cores each user can use.
By default there is no CPU limit.
1 represents one full CPU, 4 represents 4 full CPUs, 0.5 represents
half of one CPU, etc. This value is ultimately converted to a percentage and
rounded down to the nearest integer percentage,

View File

@@ -59,6 +59,22 @@ def apply_mock_config(overrides):
return c
def test_default_memory_limit():
"""
Test default per user memory limit
"""
c = apply_mock_config({})
assert c.SystemdSpawner.mem_limit is None
def test_set_memory_limit():
"""
Test setting per user memory limit
"""
c = apply_mock_config({'limits': {'memory': '42G'}})
assert c.SystemdSpawner.mem_limit == '42G'
def test_app_default():
"""
Test default application with no config overrides.

View File

@@ -28,7 +28,7 @@ default = {
'admin': [],
},
'limits': {
'memory': '1G',
'memory': None,
'cpu': None,
},
'http': {