-
Notifications
You must be signed in to change notification settings - Fork 14.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update ExternalTaskSensorLink
to handle templated external_dag_id
#21192
Update ExternalTaskSensorLink
to handle templated external_dag_id
#21192
Conversation
e9473fd
to
6fafc4d
Compare
airflow/sensors/external_task.py
Outdated
ti = TaskInstance(task=operator, execution_date=dttm) | ||
operator.render_template_fields({"ti": ti}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, we should try to discourage creating ad-hoc TaskInstance objects since it is much too brittle now that it has a foreign key to DagRun. Not sure what’s a good alternative though. @ashb Maybe this is a good time to (finally) start working on a new interface for this?
Also instead of just {"ti": ti}
we should likely use ti.get_template_context()
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah OK. Took a look at the other operator links too and all but one creates an ad hoc TaskInstance, but honestly those probably could just use XCom.get_one()
.
I'll update to use ti.get_template_context()
in the meantime and test.
6fafc4d
to
7a87b0d
Compare
The PR most likely needs to run full matrix of tests because it modifies parts of the core of Airflow. However, committers might decide to merge it quickly and take the risk. If they don't merge it quickly - please rebase it to the latest main at your convenience, or amend the last commit of the PR, and push it with --force-with-lease. |
7a87b0d
to
d7e83d7
Compare
Just an intermittend docker-compose test failure (which we should take a look soon BTW). |
Closes: #21183
^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code change, 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 UPDATING.md.