diff --git a/cosmos/config.py b/cosmos/config.py index 4a914e56d8..f5c7e494ea 100644 --- a/cosmos/config.py +++ b/cosmos/config.py @@ -434,9 +434,13 @@ class ExecutionConfig: async_py_requirements: list[str] | None = None def __post_init__(self, dbt_project_path: str | Path | None) -> None: - if self.invocation_mode and self.execution_mode not in (ExecutionMode.LOCAL, ExecutionMode.VIRTUALENV): + if self.invocation_mode and self.execution_mode not in ( + ExecutionMode.WATCHER, + ExecutionMode.LOCAL, + ExecutionMode.VIRTUALENV, + ): raise CosmosValueError( - "ExecutionConfig.invocation_mode is only configurable for ExecutionMode.LOCAL and ExecutionMode.VIRTUALENV." + "ExecutionConfig.invocation_mode is only configurable for ExecutionMode.WATCHER, ExecutionMode.LOCAL, and ExecutionMode.VIRTUALENV." ) if self.execution_mode == ExecutionMode.VIRTUALENV: if self.invocation_mode == InvocationMode.DBT_RUNNER: diff --git a/dev/dags/example_watcher.py b/dev/dags/example_watcher.py index 0ba685e0d5..74998646db 100644 --- a/dev/dags/example_watcher.py +++ b/dev/dags/example_watcher.py @@ -40,12 +40,12 @@ operator_args["trigger_rule"] = "all_success" +from cosmos.constants import InvocationMode + # [START example_watcher] example_watcher = DbtDag( # dbt/cosmos-specific parameters - execution_config=ExecutionConfig( - execution_mode=ExecutionMode.WATCHER, - ), + execution_config=ExecutionConfig(execution_mode=ExecutionMode.WATCHER, invocation_mode=InvocationMode.DBT_RUNNER), project_config=ProjectConfig(DBT_PROJECT_PATH), profile_config=profile_config, operator_args=operator_args,