Repository navigation
Load the serialized Dag in ti_run only for stub tasks - #75795
jason810496 merged 5 commits into
Conversation
ephraimbuddy
left a comment
There was a problem hiding this comment.
Nits: I think there's no need to have the TABLE_NAME variable. non-blocking
|
More generally, I'm not sure gating this on "is_stub" is right. This is needed for an go task isn't it? I think we defined a stub task as one written in a language other than the one the dag is defined in. But that isn't the only place we need the arg_binding, is it? |
Yes.
Actually, both Python Dag with Stub task and the task define in non-Python Dag will set the "is_stub" as true and the arg_binding field. |
jason810496
left a comment
There was a problem hiding this comment.
Thanks all for the review.
Starting any task deserialized its whole Dag so the route could find out whether the task was a stub and read its arg_bindings. Denormalize the serialized is_stub flag onto task_instance, which ti_run already fetches and locks, and load the Dag only when it is set. execution_timeout is resolved from the same definition, so it is now sent for a lang-SDK task only; apache#75387 has a Python task send its own to the supervisor. Co-Authored-By: Claude <noreply@anthropic.com>
Dropping a column rebuilds the table on SQLite, unlike adding one, so the downgrade copies task_instance rows while other tables still point at it. Co-Authored-By: Claude <noreply@anthropic.com>
create_dagrun refreshes every row from its task right after the bulk write, so the existing test passed even when insert_mapping dropped the key. Assert the mapping itself instead, and record what a row keeps when it moves to a new Dag version without being refreshed. Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
01d776d to
978a6bc
Compare
Flaky CI, merging the PR now. |
…5795) (#75802) * [v3-4-test] Load the serialized Dag in ti_run only for stub tasks (#75795) Starting any task deserialized its whole Dag so the route could find out whether the task was a stub and read its arg_bindings. Denormalize the serialized is_stub flag onto task_instance, which ti_run already fetches and locks, and load the Dag only when it is set. * Mark a Go or Java TriggerDagRun task a stub, as TypeScript does * Inline the table name in the is_stub migration * Starve a Dag the scheduler cannot deserialize test_find_executable_task_instances_skips_dag_that_cannot_be_deserialized fails on v3-4-test independently of this backport. #75745 brought the guard over from #75263 without the starved set that #75263 relies on, because that set came with #70307, which is not on this branch. The guard then returns False without narrowing the next query, so a cycle whose batch is filled by the bad Dag ends with nothing queued. ---------
backport-to-v3-4-testbefore 3.4.0 RC.Why
Starting any task deserialized its whole Dag in Execution API, so that
ti_runcould find out whether the task was a stub and read itsarg_bindings. On a Dag cache miss that is a fullserialized_dagread plus deserialization per task start, paid while the route holdsSELECT ... FOR UPDATEon thetask_instancerow, and for a Python task the result is thrown away.How
The serialized
is_stubflag is denormalized ontotask_instancetable for the fast lookup.The route loads the task's definition only when the flag is set:
Null means "not a stub", with no fallback. Every null row predates the migration, so it was written by 3.3, which has no
arg_bindingsat all, and such a task behaves exactly as it did there.For the release manager
mainhas moved past the 3.4.0 chain head, and a 3.4.0 revision cannot sit after 3.5.0 ones ordb migrate --to-version 3.4.0would stop short of it. The new revision is therefore inserted, and the two 3.5.0 revisions after it are renumbered:Note
execution_timeoutresolution that rely on the serialized Dag and refactor that e2e path anyway, that is keep as out of scope on main. Send the Python task's execution_timeout to the supervisor #75387 makes permanent by having the Python task runner send its own timeout to the supervisor. Until it merges, a stuck Python task has no supervisor backstop onmain; the runner's ownAirflowTaskTimeoutstill fires. 3.4.0 is unaffected, having noTIRunContext.execution_timeoutat all ([v3-4-test] Revert "Enforce execution_timeout for tasks run by a language SDK" (#75376) #75469).is_stubfor Dags defined in them.Was generative AI tooling used to co-author this PR?