SameerMesiah97 commented on code in PR #69109:
URL: https://github.com/apache/airflow/pull/69109#discussion_r3554804204
##########
providers/openlineage/src/airflow/providers/openlineage/plugins/adapter.py:
##########
@@ -172,10 +174,24 @@ def emit(self, event: RunEvent):
event_type = event.eventType.value.lower() if event.eventType else ""
transport_type = f"{self._client.transport.kind}".lower()
+ team_name = None
+
+ facets = event.run.facets or {}
+ airflow_facet = cast("AirflowRunFacet | None", facets.get("airflow"))
Review Comment:
The `if airflow_facet` block has been modified as follows:
```
if airflow_facet:
team_name = airflow_facet.dagRun.get("dag_team_name")
else:
airflow_dagrun_facet = cast("AirflowDagRunFacet | None",
facets.get("airflowDagRun"))
if airflow_dagrun_facet:
dag_run = airflow_dagrun_facet.dagRun
team_name = (
dag_run.get("dag_team_name")
if isinstance(dag_run, dict)
else getattr(dag_run, "dag_team_name", None)
)
```
The fallback has been covered in `test_emit_complete_event_dagrun_fallback`,
which has been added in the last commit.
--
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]