mirror of https://github.com/docker/compose.git
Add support for cpu_rt_period and cpu_rt_runtime.
Signed-off-by: Matthieu Nottale <matthieu.nottale@docker.com>
This commit is contained in:
parent
060d193168
commit
16ea49ac8c
|
@ -69,6 +69,8 @@ DOCKER_CONFIG_KEYS = [
|
|||
'cpu_percent',
|
||||
'cpu_period',
|
||||
'cpu_quota',
|
||||
'cpu_rt_period',
|
||||
'cpu_rt_runtime',
|
||||
'cpu_shares',
|
||||
'cpus',
|
||||
'cpuset',
|
||||
|
|
|
@ -111,6 +111,8 @@
|
|||
"cpu_shares": {"type": ["number", "string"]},
|
||||
"cpu_quota": {"type": ["number", "string"]},
|
||||
"cpu_period": {"type": ["number", "string"]},
|
||||
"cpu_rt_period": {"type": ["number", "string"]},
|
||||
"cpu_rt_runtime": {"type": ["number", "string"]},
|
||||
"cpus": {"type": "number", "minimum": 0},
|
||||
"cpuset": {"type": "string"},
|
||||
"depends_on": {
|
||||
|
|
|
@ -114,6 +114,8 @@
|
|||
"cpu_shares": {"type": ["number", "string"]},
|
||||
"cpu_quota": {"type": ["number", "string"]},
|
||||
"cpu_period": {"type": ["number", "string"]},
|
||||
"cpu_rt_period": {"type": ["number", "string"]},
|
||||
"cpu_rt_runtime": {"type": ["number", "string"]},
|
||||
"cpus": {"type": "number", "minimum": 0},
|
||||
"cpuset": {"type": "string"},
|
||||
"depends_on": {
|
||||
|
|
|
@ -239,6 +239,8 @@ class ConversionMap(object):
|
|||
service_path('cpu_count'): to_int,
|
||||
service_path('cpu_quota'): to_microseconds,
|
||||
service_path('cpu_period'): to_microseconds,
|
||||
service_path('cpu_rt_period'): to_microseconds,
|
||||
service_path('cpu_rt_runtime'): to_microseconds,
|
||||
service_path('configs', 'mode'): to_int,
|
||||
service_path('secrets', 'mode'): to_int,
|
||||
service_path('healthcheck', 'retries'): to_int,
|
||||
|
|
|
@ -64,6 +64,8 @@ HOST_CONFIG_KEYS = [
|
|||
'cpu_percent',
|
||||
'cpu_period',
|
||||
'cpu_quota',
|
||||
'cpu_rt_period',
|
||||
'cpu_rt_runtime',
|
||||
'cpu_shares',
|
||||
'cpus',
|
||||
'cpuset',
|
||||
|
@ -949,6 +951,8 @@ class Service(object):
|
|||
mounts=options.get('mounts'),
|
||||
device_cgroup_rules=options.get('device_cgroup_rules'),
|
||||
cpu_period=options.get('cpu_period'),
|
||||
cpu_rt_period=options.get('cpu_rt_period'),
|
||||
cpu_rt_runtime=options.get('cpu_rt_runtime'),
|
||||
)
|
||||
|
||||
def get_secret_volumes(self):
|
||||
|
|
|
@ -128,6 +128,14 @@ class ServiceTest(DockerClientTestCase):
|
|||
assert container.get('HostConfig.CpuQuota') == 40000
|
||||
assert container.get('HostConfig.CpuPeriod') == 150000
|
||||
|
||||
@pytest.mark.xfail(raises=OperationFailedError, reason='not supported by kernel')
|
||||
def test_create_container_with_cpu_rt(self):
|
||||
service = self.create_service('db', cpu_rt_runtime=40000, cpu_rt_period=150000)
|
||||
container = service.create_container()
|
||||
container.start()
|
||||
assert container.get('HostConfig.CpuRealtimeRuntime') == 40000
|
||||
assert container.get('HostConfig.CpuRealtimePeriod') == 150000
|
||||
|
||||
@v2_2_only()
|
||||
def test_create_container_with_cpu_count(self):
|
||||
self.require_api_version('1.25')
|
||||
|
|
Loading…
Reference in New Issue