Commit 8774f28
Swap Dag Parsing to use the TaskSDK machinery. (#44972)
As part of Airflow 3 DAG definition files will have to use the Task SDK for
all their classes, and anything involving running user code will need to be
de-coupled from the database in the user-code process.
This change moves all of the "serialization" change up to the
DagFileProcessorManager, using the new function introduced in #44898 and the
"subprocess" machinery introduced in #44874.
**Important Note**: this change does not remove the ability for dag processes
to access the DB for Variables etc. That will come in a future change.
Some key parts of this change:
- It builds upon the WatchedSubprocess from the TaskSDK. Right now this puts a
nasty/unwanted depenednecy between the Dag Parsing code upon the TaskSDK.
This will be addressed before release (we have talked about introducing a
new "apache-airflow-base-executor" dist where this subprocess+supervisor
could live, as the "execution_time" folder in the Task SDK is more a feature
of the executor, not of the TaskSDK itself.)
- A number of classes that we need to send between processes have been
converted to Pydantic for ease of serialization.
- In order to not have to serialize everything in the subprocess and deserialize everything
in the parent Manager process, we have created a `LazyDeserializedDAG` class
that provides lazy access to much of the properties needed to create update
the DAG related DB objects, without needing to fully deserialize the entire
DAG structure.
- Classes switched to attrs based for less boilerplate in constructors.
- Internal timers convert to `time.monotonic` where possible, and `time.time`
where not, we only need second diff between two points, not datetime
objects.
- With the earlier removal of "sync mode" for SQLite in #44839 the need for
separate TERMINATE and END messages over the control socket can go.
---------
Co-authored-by: Jed Cunningham <[email protected]>
Co-authored-by: Daniel Imberman <[email protected]>1 parent cb40ffb commit 8774f28
25 files changed
Lines changed: 1131 additions & 2086 deletions
File tree
- airflow
- callbacks
- cli/commands/local_commands
- dag_processing
- jobs
- models
- serialization
- triggers
- task_sdk/src/airflow/sdk
- execution_time
- tests
- callbacks
- dag_processing
- executors
- jobs
- listeners
- models
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
20 | 19 | | |
21 | 20 | | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
22 | 24 | | |
23 | 25 | | |
24 | 26 | | |
25 | | - | |
| 27 | + | |
26 | 28 | | |
27 | 29 | | |
28 | | - | |
| 30 | + | |
29 | 31 | | |
30 | 32 | | |
31 | 33 | | |
32 | | - | |
33 | 34 | | |
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
57 | 44 | | |
58 | 45 | | |
59 | | - | |
60 | | - | |
61 | | - | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
62 | 51 | | |
63 | 52 | | |
64 | 53 | | |
| |||
67 | 56 | | |
68 | 57 | | |
69 | 58 | | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | 59 | | |
77 | 60 | | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
89 | 65 | | |
90 | 66 | | |
91 | 67 | | |
| |||
98 | 74 | | |
99 | 75 | | |
100 | 76 | | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | 77 | | |
115 | 78 | | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
| 79 | + | |
126 | 80 | | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
Lines changed: 1 addition & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
23 | 22 | | |
24 | 23 | | |
25 | 24 | | |
| |||
36 | 35 | | |
37 | 36 | | |
38 | 37 | | |
39 | | - | |
40 | 38 | | |
41 | 39 | | |
42 | 40 | | |
43 | | - | |
| 41 | + | |
44 | 42 | | |
45 | 43 | | |
46 | 44 | | |
| |||
54 | 52 | | |
55 | 53 | | |
56 | 54 | | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | 55 | | |
62 | 56 | | |
63 | 57 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
31 | 30 | | |
32 | 31 | | |
33 | 32 | | |
| |||
64 | 63 | | |
65 | 64 | | |
66 | 65 | | |
| 66 | + | |
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
72 | | - | |
| 72 | + | |
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
| |||
124 | 124 | | |
125 | 125 | | |
126 | 126 | | |
127 | | - | |
| 127 | + | |
128 | 128 | | |
129 | 129 | | |
130 | 130 | | |
| |||
169 | 169 | | |
170 | 170 | | |
171 | 171 | | |
172 | | - | |
| 172 | + | |
173 | 173 | | |
174 | 174 | | |
175 | 175 | | |
| |||
192 | 192 | | |
193 | 193 | | |
194 | 194 | | |
195 | | - | |
| 195 | + | |
196 | 196 | | |
197 | 197 | | |
198 | 198 | | |
| |||
202 | 202 | | |
203 | 203 | | |
204 | 204 | | |
205 | | - | |
| 205 | + | |
206 | 206 | | |
207 | 207 | | |
208 | 208 | | |
| |||
270 | 270 | | |
271 | 271 | | |
272 | 272 | | |
273 | | - | |
| 273 | + | |
274 | 274 | | |
275 | 275 | | |
276 | 276 | | |
| |||
347 | 347 | | |
348 | 348 | | |
349 | 349 | | |
350 | | - | |
| 350 | + | |
351 | 351 | | |
352 | 352 | | |
353 | 353 | | |
| |||
380 | 380 | | |
381 | 381 | | |
382 | 382 | | |
| 383 | + | |
| 384 | + | |
383 | 385 | | |
384 | 386 | | |
385 | 387 | | |
| |||
393 | 395 | | |
394 | 396 | | |
395 | 397 | | |
396 | | - | |
| 398 | + | |
397 | 399 | | |
398 | 400 | | |
399 | 401 | | |
400 | 402 | | |
401 | 403 | | |
402 | | - | |
403 | | - | |
404 | | - | |
405 | | - | |
406 | | - | |
407 | | - | |
408 | | - | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
409 | 433 | | |
410 | 434 | | |
411 | 435 | | |
| |||
419 | 443 | | |
420 | 444 | | |
421 | 445 | | |
422 | | - | |
| 446 | + | |
423 | 447 | | |
424 | 448 | | |
425 | 449 | | |
| |||
436 | 460 | | |
437 | 461 | | |
438 | 462 | | |
439 | | - | |
| 463 | + | |
440 | 464 | | |
441 | 465 | | |
442 | 466 | | |
443 | | - | |
444 | | - | |
445 | | - | |
446 | | - | |
| 467 | + | |
| 468 | + | |
447 | 469 | | |
448 | 470 | | |
449 | | - | |
| 471 | + | |
450 | 472 | | |
451 | 473 | | |
452 | 474 | | |
453 | | - | |
454 | | - | |
455 | | - | |
456 | | - | |
| 475 | + | |
| 476 | + | |
457 | 477 | | |
458 | 478 | | |
459 | 479 | | |
| |||
500 | 520 | | |
501 | 521 | | |
502 | 522 | | |
503 | | - | |
| 523 | + | |
504 | 524 | | |
505 | 525 | | |
506 | 526 | | |
| |||
511 | 531 | | |
512 | 532 | | |
513 | 533 | | |
514 | | - | |
515 | | - | |
516 | | - | |
517 | | - | |
518 | | - | |
519 | | - | |
520 | | - | |
| 534 | + | |
521 | 535 | | |
522 | 536 | | |
523 | 537 | | |
| |||
0 commit comments