Skip to content

Commit 2b10c37

Browse files
committed
Fix docs for Service objects
Signed-off-by: Joffrey F <[email protected]>
1 parent 87352cd commit 2b10c37

File tree

2 files changed

+30
-26
lines changed

2 files changed

+30
-26
lines changed

docker/models/services.py

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def tasks(self, filters=None):
4242
``label``, and ``desired-state``.
4343
4444
Returns:
45-
(:py:class:`list`): List of task dictionaries.
45+
:py:class:`list`: List of task dictionaries.
4646
4747
Raises:
4848
:py:class:`docker.errors.APIError`
@@ -84,26 +84,27 @@ def update(self, **kwargs):
8484

8585
def logs(self, **kwargs):
8686
"""
87-
Get log stream for the service.
88-
Note: This method works only for services with the ``json-file``
89-
or ``journald`` logging drivers.
90-
91-
Args:
92-
details (bool): Show extra details provided to logs.
93-
Default: ``False``
94-
follow (bool): Keep connection open to read logs as they are
95-
sent by the Engine. Default: ``False``
96-
stdout (bool): Return logs from ``stdout``. Default: ``False``
97-
stderr (bool): Return logs from ``stderr``. Default: ``False``
98-
since (int): UNIX timestamp for the logs staring point.
99-
Default: 0
100-
timestamps (bool): Add timestamps to every log line.
101-
tail (string or int): Number of log lines to be returned,
102-
counting from the current end of the logs. Specify an
103-
integer or ``'all'`` to output all log lines.
104-
Default: ``all``
105-
106-
Returns (generator): Logs for the service.
87+
Get log stream for the service.
88+
Note: This method works only for services with the ``json-file``
89+
or ``journald`` logging drivers.
90+
91+
Args:
92+
details (bool): Show extra details provided to logs.
93+
Default: ``False``
94+
follow (bool): Keep connection open to read logs as they are
95+
sent by the Engine. Default: ``False``
96+
stdout (bool): Return logs from ``stdout``. Default: ``False``
97+
stderr (bool): Return logs from ``stderr``. Default: ``False``
98+
since (int): UNIX timestamp for the logs staring point.
99+
Default: 0
100+
timestamps (bool): Add timestamps to every log line.
101+
tail (string or int): Number of log lines to be returned,
102+
counting from the current end of the logs. Specify an
103+
integer or ``'all'`` to output all log lines.
104+
Default: ``all``
105+
106+
Returns:
107+
generator: Logs for the service.
107108
"""
108109
is_tty = self.attrs['Spec']['TaskTemplate']['ContainerSpec'].get(
109110
'TTY', False
@@ -118,7 +119,7 @@ def scale(self, replicas):
118119
replicas (int): The number of containers that should be running.
119120
120121
Returns:
121-
``True``if successful.
122+
bool: ``True`` if successful.
122123
"""
123124

124125
if 'Global' in self.attrs['Spec']['Mode'].keys():
@@ -134,7 +135,7 @@ def force_update(self):
134135
Force update the service even if no changes require it.
135136
136137
Returns:
137-
``True``if successful.
138+
bool: ``True`` if successful.
138139
"""
139140

140141
return self.update(force_update=True, fetch_current_spec=True)
@@ -206,7 +207,7 @@ def create(self, image, command=None, **kwargs):
206207
containers.
207208
208209
Returns:
209-
(:py:class:`Service`) The created service.
210+
:py:class:`Service`: The created service.
210211
211212
Raises:
212213
:py:class:`docker.errors.APIError`
@@ -228,7 +229,7 @@ def get(self, service_id, insert_defaults=None):
228229
into the output.
229230
230231
Returns:
231-
(:py:class:`Service`): The service.
232+
:py:class:`Service`: The service.
232233
233234
Raises:
234235
:py:class:`docker.errors.NotFound`
@@ -253,7 +254,7 @@ def list(self, **kwargs):
253254
Default: ``None``.
254255
255256
Returns:
256-
(list of :py:class:`Service`): The services.
257+
list of :py:class:`Service`: The services.
257258
258259
Raises:
259260
:py:class:`docker.errors.APIError`

docs/services.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@ Service objects
3030
The raw representation of this object from the server.
3131

3232

33+
.. automethod:: force_update
34+
.. automethod:: logs
3335
.. automethod:: reload
3436
.. automethod:: remove
37+
.. automethod:: scale
3538
.. automethod:: tasks
3639
.. automethod:: update

0 commit comments

Comments
 (0)