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`.
185
+
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`.
186
186
187
187
```python
188
-
assert result.status == ResultStatus.COMPLETE
188
+
assert result.status == ResultStatus.SUCCEEDED
189
189
assert result.return_value ==42
190
190
```
191
191
@@ -194,7 +194,7 @@ If a result has been updated in the background, you can call `refresh` on it to
194
194
```python
195
195
assert result.status == ResultStatus.NEW
196
196
result.refresh()
197
-
assert result.status == ResultStatus.COMPLETE
197
+
assert result.status == ResultStatus.SUCCEEDED
198
198
```
199
199
200
200
#### Exceptions
@@ -238,7 +238,7 @@ A few [Signals](https://docs.djangoproject.com/en/stable/topics/signals/) are pr
238
238
Whilst signals are available, they may not be the most maintainable approach.
239
239
240
240
-`django_tasks.signals.task_enqueued`: Called when a task is enqueued. The sender is the backend class. Also called with the enqueued `task_result`.
241
-
-`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`.
241
+
-`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