Skip to content

Commit

Permalink
Added Config Option for configuring runtime project location
Browse files Browse the repository at this point in the history
  • Loading branch information
tabmra committed Oct 24, 2023
1 parent 11721a9 commit 02ae25b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions cosmos/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from __future__ import annotations

import contextlib
import os
import tempfile
from dataclasses import dataclass, field
from pathlib import Path
Expand Down Expand Up @@ -223,3 +224,4 @@ class ExecutionConfig:
execution_mode: ExecutionMode = ExecutionMode.LOCAL
test_indirect_selection: TestIndirectSelection = TestIndirectSelection.EAGER
dbt_executable_path: str | Path = get_system_dbt()
dbt_project_path_root: str | Path = Path(os.environ.get("AIRFLOW_HOME", "/dbt")) / "dags" / "dbt"
5 changes: 4 additions & 1 deletion cosmos/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ def __init__(
test_indirect_selection = execution_config.test_indirect_selection
load_mode = render_config.load_method
dbt_executable_path = execution_config.dbt_executable_path
dbt_project_path_runtime_root = execution_config.dbt_project_path_root
node_converters = render_config.node_converters

profile_args = {}
Expand Down Expand Up @@ -145,7 +146,9 @@ def __init__(
task_args = {
**operator_args,
# the following args may be only needed for local / venv:
"project_dir": project_config.dbt_project_path,
"project_dir": project_config.dbt_project_path
if project_config.dbt_project_path
else dbt_project_path_runtime_root / project_config.project_name,
"profile_config": profile_config,
"emit_datasets": emit_datasets,
}
Expand Down

0 comments on commit 02ae25b

Please sign in to comment.