Unverified Kaydet (Commit) 416ea74e authored tarafından Joffrey F's avatar Joffrey F Kaydeden (comit) GitHub

Merge pull request #2135 from docker/2133-services-docs

Fix docs for Service objects
...@@ -42,7 +42,7 @@ class Service(Model): ...@@ -42,7 +42,7 @@ class Service(Model):
``label``, and ``desired-state``. ``label``, and ``desired-state``.
Returns: Returns:
(:py:class:`list`): List of task dictionaries. :py:class:`list`: List of task dictionaries.
Raises: Raises:
:py:class:`docker.errors.APIError` :py:class:`docker.errors.APIError`
...@@ -84,26 +84,27 @@ class Service(Model): ...@@ -84,26 +84,27 @@ class Service(Model):
def logs(self, **kwargs): def logs(self, **kwargs):
""" """
Get log stream for the service. Get log stream for the service.
Note: This method works only for services with the ``json-file`` Note: This method works only for services with the ``json-file``
or ``journald`` logging drivers. or ``journald`` logging drivers.
Args: Args:
details (bool): Show extra details provided to logs. details (bool): Show extra details provided to logs.
Default: ``False`` Default: ``False``
follow (bool): Keep connection open to read logs as they are follow (bool): Keep connection open to read logs as they are
sent by the Engine. Default: ``False`` sent by the Engine. Default: ``False``
stdout (bool): Return logs from ``stdout``. Default: ``False`` stdout (bool): Return logs from ``stdout``. Default: ``False``
stderr (bool): Return logs from ``stderr``. Default: ``False`` stderr (bool): Return logs from ``stderr``. Default: ``False``
since (int): UNIX timestamp for the logs staring point. since (int): UNIX timestamp for the logs staring point.
Default: 0 Default: 0
timestamps (bool): Add timestamps to every log line. timestamps (bool): Add timestamps to every log line.
tail (string or int): Number of log lines to be returned, tail (string or int): Number of log lines to be returned,
counting from the current end of the logs. Specify an counting from the current end of the logs. Specify an
integer or ``'all'`` to output all log lines. integer or ``'all'`` to output all log lines.
Default: ``all`` Default: ``all``
Returns (generator): Logs for the service. Returns:
generator: Logs for the service.
""" """
is_tty = self.attrs['Spec']['TaskTemplate']['ContainerSpec'].get( is_tty = self.attrs['Spec']['TaskTemplate']['ContainerSpec'].get(
'TTY', False 'TTY', False
...@@ -118,7 +119,7 @@ class Service(Model): ...@@ -118,7 +119,7 @@ class Service(Model):
replicas (int): The number of containers that should be running. replicas (int): The number of containers that should be running.
Returns: Returns:
``True``if successful. bool: ``True`` if successful.
""" """
if 'Global' in self.attrs['Spec']['Mode'].keys(): if 'Global' in self.attrs['Spec']['Mode'].keys():
...@@ -134,7 +135,7 @@ class Service(Model): ...@@ -134,7 +135,7 @@ class Service(Model):
Force update the service even if no changes require it. Force update the service even if no changes require it.
Returns: Returns:
``True``if successful. bool: ``True`` if successful.
""" """
return self.update(force_update=True, fetch_current_spec=True) return self.update(force_update=True, fetch_current_spec=True)
...@@ -206,7 +207,7 @@ class ServiceCollection(Collection): ...@@ -206,7 +207,7 @@ class ServiceCollection(Collection):
containers. containers.
Returns: Returns:
(:py:class:`Service`) The created service. :py:class:`Service`: The created service.
Raises: Raises:
:py:class:`docker.errors.APIError` :py:class:`docker.errors.APIError`
...@@ -228,7 +229,7 @@ class ServiceCollection(Collection): ...@@ -228,7 +229,7 @@ class ServiceCollection(Collection):
into the output. into the output.
Returns: Returns:
(:py:class:`Service`): The service. :py:class:`Service`: The service.
Raises: Raises:
:py:class:`docker.errors.NotFound` :py:class:`docker.errors.NotFound`
...@@ -253,7 +254,7 @@ class ServiceCollection(Collection): ...@@ -253,7 +254,7 @@ class ServiceCollection(Collection):
Default: ``None``. Default: ``None``.
Returns: Returns:
(list of :py:class:`Service`): The services. list of :py:class:`Service`: The services.
Raises: Raises:
:py:class:`docker.errors.APIError` :py:class:`docker.errors.APIError`
......
...@@ -30,7 +30,10 @@ Service objects ...@@ -30,7 +30,10 @@ Service objects
The raw representation of this object from the server. The raw representation of this object from the server.
.. automethod:: force_update
.. automethod:: logs
.. automethod:: reload .. automethod:: reload
.. automethod:: remove .. automethod:: remove
.. automethod:: scale
.. automethod:: tasks .. automethod:: tasks
.. automethod:: update .. automethod:: update
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment