mirror of https://github.com/docker/compose.git
Implement review suggestions.
Signed-off-by: Alexey Rokhin <arokhin@mail.ru>
This commit is contained in:
parent
bffdb7a349
commit
b7c688cc37
|
@ -78,7 +78,7 @@
|
||||||
"cpu_percent": {"type": "integer", "minimum": 0, "maximum": 100},
|
"cpu_percent": {"type": "integer", "minimum": 0, "maximum": 100},
|
||||||
"cpu_shares": {"type": ["number", "string"]},
|
"cpu_shares": {"type": ["number", "string"]},
|
||||||
"cpu_quota": {"type": ["number", "string"]},
|
"cpu_quota": {"type": ["number", "string"]},
|
||||||
"cpus": {"type": ["number", "string"], "minimum": 0},
|
"cpus": {"type": "number", "minimum": 0},
|
||||||
"cpuset": {"type": "string"},
|
"cpuset": {"type": "string"},
|
||||||
"depends_on": {
|
"depends_on": {
|
||||||
"oneOf": [
|
"oneOf": [
|
||||||
|
|
|
@ -803,7 +803,10 @@ class Service(object):
|
||||||
|
|
||||||
nano_cpus = None
|
nano_cpus = None
|
||||||
if 'cpus' in options:
|
if 'cpus' in options:
|
||||||
nano_cpus = int(options.get('cpus') * 1000000000)
|
nano_cpus = options.get('cpus') * 1000000000
|
||||||
|
if isinstance(nano_cpus, float) and not nano_cpus.is_integer():
|
||||||
|
raise ValueError("cpus is too precise")
|
||||||
|
nano_cpus = int(nano_cpus)
|
||||||
|
|
||||||
return self.client.create_host_config(
|
return self.client.create_host_config(
|
||||||
links=self._get_links(link_to_self=one_off),
|
links=self._get_links(link_to_self=one_off),
|
||||||
|
|
Loading…
Reference in New Issue