Skip to content

Commit

Permalink
Troubleshoot
Browse files Browse the repository at this point in the history
  • Loading branch information
tatiana committed Dec 19, 2024
1 parent 210e6fa commit 091641a
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions cosmos/listeners/dag_run_listener.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,23 @@ class EventStatus:
DAG_RUN = "dag_run"


@functools.lru_cache()
def is_cosmos_dag(dag: DAG) -> bool:
import inspect

from cosmos.airflow.dag import DbtDag

logger.info(f"is_cosmos_dag: {isinstance(dag, DbtDag)}")
dag_class = dag.__class__
dag_module = inspect.getmodule(dag_class)

logger.info(
f"is_cosmos_dag ({dag}, {DbtDag}, {dag_class and dag_class.__name__}, {dag_module and dag_module.__name__}): {isinstance(dag, DbtDag)}"
)
return True
if isinstance(dag, DbtDag):
return True
return False


@functools.lru_cache()
def total_cosmos_task_groups(dag: DAG) -> int:
from cosmos.airflow.task_group import DbtTaskGroup

Expand All @@ -41,7 +47,6 @@ def total_cosmos_task_groups(dag: DAG) -> int:
return cosmos_task_groups


@functools.lru_cache()
def total_cosmos_tasks(dag: DAG) -> int:
cosmos_tasks = 0
for task in dag.tasks:
Expand Down

0 comments on commit 091641a

Please sign in to comment.