Skip to content

Commit

Permalink
change val name
Browse files Browse the repository at this point in the history
  • Loading branch information
wornjs committed Nov 27, 2024
1 parent 46e0f75 commit 26811de
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
6 changes: 4 additions & 2 deletions cosmos/airflow/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ def create_test_task_metadata(
extra_context = {}

task_owner = ""
airflow_task_config = {}
if test_indirect_selection != TestIndirectSelection.EAGER:
task_args["indirect_selection"] = test_indirect_selection.value
if node is not None:
Expand All @@ -110,6 +111,7 @@ def create_test_task_metadata(

extra_context = {"dbt_node_config": node.context_dict}
task_owner = node.owner
airflow_task_config = node.airflow_task_config

elif render_config is not None: # TestBehavior.AFTER_ALL
task_args["select"] = render_config.select
Expand All @@ -119,7 +121,7 @@ def create_test_task_metadata(
return TaskMetadata(
id=test_task_name,
owner=task_owner,
cosmos_custom=node.cosmos_custom,
airflow_task_config=airflow_task_config,
operator_class=calculate_operator_class(
execution_mode=execution_mode,
dbt_class="DbtTest",
Expand Down Expand Up @@ -192,7 +194,7 @@ def create_task_metadata(
task_metadata = TaskMetadata(
id=task_id,
owner=node.owner,
cosmos_custom=node.cosmos_custom,
airflow_task_config=node.airflow_task_config,
operator_class=calculate_operator_class(
execution_mode=execution_mode, dbt_class=dbt_resource_to_class[node.resource_type]
),
Expand Down
2 changes: 1 addition & 1 deletion cosmos/core/airflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def get_airflow_task(task: Task, dag: DAG, task_group: TaskGroup | None = None)
if task.owner != "":
task_kwargs["owner"] = task.owner

for k, v in task.cosmos_custom.items():
for k, v in task.airflow_task_config.items():
task_kwargs[k] = v

Check warning on line 36 in cosmos/core/airflow.py

View check run for this annotation

Codecov / codecov/patch

cosmos/core/airflow.py#L36

Added line #L36 was not covered by tests

airflow_task = Operator(
Expand Down
2 changes: 1 addition & 1 deletion cosmos/core/graph/entities.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class Task(CosmosEntity):
"""

owner: str = ""
cosmos_custom: Dict[str, Any] = field(default_factory=dict)
airflow_task_config: Dict[str, Any] = field(default_factory=dict)
operator_class: str = "airflow.operators.empty.EmptyOperator"
arguments: Dict[str, Any] = field(default_factory=dict)
extra_context: Dict[str, Any] = field(default_factory=dict)
2 changes: 1 addition & 1 deletion cosmos/dbt/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class DbtNode:
has_test: bool = False

@property
def cosmos_custom(self) -> Dict[str, Any]:
def airflow_task_config(self) -> Dict[str, Any]:
"""
This method is designed to extend the dbt project's functionality by incorporating Airflow-related metadata into the dbt YAML configuration.
Since dbt projects are independent of Airflow, adding Airflow-specific information to the `meta` field within the dbt YAML allows Airflow tasks to
Expand Down

0 comments on commit 26811de

Please sign in to comment.