Improve docstring for Task.close and Task.mark_completed

This commit is contained in:
Richard Leibrandt 2023-02-21 15:21:56 +01:00
commit aa69f45d3b
2 changed files with 10 additions and 8 deletions

View File

@ -680,12 +680,14 @@ class Task(IdObjectBase, AccessMixin, SetupUploadMixin):
This is in contrast to :meth:`Task.close`, which does the first two steps, but does not terminate the running Python process.
For example, in
```
task.mark_completed()
from time import sleep
sleep(30)
print('This text will not be printed!')
```
.. code-block:: py
task.mark_completed()
from time import sleep
sleep(30)
print('This text will not be printed!')
the text will not be printed, because the Python process is immediately terminated.
:param bool ignore_errors: If True default), ignore any errors raised

View File

@ -1725,10 +1725,10 @@ class Task(_Task):
def close(self):
"""
Closes the current Task and changes its status to "Completed".
Enables you to manually shutdown the task.
Enables you to manually shut down the task.
This method does not terminate the current Python process, in contrast to :meth:`Task.mark_completed`.
After having :meth:`Task.close`d a task, the respective object cannot be used anymore and
After having :meth:`Task.close` -d a task, the respective object cannot be used anymore and
methods like :meth:`Task.connect` or :meth:`Task.connect_configuration` will throw a `ValueError`.
In order to obtain an object representing the task again, use methods like :meth:`Task.get_task`.