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
d77d4256
Unverified
Kaydet (Commit)
d77d4256
authored
Ara 11, 2018
tarafından
Joffrey F
Kaydeden (comit)
GitHub
Ara 11, 2018
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Merge pull request #2197 from docker/2185-placement-prefs
Improve handling of placement preferences and associated docs
üst
f39b1df4
b297b837
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
49 additions
and
16 deletions
+49
-16
services.py
docker/models/services.py
+6
-4
__init__.py
docker/types/__init__.py
+3
-2
services.py
docker/types/services.py
+34
-7
api.rst
docs/api.rst
+1
-0
conf.py
docs/conf.py
+5
-3
No files found.
docker/models/services.py
Dosyayı görüntüle @
d77d4256
...
@@ -153,10 +153,12 @@ class ServiceCollection(Collection):
...
@@ -153,10 +153,12 @@ class ServiceCollection(Collection):
image (str): The image name to use for the containers.
image (str): The image name to use for the containers.
command (list of str or str): Command to run.
command (list of str or str): Command to run.
args (list of str): Arguments to the command.
args (list of str): Arguments to the command.
constraints (list of str): Placement constraints.
constraints (list of str): :py:class:`~docker.types.Placement`
preferences (list of str): Placement preferences.
constraints.
platforms (list of tuple): A list of platforms constraints
preferences (list of tuple): :py:class:`~docker.types.Placement`
expressed as ``(arch, os)`` tuples
preferences.
platforms (list of tuple): A list of platform constraints
expressed as ``(arch, os)`` tuples.
container_labels (dict): Labels to apply to the container.
container_labels (dict): Labels to apply to the container.
endpoint_spec (EndpointSpec): Properties that can be configured to
endpoint_spec (EndpointSpec): Properties that can be configured to
access and load balance a service. Default: ``None``.
access and load balance a service. Default: ``None``.
...
...
docker/types/__init__.py
Dosyayı görüntüle @
d77d4256
...
@@ -5,7 +5,8 @@ from .healthcheck import Healthcheck
...
@@ -5,7 +5,8 @@ from .healthcheck import Healthcheck
from
.networks
import
EndpointConfig
,
IPAMConfig
,
IPAMPool
,
NetworkingConfig
from
.networks
import
EndpointConfig
,
IPAMConfig
,
IPAMPool
,
NetworkingConfig
from
.services
import
(
from
.services
import
(
ConfigReference
,
ContainerSpec
,
DNSConfig
,
DriverConfig
,
EndpointSpec
,
ConfigReference
,
ContainerSpec
,
DNSConfig
,
DriverConfig
,
EndpointSpec
,
Mount
,
Placement
,
Privileges
,
Resources
,
RestartPolicy
,
RollbackConfig
,
Mount
,
Placement
,
PlacementPreference
,
Privileges
,
Resources
,
SecretReference
,
ServiceMode
,
TaskTemplate
,
UpdateConfig
RestartPolicy
,
RollbackConfig
,
SecretReference
,
ServiceMode
,
TaskTemplate
,
UpdateConfig
)
)
from
.swarm
import
SwarmSpec
,
SwarmExternalCA
from
.swarm
import
SwarmSpec
,
SwarmExternalCA
docker/types/services.py
Dosyayı görüntüle @
d77d4256
...
@@ -648,18 +648,24 @@ class Placement(dict):
...
@@ -648,18 +648,24 @@ class Placement(dict):
Placement constraints to be used as part of a :py:class:`TaskTemplate`
Placement constraints to be used as part of a :py:class:`TaskTemplate`
Args:
Args:
constraints (:py:class:`list`): A list of constraints
constraints (:py:class:`list` of str): A list of constraints
preferences (:py:class:`list`): Preferences provide a way to make
preferences (:py:class:`list` of tuple): Preferences provide a way
the scheduler aware of factors such as topology. They are
to make the scheduler aware of factors such as topology. They
provided in order from highest to lowest precedence.
are provided in order from highest to lowest precedence and
platforms (:py:class:`list`): A list of platforms expressed as
are expressed as ``(strategy, descriptor)`` tuples. See
``(arch, os)`` tuples
:py:class:`PlacementPreference` for details.
platforms (:py:class:`list` of tuple): A list of platforms
expressed as ``(arch, os)`` tuples
"""
"""
def
__init__
(
self
,
constraints
=
None
,
preferences
=
None
,
platforms
=
None
):
def
__init__
(
self
,
constraints
=
None
,
preferences
=
None
,
platforms
=
None
):
if
constraints
is
not
None
:
if
constraints
is
not
None
:
self
[
'Constraints'
]
=
constraints
self
[
'Constraints'
]
=
constraints
if
preferences
is
not
None
:
if
preferences
is
not
None
:
self
[
'Preferences'
]
=
preferences
self
[
'Preferences'
]
=
[]
for
pref
in
preferences
:
if
isinstance
(
pref
,
tuple
):
pref
=
PlacementPreference
(
*
pref
)
self
[
'Preferences'
]
.
append
(
pref
)
if
platforms
:
if
platforms
:
self
[
'Platforms'
]
=
[]
self
[
'Platforms'
]
=
[]
for
plat
in
platforms
:
for
plat
in
platforms
:
...
@@ -668,6 +674,27 @@ class Placement(dict):
...
@@ -668,6 +674,27 @@ class Placement(dict):
})
})
class
PlacementPreference
(
dict
):
"""
Placement preference to be used as an element in the list of
preferences for :py:class:`Placement` objects.
Args:
strategy (string): The placement strategy to implement. Currently,
the only supported strategy is ``spread``.
descriptor (string): A label descriptor. For the spread strategy,
the scheduler will try to spread tasks evenly over groups of
nodes identified by this label.
"""
def
__init__
(
self
,
strategy
,
descriptor
):
if
strategy
!=
'spread'
:
raise
errors
.
InvalidArgument
(
'PlacementPreference strategy value is invalid ({}):'
' must be "spread".'
.
format
(
strategy
)
)
self
[
'SpreadOver'
]
=
descriptor
class
DNSConfig
(
dict
):
class
DNSConfig
(
dict
):
"""
"""
Specification for DNS related configurations in resolver configuration
Specification for DNS related configurations in resolver configuration
...
...
docs/api.rst
Dosyayı görüntüle @
d77d4256
...
@@ -143,6 +143,7 @@ Configuration types
...
@@ -143,6 +143,7 @@ Configuration types
.. autoclass:: LogConfig
.. autoclass:: LogConfig
.. autoclass:: Mount
.. autoclass:: Mount
.. autoclass:: Placement
.. autoclass:: Placement
.. autoclass:: PlacementPreference
.. autoclass:: Privileges
.. autoclass:: Privileges
.. autoclass:: Resources
.. autoclass:: Resources
.. autoclass:: RestartPolicy
.. autoclass:: RestartPolicy
...
...
docs/conf.py
Dosyayı görüntüle @
d77d4256
...
@@ -69,10 +69,12 @@ author = u'Docker Inc'
...
@@ -69,10 +69,12 @@ author = u'Docker Inc'
# |version| and |release|, also used in various other places throughout the
# |version| and |release|, also used in various other places throughout the
# built documents.
# built documents.
#
#
# The short X.Y version.
with
open
(
'../docker/version.py'
,
'r'
)
as
vfile
:
version
=
u'2.0'
exec
(
vfile
.
read
())
# The full version, including alpha/beta/rc tags.
# The full version, including alpha/beta/rc tags.
release
=
u'2.0'
release
=
version
# The short X.Y version.
version
=
'{}.{}'
.
format
(
version_info
[
0
],
version_info
[
1
])
# The language for content autogenerated by Sphinx. Refer to documentation
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
# for a list of supported languages.
...
...
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