models
CustomGenericRelation
Bases: GenericRelation
Source code in tasks/models.py
181 182 183 |
|
bulk_related_objects(objs, using='default')
Source code in tasks/models.py
182 183 |
|
ModelAsyncResult
Bases: AsyncResult
Source code in tasks/models.py
106 107 108 109 |
|
forget()
Source code in tasks/models.py
107 108 109 |
|
Task
Bases: TimeStampMixin
Source code in tasks/models.py
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
|
STATES = ((TaskState.PENDING, 'PENDING'), (TaskState.STARTED, 'STARTED'), (TaskState.RETRY, 'RETRY'), (TaskState.FAILURE, 'FAILURE'), (TaskState.SUCCESS, 'SUCCESS'))
class-attribute
content_object = GenericForeignKey()
class-attribute
content_type = models.ForeignKey(ContentType, null=True, on_delete=models.SET_NULL)
class-attribute
creator = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.SET_NULL, null=True)
class-attribute
The user who started the task.
name = models.CharField(max_length=255)
class-attribute
object_id = models.UUIDField(null=True)
class-attribute
objects = TaskManager()
class-attribute
state = models.CharField(choices=STATES, default=TaskState.PENDING, max_length=255)
class-attribute
task_id = models.UUIDField(primary_key=True)
class-attribute
__str__()
Source code in tasks/models.py
86 87 |
|
can_view(user)
Source code in tasks/models.py
100 101 102 103 |
|
delete(using=None, keep_parents=False)
Source code in tasks/models.py
97 98 |
|
result()
property
Source code in tasks/models.py
89 90 91 |
|
short_id()
property
Source code in tasks/models.py
93 94 95 |
|
TaskFilterMixin
Bases: object
Source code in tasks/models.py
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
|
objects: models.Manager()
class-attribute
failed()
Source code in tasks/models.py
39 40 |
|
pending()
Source code in tasks/models.py
30 31 |
|
ready()
Source code in tasks/models.py
50 51 52 |
|
retrying()
Source code in tasks/models.py
36 37 |
|
running()
Source code in tasks/models.py
45 46 47 48 |
|
started()
Source code in tasks/models.py
33 34 |
|
successful()
Source code in tasks/models.py
42 43 |
|
TaskManager
Bases: TaskFilterMixin
, models.Manager
Source code in tasks/models.py
59 60 61 62 63 |
|
use_for_related_fields = True
class-attribute
get_queryset()
Source code in tasks/models.py
62 63 |
|
TaskMetaFilterMixin
Bases: object
Source code in tasks/models.py
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 |
|
objects: models.Manager()
class-attribute
with_failed_tasks()
Source code in tasks/models.py
127 128 |
|
with_pending_tasks()
Source code in tasks/models.py
118 119 |
|
with_ready_tasks()
Source code in tasks/models.py
138 139 140 |
|
with_retrying_tasks()
Source code in tasks/models.py
124 125 |
|
with_running_tasks()
Source code in tasks/models.py
133 134 135 136 |
|
with_started_tasks()
Source code in tasks/models.py
121 122 |
|
with_successful_tasks()
Source code in tasks/models.py
130 131 |
|
with_tasks()
Source code in tasks/models.py
115 116 |
|
without_failed_tasks()
Source code in tasks/models.py
154 155 |
|
without_pending_tasks()
Source code in tasks/models.py
145 146 |
|
without_ready_tasks()
Source code in tasks/models.py
165 166 167 |
|
without_retrying_tasks()
Source code in tasks/models.py
151 152 |
|
without_running_tasks()
Source code in tasks/models.py
160 161 162 163 |
|
without_started_tasks()
Source code in tasks/models.py
148 149 |
|
without_successful_tasks()
Source code in tasks/models.py
157 158 |
|
without_tasks()
Source code in tasks/models.py
142 143 |
|
TaskMetaManager
Bases: TaskMetaFilterMixin
, models.Manager
Source code in tasks/models.py
174 175 176 177 178 |
|
use_for_related_fields = True
class-attribute
get_queryset()
Source code in tasks/models.py
177 178 |
|
TaskMetaQuerySet
Bases: TaskMetaFilterMixin
, QuerySet
Source code in tasks/models.py
170 171 |
|
TaskMixin
Bases: models.Model
Source code in tasks/models.py
187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 |
|
objects = TaskMetaManager()
class-attribute
tasks = CustomGenericRelation(Task)
class-attribute
Meta
Source code in tasks/models.py
192 193 |
|
abstract = True
class-attribute
apply_async(task_fn, *args, name=None, creator=None, **kwargs)
Source code in tasks/models.py
203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 |
|
clear_task_result(task_id)
Source code in tasks/models.py
235 236 237 |
|
clear_task_results()
Source code in tasks/models.py
231 232 233 |
|
get_task_result(task_id)
Source code in tasks/models.py
228 229 |
|
get_task_results()
Source code in tasks/models.py
225 226 |
|
has_ready_task()
property
Source code in tasks/models.py
199 200 201 |
|
has_running_task()
property
Source code in tasks/models.py
195 196 197 |
|
TaskQuerySet
Bases: TaskFilterMixin
, QuerySet
Source code in tasks/models.py
55 56 |
|
TaskState
Bases: object
Source code in tasks/models.py
15 16 17 18 19 20 21 22 23 24 |
|
FAILURE = 'FAILURE'
class-attribute
PENDING = 'PENDING'
class-attribute
RETRY = 'RETRY'
class-attribute
STARTED = 'STARTED'
class-attribute
SUCCESS = 'SUCCESS'
class-attribute
lookup(state)
classmethod
Source code in tasks/models.py
22 23 24 |
|
forget_if_ready(async_result)
Source code in tasks/models.py
240 241 242 |
|