Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
docker-py
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
docker-py
Commits
67f12bd1
Kaydet (Commit)
67f12bd1
authored
May 02, 2017
tarafından
Joffrey F
Kaydeden (comit)
GitHub
May 02, 2017
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Merge pull request #1583 from delcypher/cpuset_fixes
CPUset* parameter fixes
üst
35b8c0a7
2a0a7ade
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
47 additions
and
4 deletions
+47
-4
container.py
docker/api/container.py
+2
-0
containers.py
docker/models/containers.py
+3
-0
containers.py
docker/types/containers.py
+13
-2
api_container_test.py
tests/unit/api_container_test.py
+28
-1
models_containers_test.py
tests/unit/models_containers_test.py
+1
-1
No files found.
docker/api/container.py
Dosyayı görüntüle @
67f12bd1
...
@@ -479,6 +479,8 @@ class ContainerApiMixin(object):
...
@@ -479,6 +479,8 @@ class ContainerApiMixin(object):
cpu_shares (int): CPU shares (relative weight).
cpu_shares (int): CPU shares (relative weight).
cpuset_cpus (str): CPUs in which to allow execution (``0-3``,
cpuset_cpus (str): CPUs in which to allow execution (``0-3``,
``0,1``).
``0,1``).
cpuset_mems (str): Memory nodes (MEMs) in which to allow execution
(``0-3``, ``0,1``). Only effective on NUMA systems.
device_read_bps: Limit read rate (bytes per second) from a device
device_read_bps: Limit read rate (bytes per second) from a device
in the form of: `[{"Path": "device_path", "Rate": rate}]`
in the form of: `[{"Path": "device_path", "Rate": rate}]`
device_read_iops: Limit read rate (IO per second) from a device.
device_read_iops: Limit read rate (IO per second) from a device.
...
...
docker/models/containers.py
Dosyayı görüntüle @
67f12bd1
...
@@ -483,6 +483,8 @@ class ContainerCollection(Collection):
...
@@ -483,6 +483,8 @@ class ContainerCollection(Collection):
cpu_shares (int): CPU shares (relative weight).
cpu_shares (int): CPU shares (relative weight).
cpuset_cpus (str): CPUs in which to allow execution (``0-3``,
cpuset_cpus (str): CPUs in which to allow execution (``0-3``,
``0,1``).
``0,1``).
cpuset_mems (str): Memory nodes (MEMs) in which to allow execution
(``0-3``, ``0,1``). Only effective on NUMA systems.
detach (bool): Run container in the background and return a
detach (bool): Run container in the background and return a
:py:class:`Container` object.
:py:class:`Container` object.
device_read_bps: Limit read rate (bytes per second) from a device
device_read_bps: Limit read rate (bytes per second) from a device
...
@@ -829,6 +831,7 @@ RUN_HOST_CONFIG_KWARGS = [
...
@@ -829,6 +831,7 @@ RUN_HOST_CONFIG_KWARGS = [
'cpu_quota'
,
'cpu_quota'
,
'cpu_shares'
,
'cpu_shares'
,
'cpuset_cpus'
,
'cpuset_cpus'
,
'cpuset_mems'
,
'device_read_bps'
,
'device_read_bps'
,
'device_read_iops'
,
'device_read_iops'
,
'device_write_bps'
,
'device_write_bps'
,
...
...
docker/types/containers.py
Dosyayı görüntüle @
67f12bd1
...
@@ -119,7 +119,8 @@ class HostConfig(dict):
...
@@ -119,7 +119,8 @@ class HostConfig(dict):
cpuset_cpus
=
None
,
userns_mode
=
None
,
pids_limit
=
None
,
cpuset_cpus
=
None
,
userns_mode
=
None
,
pids_limit
=
None
,
isolation
=
None
,
auto_remove
=
False
,
storage_opt
=
None
,
isolation
=
None
,
auto_remove
=
False
,
storage_opt
=
None
,
init
=
None
,
init_path
=
None
,
volume_driver
=
None
,
init
=
None
,
init_path
=
None
,
volume_driver
=
None
,
cpu_count
=
None
,
cpu_percent
=
None
,
nano_cpus
=
None
):
cpu_count
=
None
,
cpu_percent
=
None
,
nano_cpus
=
None
,
cpuset_mems
=
None
):
if
mem_limit
is
not
None
:
if
mem_limit
is
not
None
:
self
[
'Memory'
]
=
parse_bytes
(
mem_limit
)
self
[
'Memory'
]
=
parse_bytes
(
mem_limit
)
...
@@ -326,7 +327,17 @@ class HostConfig(dict):
...
@@ -326,7 +327,17 @@ class HostConfig(dict):
if
version_lt
(
version
,
'1.18'
):
if
version_lt
(
version
,
'1.18'
):
raise
host_config_version_error
(
'cpuset_cpus'
,
'1.18'
)
raise
host_config_version_error
(
'cpuset_cpus'
,
'1.18'
)
self
[
'CpuSetCpus'
]
=
cpuset_cpus
self
[
'CpusetCpus'
]
=
cpuset_cpus
if
cpuset_mems
:
if
version_lt
(
version
,
'1.19'
):
raise
host_config_version_error
(
'cpuset_mems'
,
'1.19'
)
if
not
isinstance
(
cpuset_mems
,
str
):
raise
host_config_type_error
(
'cpuset_mems'
,
cpuset_mems
,
'str'
)
self
[
'CpusetMems'
]
=
cpuset_mems
if
blkio_weight
:
if
blkio_weight
:
if
not
isinstance
(
blkio_weight
,
int
):
if
not
isinstance
(
blkio_weight
,
int
):
...
...
tests/unit/api_container_test.py
Dosyayı görüntüle @
67f12bd1
...
@@ -332,7 +332,34 @@ class CreateContainerTest(BaseAPIClientTest):
...
@@ -332,7 +332,34 @@ class CreateContainerTest(BaseAPIClientTest):
"StdinOnce": false,
"StdinOnce": false,
"NetworkDisabled": false,
"NetworkDisabled": false,
"HostConfig": {
"HostConfig": {
"CpuSetCpus": "0,1",
"CpusetCpus": "0,1",
"NetworkMode": "default"
}}'''
))
self
.
assertEqual
(
args
[
1
][
'headers'
],
{
'Content-Type'
:
'application/json'
})
@requires_api_version
(
'1.19'
)
def
test_create_container_with_host_config_cpuset_mems
(
self
):
self
.
client
.
create_container
(
'busybox'
,
'ls'
,
host_config
=
self
.
client
.
create_host_config
(
cpuset_mems
=
'0'
)
)
args
=
fake_request
.
call_args
self
.
assertEqual
(
args
[
0
][
1
],
url_prefix
+
'containers/create'
)
self
.
assertEqual
(
json
.
loads
(
args
[
1
][
'data'
]),
json
.
loads
(
'''
{"Tty": false, "Image": "busybox",
"Cmd": ["ls"], "AttachStdin": false,
"AttachStderr": true,
"AttachStdout": true, "OpenStdin": false,
"StdinOnce": false,
"NetworkDisabled": false,
"HostConfig": {
"CpusetMems": "0",
"NetworkMode": "default"
"NetworkMode": "default"
}}'''
))
}}'''
))
self
.
assertEqual
(
args
[
1
][
'headers'
],
self
.
assertEqual
(
args
[
1
][
'headers'
],
...
...
tests/unit/models_containers_test.py
Dosyayı görüntüle @
67f12bd1
...
@@ -135,7 +135,7 @@ class ContainerCollectionTest(unittest.TestCase):
...
@@ -135,7 +135,7 @@ class ContainerCollectionTest(unittest.TestCase):
'CpuPeriod'
:
1
,
'CpuPeriod'
:
1
,
'CpuQuota'
:
2
,
'CpuQuota'
:
2
,
'CpuShares'
:
5
,
'CpuShares'
:
5
,
'Cpu
S
etCpus'
:
'0-3'
,
'Cpu
s
etCpus'
:
'0-3'
,
'Devices'
:
[{
'PathOnHost'
:
'/dev/sda'
,
'Devices'
:
[{
'PathOnHost'
:
'/dev/sda'
,
'CgroupPermissions'
:
'rwm'
,
'CgroupPermissions'
:
'rwm'
,
'PathInContainer'
:
'/dev/xvda'
}],
'PathInContainer'
:
'/dev/xvda'
}],
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment