Clarified the use of task IDs

This commit is contained in:
Joel Collins 2019-01-29 14:53:17 +00:00
parent 54106e845f
commit 0aae79a2ad

View file

@ -28,10 +28,10 @@ is idle, running, error, or success), information about the start and end times,
the long-running function. the long-running function.
By using tasks, a function can be started in the background, and it's return value fetched at a later time once it has reported By using tasks, a function can be started in the background, and it's return value fetched at a later time once it has reported
success. success. If a long-running task is started by some client, it should note the ID returned in the task state JSON, and use this to
periodically check on the status of that particular task. API routes have been created to allow checking the state of all tasks
Additionally, API routes have been created to allow checking the state of all tasks, a particular task by ID, removing individual (GET `/task`), a particular task by ID (GET `/task/<task_id>`), removing individual tasks (DELETE `/task/<task_id>`), and pruning
tasks, and pruning the task list of any no-longer-running tasks. the task list of any no-longer-running tasks (DELETE `/task`).
An example of a long running task may look like: An example of a long running task may look like:
@ -55,9 +55,9 @@ After some time, once the task has completed, it could be retreived using:
.. code-block:: python .. code-block:: python
... ...
def get_result(self): def get_result(self):
self.my_task.state['status'] == "success": self.my_task.state['status'] == "success":
return self.my_task.state['return'] return self.my_task.state['return']
Locks Locks
+++++ +++++