Skip to content

Commit

Permalink
Honour OPENLINEAGE_DISABLED env var
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanstillfront committed Oct 23, 2023
1 parent 1bf3a3e commit 8d937f9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion cosmos/operators/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ class OperatorLineage: # type: ignore
LINEAGE_NAMESPACE = os.getenv("OPENLINEAGE_NAMESPACE", DEFAULT_OPENLINEAGE_NAMESPACE)


# In the spirit of: https://github.com/apache/airflow/blob/8531396c7c8bf1e016db10c7d32e5e19298d67e5/airflow/providers/openlineage/plugins/openlineage.py#L30
is_openlineage_enabled = is_openlineage_available and os.getenv("OPENLINEAGE_DISABLED", "false").lower() != "true"


class DbtLocalBaseOperator(DbtBaseOperator):
"""
Executes a dbt core cli command locally.
Expand Down Expand Up @@ -227,7 +231,7 @@ def run_command(
output_encoding=self.output_encoding,
cwd=tmp_project_dir,
)
if is_openlineage_available:
if is_openlineage_enabled:
self.calculate_openlineage_events_completes(env, Path(tmp_project_dir))
context[
"task_instance"
Expand Down

0 comments on commit 8d937f9

Please sign in to comment.