kacpermuda commented on code in PR #47444:
URL: https://github.com/apache/airflow/pull/47444#discussion_r1987368618
##########
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:
Is there anyway we can provide this information in the test cases (either
dag_run attr or context)? Not sure if it's a good idea to add a not-production
logic in the code, that if executed, breaks the result of this macro, purely
for the sake of making tests pass.
--
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]