You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+5-5
Original file line number
Diff line number
Diff line change
@@ -159,7 +159,7 @@ Finally, you can run the `db_worker` command to run tasks as they're created. Ch
159
159
160
160
### Pruning old tasks
161
161
162
-
After a while, tasks may start to build up in your database. This can be managed using the `prune_db_task_results` management command, which deletes completed and failed tasks according to the given retention policy. Check the `--help` for the available options.
162
+
After a while, tasks may start to build up in your database. This can be managed using the `prune_db_task_results` management command, which deletes completed tasks according to the given retention policy. Check the `--help` for the available options.
If your task returns something, it can be retrieved from the `.return_value` attribute on a `TaskResult`. Accessing this property on an unfinished task (ie not `COMPLETE` or `FAILED`) will raise a `ValueError`.
187
+
If your task returns something, it can be retrieved from the `.return_value` attribute on a `TaskResult`. Accessing this property on an unfinished task (ie not `SUCCEEDED` or `FAILED`) will raise a `ValueError`.
188
188
189
189
```python
190
-
assert result.status == ResultStatus.COMPLETE
190
+
assert result.status == ResultStatus.SUCCEEDED
191
191
assert result.return_value ==42
192
192
```
193
193
@@ -196,7 +196,7 @@ If a result has been updated in the background, you can call `refresh` on it to
196
196
```python
197
197
assert result.status == ResultStatus.NEW
198
198
result.refresh()
199
-
assert result.status == ResultStatus.COMPLETE
199
+
assert result.status == ResultStatus.SUCCEEDED
200
200
```
201
201
202
202
#### Exceptions
@@ -240,7 +240,7 @@ A few [Signals](https://docs.djangoproject.com/en/stable/topics/signals/) are pr
240
240
Whilst signals are available, they may not be the most maintainable approach.
241
241
242
242
-`django_tasks.signals.task_enqueued`: Called when a task is enqueued. The sender is the backend class. Also called with the enqueued `task_result`.
243
-
-`django_tasks.signals.task_finished`: Called when a task finishes (`COMPLETE` or `FAILED`). The sender is the backend class. Also called with the finished `task_result`.
243
+
-`django_tasks.signals.task_finished`: Called when a task finishes (`SUCCEEDED` or `FAILED`). The sender is the backend class. Also called with the finished `task_result`.
0 commit comments