Commit a3be1bb
authored
Job Queue (#106)
Add a queue abstraction for asynchronous processing.
Example usage:
```python
queue = Queue("example_queue")
@dbos.step()
def process_job(job):
...
@DBOS.workflow()
def process_jobs(jobs):
for job in jobs:
queue.enqueue(process_job, job)
```
You can enqueue any DBOS-annotated function (workflows, transactions, or
steps).
`enqueue` returns a [workflow
handle](https://docs.dbos.dev/python/reference/workflow_handles) so you
can track the status of enqueued tasks.
You can set a maximum concurrency level for a queue to cap the maximum
number of tasks from that queue that can be processed at once.
Scheduled workflows and Kafka workflows now use queues, making them more
robust in a distributed setting.1 parent 0db5c43 commit a3be1bb
File tree
16 files changed
+438
-40
lines changed- dbos
- migrations/versions
- scheduler
- schemas
- tests
- scheduler
16 files changed
+438
-40
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| 23 | + | |
22 | 24 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| 66 | + | |
66 | 67 | | |
67 | 68 | | |
68 | 69 | | |
| |||
126 | 127 | | |
127 | 128 | | |
128 | 129 | | |
| 130 | + | |
129 | 131 | | |
130 | 132 | | |
131 | 133 | | |
| |||
134 | 136 | | |
135 | 137 | | |
136 | 138 | | |
137 | | - | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
138 | 144 | | |
139 | 145 | | |
140 | 146 | | |
| |||
150 | 156 | | |
151 | 157 | | |
152 | 158 | | |
| 159 | + | |
153 | 160 | | |
154 | 161 | | |
155 | 162 | | |
156 | 163 | | |
157 | 164 | | |
158 | 165 | | |
159 | | - | |
| 166 | + | |
160 | 167 | | |
161 | 168 | | |
| 169 | + | |
162 | 170 | | |
163 | 171 | | |
164 | 172 | | |
165 | 173 | | |
166 | 174 | | |
167 | 175 | | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
168 | 179 | | |
169 | 180 | | |
170 | 181 | | |
| |||
179 | 190 | | |
180 | 191 | | |
181 | 192 | | |
| 193 | + | |
| 194 | + | |
182 | 195 | | |
183 | 196 | | |
184 | 197 | | |
| |||
191 | 204 | | |
192 | 205 | | |
193 | 206 | | |
| 207 | + | |
| 208 | + | |
194 | 209 | | |
195 | 210 | | |
196 | 211 | | |
| |||
249 | 264 | | |
250 | 265 | | |
251 | 266 | | |
| 267 | + | |
| 268 | + | |
252 | 269 | | |
253 | 270 | | |
254 | 271 | | |
| |||
264 | 281 | | |
265 | 282 | | |
266 | 283 | | |
| 284 | + | |
| 285 | + | |
267 | 286 | | |
268 | 287 | | |
269 | 288 | | |
270 | 289 | | |
271 | 290 | | |
272 | 291 | | |
273 | 292 | | |
274 | | - | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
275 | 299 | | |
276 | 300 | | |
277 | 301 | | |
| |||
331 | 355 | | |
332 | 356 | | |
333 | 357 | | |
| 358 | + | |
| 359 | + | |
334 | 360 | | |
335 | 361 | | |
336 | 362 | | |
| |||
384 | 410 | | |
385 | 411 | | |
386 | 412 | | |
| 413 | + | |
387 | 414 | | |
388 | 415 | | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
389 | 419 | | |
390 | 420 | | |
391 | 421 | | |
| |||
529 | 559 | | |
530 | 560 | | |
531 | 561 | | |
| 562 | + | |
532 | 563 | | |
533 | 564 | | |
534 | 565 | | |
| |||
645 | 676 | | |
646 | 677 | | |
647 | 678 | | |
| 679 | + | |
648 | 680 | | |
649 | 681 | | |
650 | 682 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
24 | 23 | | |
25 | 24 | | |
26 | 25 | | |
| |||
40 | 39 | | |
41 | 40 | | |
42 | 41 | | |
| 42 | + | |
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| |||
138 | 138 | | |
139 | 139 | | |
140 | 140 | | |
| 141 | + | |
141 | 142 | | |
142 | 143 | | |
143 | 144 | | |
| |||
356 | 357 | | |
357 | 358 | | |
358 | 359 | | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
359 | 365 | | |
360 | 366 | | |
361 | 367 | | |
| |||
488 | 494 | | |
489 | 495 | | |
490 | 496 | | |
491 | | - | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
492 | 501 | | |
493 | 502 | | |
494 | 503 | | |
495 | 504 | | |
496 | 505 | | |
497 | | - | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
498 | 509 | | |
499 | 510 | | |
500 | 511 | | |
| |||
508 | 519 | | |
509 | 520 | | |
510 | 521 | | |
511 | | - | |
| 522 | + | |
512 | 523 | | |
513 | 524 | | |
514 | 525 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
3 | | - | |
4 | | - | |
| 2 | + | |
5 | 3 | | |
6 | 4 | | |
7 | | - | |
| 5 | + | |
| 6 | + | |
8 | 7 | | |
9 | 8 | | |
10 | 9 | | |
11 | 10 | | |
12 | 11 | | |
| 12 | + | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
18 | 21 | | |
19 | 22 | | |
20 | 23 | | |
21 | 24 | | |
22 | 25 | | |
23 | 26 | | |
| 27 | + | |
24 | 28 | | |
25 | 29 | | |
26 | 30 | | |
| |||
70 | 74 | | |
71 | 75 | | |
72 | 76 | | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
79 | 83 | | |
80 | 84 | | |
81 | 85 | | |
82 | 86 | | |
83 | 87 | | |
84 | 88 | | |
85 | | - | |
| 89 | + | |
86 | 90 | | |
87 | 91 | | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
88 | 103 | | |
89 | 104 | | |
90 | | - | |
| 105 | + | |
91 | 106 | | |
92 | 107 | | |
93 | 108 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 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 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
0 commit comments