Add start execution from triggerer support to dynamic task mapping#39912
Conversation
6c9bbfd to
5c2b6de
Compare
|
The code here is not yet well structured but has been tested locally and seems to work fine. It would be great if I could get some reviews and suggestions. Thanks! |
245c685 to
4ff77db
Compare
|
This PR is ready to be reviewed but blocked by #39585 so I'll keep it as draft for now. |
590b172 to
e1f7aee
Compare
18f4ddc to
403ced5
Compare
f0343d2 to
e30bb4c
Compare
5b5e545 to
eaadcfc
Compare
|
@uranusjr @jedcunningham I plan on merging this one later today or early tomorrow. Please let me know if there's still concern or if you want to look deeper. Thanks! |
uranusjr
left a comment
There was a problem hiding this comment.
I was thinking how we could get rid of the very out-of-place isinstance calls. The main problem is we don’t need context for the non-mapped case. Looking into the implementation though, the resolution process really only needs ti and run_id, and getting both are basically free at those parts of the code. So I would probably do
- This this PR, create an interface in AbstractOperator (say
expand_start_from_trigger) that takescontextandsession. The BaseOperator implementation will simply returnself.start_from_trigger. - If this is fine performance-wise, just call it a day.
- Assuming we want to optimise, create a new PR to only pass in
{"run_id": self.run_id, "ti": ti}instead with a comment explaining why (performance consideration, and reasons this should be enough).
|
Probably shouldn’t be an approval (the exception class likely needs discussion, and I would prefer the function in AbstractOperator to be a part of this PR), but close enough. |
|
The latest comments from @uranusjr have been addressed. I'll go ahead and merge this one. |
…expand start trigger
…art_from_trigger and _expand_start_trigger_args
…ct operator to unify how base op and mapped op retrieve start_from_trigger
…ct operator to unify how base op and mapped op retrieve start_trigger_args
…d validate start_trigger_args passed to _defer_task" to TaskDeferralError
This is a follow-up PR of #39585, which enables the mapped operator to start execution from triggerer
Why
Dynamic task mapping is not yet supported in #38674 and #39585.
What
Allow DAG authors to provide argument
trigger_kwargsandstart_from_triggerin__init__which can be used inexpand.^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named
{pr_number}.significant.rstor{issue_number}.significant.rst, in newsfragments.