mobuchowski commented on code in PR #47444:
URL: https://github.com/apache/airflow/pull/47444#discussion_r1987253568
##########
providers/openlineage/src/airflow/providers/openlineage/plugins/macros.py:
##########
@@ -58,15 +59,27 @@ def lineage_run_id(task_instance: TaskInstance):
For more information take a look at the guide:
:ref:`howto/macros:openlineage`
"""
- if hasattr(task_instance, "logical_date"):
- logical_date = task_instance.logical_date
+ if AIRFLOW_V_3_0_PLUS:
+ context = task_instance.get_template_context()
+ if hasattr(task_instance, "dag_run"):
+ dag_run = task_instance.dag_run
+ elif hasattr(context, "dag_run"):
+ dag_run = context["dag_run"]
+ else:
+ return ""
Review Comment:
>Should we silently return an empty string here? What is the scenario here
where there is no dag_run? Can this happen?
AFAIK it can happen in tests only.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]