Commit 4394b8f
Fix issue where LocalExecutor could start tasks before the state was commited (apache#56010)
* Fix issue where LocalExecutor could start tasks before the state was commited
With some recent changes LocalExec was now able to start a task _too quickly_,
and due to it's custom implementation of `queue_workload` it was directly
sending the message to the MP queue the task in queue_workload, which means if
there is an idle worker process already it will pick it up "instantly" --
crucially before the database transaction in with TI.state is changed from
scheduled to queued, is committed!
The fix here is to correctly follow the BaseExecutor interface, and not start
send the workloads for processing until heartbeat is called (which happens in
the scheduler right after the transaction is committed.)
* Fix test
---------
Co-authored-by: Kaxil Naik <kaxilnaik@gmail.com>1 parent f91698c commit 4394b8f
File tree
2 files changed
+13
-9
lines changed- airflow-core
- src/airflow/executors
- tests/unit/executors
2 files changed
+13
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
40 | 39 | | |
41 | 40 | | |
42 | 41 | | |
| |||
48 | 47 | | |
49 | 48 | | |
50 | 49 | | |
51 | | - | |
52 | | - | |
53 | 50 | | |
54 | 51 | | |
55 | 52 | | |
| |||
253 | 250 | | |
254 | 251 | | |
255 | 252 | | |
256 | | - | |
257 | | - | |
258 | | - | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
259 | 257 | | |
260 | | - | |
| 258 | + | |
261 | 259 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
| |||
97 | 98 | | |
98 | 99 | | |
99 | 100 | | |
100 | | - | |
| 101 | + | |
| 102 | + | |
101 | 103 | | |
102 | 104 | | |
103 | 105 | | |
| |||
107 | 109 | | |
108 | 110 | | |
109 | 111 | | |
110 | | - | |
| 112 | + | |
| 113 | + | |
111 | 114 | | |
112 | 115 | | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
113 | 119 | | |
114 | 120 | | |
115 | 121 | | |
| |||
0 commit comments