Skip to content

Commit

Permalink
Try to fix execution & render config for K8s
Browse files Browse the repository at this point in the history
  • Loading branch information
tatiana committed Nov 5, 2024
1 parent 85fb489 commit b0250eb
Showing 1 changed file with 8 additions and 14 deletions.
22 changes: 8 additions & 14 deletions dev/dags/jaffle_shop_kubernetes.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,15 @@
from airflow.providers.cncf.kubernetes.secret import Secret
from pendulum import datetime

from cosmos import (
DbtSeedKubernetesOperator,
DbtTaskGroup,
ExecutionConfig,
ExecutionMode,
ProfileConfig,
ProjectConfig,
)
from cosmos import DbtSeedKubernetesOperator, DbtTaskGroup, ExecutionConfig, ExecutionMode, ProfileConfig, RenderConfig
from cosmos.profiles import PostgresUserPasswordProfileMapping

DEFAULT_DBT_ROOT_PATH = Path(__file__).parent / "dbt"

DBT_ROOT_PATH = Path(os.getenv("DBT_ROOT_PATH", DEFAULT_DBT_ROOT_PATH))
PROJECT_DIR = DBT_ROOT_PATH / "jaffle_shop"
AIRFLOW_PROJECT_DIR = DBT_ROOT_PATH / "jaffle_shop"

K8S_PROJECT_DIR = "dags/dbt/jaffle_shop"

DBT_IMAGE = "dbt-jaffle-shop:1.0.0"

Expand Down Expand Up @@ -58,7 +54,7 @@
# [START kubernetes_seed_example]
load_seeds = DbtSeedKubernetesOperator(
task_id="load_seeds",
project_dir=PROJECT_DIR,
project_dir=K8S_PROJECT_DIR,
get_logs=True,
schema="public",
image=DBT_IMAGE,
Expand Down Expand Up @@ -89,10 +85,8 @@
},
),
),
project_config=ProjectConfig(dbt_project_path=PROJECT_DIR),
execution_config=ExecutionConfig(
execution_mode=ExecutionMode.KUBERNETES,
),
render_config=RenderConfig(dbt_project_path=AIRFLOW_PROJECT_DIR),
execution_config=ExecutionConfig(execution_mode=ExecutionMode.KUBERNETES, dbt_project_path=K8S_PROJECT_DIR),
operator_args={
"image": DBT_IMAGE,
"get_logs": True,
Expand Down

0 comments on commit b0250eb

Please sign in to comment.