mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-08-30 11:56:01 +00:00
* fixed task deserialization in Airflow metadata ingestion * fixed formatting --------- Co-authored-by: Katarzyna Kałek <kkalek@olx.pl>
This commit is contained in:
parent
47c993be92
commit
c9995eecb6
@ -15,7 +15,7 @@ import traceback
|
||||
from collections import Counter
|
||||
from datetime import datetime
|
||||
from enum import Enum
|
||||
from typing import Iterable, List, Optional, cast
|
||||
from typing import Dict, Iterable, List, Optional, cast
|
||||
|
||||
from airflow.models import BaseOperator, DagRun, TaskInstance
|
||||
from airflow.models.dag import DagModel
|
||||
@ -142,6 +142,16 @@ class AirflowSource(PipelineServiceSource):
|
||||
|
||||
return self._session
|
||||
|
||||
@staticmethod
|
||||
def _extract_serialized_task(task: Dict) -> Dict:
|
||||
"""
|
||||
Given the serialization changes introduced in Airflow 2.10,
|
||||
ensure compatibility with all versions.
|
||||
"""
|
||||
if task.keys() == {"__var", "__type"}:
|
||||
return task["__var"]
|
||||
return task
|
||||
|
||||
def get_pipeline_status(self, dag_id: str) -> List[DagRun]:
|
||||
"""
|
||||
Return the DagRuns of given dag
|
||||
@ -328,7 +338,9 @@ class AirflowSource(PipelineServiceSource):
|
||||
max_active_runs=data.get("max_active_runs", None),
|
||||
description=data.get("_description", None),
|
||||
start_date=data.get("start_date", None),
|
||||
tasks=data.get("tasks", []),
|
||||
tasks=list(
|
||||
map(self._extract_serialized_task, data.get("tasks", []))
|
||||
),
|
||||
schedule_interval=get_schedule_interval(data),
|
||||
owner=self.fetch_dag_owners(data),
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user