lattwood opened a new pull request #11016:
URL: https://github.com/apache/airflow/pull/11016


   This can have *extremely* bad consequences. After this change, a jinja2 
template like the one below will cause the task instance to fail, if the DAG 
being executed is not a sub-DAG. This may also display an error on the Rendered 
tab of the Task Instance page.
   
   `task_instance.xcom_pull('z', key='return_value', 
dag_id=dag.parent_dag.dag_id)`
   
   Prior to the change in this commit, the above template would pull the latest 
value for task_id 'z', for the given execution_date, from *any DAG*. If your 
task_ids between DAGs are all unique, or if DAGs using the same task_id always 
have different execution_date values, this will appear to act like dag_id=None.
   
   Our current theory is SQLAlchemy/Python doesn't behave as expected when 
comparing `jinja2.Undefined` to `None`.
   
   Admittedly this issue boils down to PEBKAC, but this is also a case of 
Airflow not doing the (perceived) right thing in the face of ambiguity, and 
this PR fixes that up.
   
   I did find this note about why it was only set to `jinja2.Undefined`, but 
given the way this can fail (and the difficulty in tracking down the root 
cause), I strongly feel this warrants breaking backwards compatibility with 
DAGs/task instances that are attempting to erroneously use undefined variables.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to