Skip to content

Commit

Permalink
feat: add fileloc to DAG info in AirflowRunFacet (apache#41311)
Browse files Browse the repository at this point in the history
Signed-off-by: Kacper Muda <[email protected]>
  • Loading branch information
kacpermuda authored Aug 8, 2024
1 parent c3286e8 commit ec0e9f2
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion airflow/providers/openlineage/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ def _include_fields(self):
class DagInfo(InfoJsonEncodable):
"""Defines encoding DAG object to JSON."""

includes = ["dag_id", "description", "owner", "schedule_interval", "start_date", "tags"]
includes = ["dag_id", "description", "fileloc", "owner", "schedule_interval", "start_date", "tags"]
casts = {"timetable": lambda dag: dag.timetable.serialize() if getattr(dag, "timetable", None) else None}
renames = {"_dag_id": "dag_id"}

Expand Down
1 change: 1 addition & 0 deletions tests/providers/openlineage/plugins/test_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -587,6 +587,7 @@ def test_emit_dag_started_event(mock_stats_incr, mock_stats_timer, generate_stat
"schedule_interval": "86400.0 seconds",
"start_date": "2024-06-01T00:00:00+00:00",
"tags": [],
"fileloc": pathlib.Path(__file__).resolve().as_posix(),
},
dagRun={
"conf": {},
Expand Down
2 changes: 2 additions & 0 deletions tests/providers/openlineage/utils/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from __future__ import annotations

import datetime
import pathlib
from unittest.mock import MagicMock, patch

from airflow import DAG
Expand Down Expand Up @@ -138,6 +139,7 @@ def test_get_airflow_dag_run_facet():
dag={
"dag_id": "dag",
"description": None,
"fileloc": pathlib.Path(__file__).resolve().as_posix(),
"owner": "airflow",
"timetable": {},
"schedule_interval": "@once",
Expand Down

0 comments on commit ec0e9f2

Please sign in to comment.