Skip to content

Commit

Permalink
fix(airflow): disable OL regardless of plugin status (#10250)
Browse files Browse the repository at this point in the history
  • Loading branch information
hsheth2 authored Apr 9, 2024
1 parent 45e0460 commit 3d1571d
Showing 1 changed file with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,6 @@ def get_airflow_plugin_listener() -> Optional["DataHubListener"]:
if plugin_config.enabled:
_airflow_listener = DataHubListener(config=plugin_config)

if plugin_config.disable_openlineage_plugin:
# Deactivate the OpenLineagePlugin listener to avoid conflicts.
from openlineage.airflow.plugin import OpenLineagePlugin

OpenLineagePlugin.listeners = []

telemetry.telemetry_instance.ping(
"airflow-plugin-init",
{
Expand All @@ -99,6 +93,13 @@ def get_airflow_plugin_listener() -> Optional["DataHubListener"]:
"disable_openlineage_plugin": plugin_config.disable_openlineage_plugin,
},
)

if plugin_config.disable_openlineage_plugin:
# Deactivate the OpenLineagePlugin listener to avoid conflicts/errors.
from openlineage.airflow.plugin import OpenLineagePlugin

OpenLineagePlugin.listeners = []

return _airflow_listener


Expand Down Expand Up @@ -127,7 +128,7 @@ def wrapper(*args, **kwargs):
else:
f(*args, **kwargs)
except Exception as e:
logger.exception(e)
logger.warning(e, exc_info=True)

return cast(_F, wrapper)

Expand Down

0 comments on commit 3d1571d

Please sign in to comment.