You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by mo...@apache.org on 2023/08/04 16:54:23 UTC

[airflow] branch openlineage-disable-when-not-configured updated (22c3730908 -> 821d5de687)

This is an automated email from the ASF dual-hosted git repository.

mobuchowski pushed a change to branch openlineage-disable-when-not-configured
in repository https://gitbox.apache.org/repos/asf/airflow.git


 discard 22c3730908 openlineage: disable running listener if not configured
     new 821d5de687 openlineage: disable running listener if not configured

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (22c3730908)
            \
             N -- N -- N   refs/heads/openlineage-disable-when-not-configured (821d5de687)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 tests/providers/openlineage/plugins/test_openlineage.py | 15 +--------------
 1 file changed, 1 insertion(+), 14 deletions(-)


[airflow] 01/01: openlineage: disable running listener if not configured

Posted by mo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

mobuchowski pushed a commit to branch openlineage-disable-when-not-configured
in repository https://gitbox.apache.org/repos/asf/airflow.git

commit 821d5de687338e2b34239b4e627901dd6d1efc51
Author: Maciej Obuchowski <ob...@gmail.com>
AuthorDate: Fri Aug 4 18:45:22 2023 +0200

    openlineage: disable running listener if not configured
    
    Signed-off-by: Maciej Obuchowski <ob...@gmail.com>
---
 .../providers/openlineage/plugins/openlineage.py   |  8 ++++-
 .../openlineage/plugins/test_openlineage.py        | 36 ++++++++++++++++++++--
 2 files changed, 40 insertions(+), 4 deletions(-)

diff --git a/airflow/providers/openlineage/plugins/openlineage.py b/airflow/providers/openlineage/plugins/openlineage.py
index 2ec0801147..318d2d5b17 100644
--- a/airflow/providers/openlineage/plugins/openlineage.py
+++ b/airflow/providers/openlineage/plugins/openlineage.py
@@ -27,6 +27,12 @@ def _is_disabled() -> bool:
     return (
         conf.getboolean("openlineage", "disabled")
         or os.getenv("OPENLINEAGE_DISABLED", "false").lower() == "true"
+        or (
+            conf.get("openlineage", "transport") == ""
+            and conf.get("openlineage", "config_path") == ""
+            and os.getenv("OPENLINEAGE_URL", "") == ""
+            and os.getenv("OPENLINEAGE_CONFIG", "") == ""
+        )
     )
 
 
@@ -39,8 +45,8 @@ class OpenLineageProviderPlugin(AirflowPlugin):
     """
 
     name = "OpenLineageProviderPlugin"
-    macros = [lineage_run_id, lineage_parent_id]
     if not _is_disabled():
         from airflow.providers.openlineage.plugins.listener import OpenLineageListener
 
+        macros = [lineage_run_id, lineage_parent_id]
         listeners = [OpenLineageListener()]
diff --git a/tests/providers/openlineage/plugins/test_openlineage.py b/tests/providers/openlineage/plugins/test_openlineage.py
index 4fcb0f287d..fa41bc6aa7 100644
--- a/tests/providers/openlineage/plugins/test_openlineage.py
+++ b/tests/providers/openlineage/plugins/test_openlineage.py
@@ -39,8 +39,28 @@ class TestOpenLineageProviderPlugin:
     @pytest.mark.parametrize(
         "mocks, expected",
         [
-            ([patch.dict(os.environ, {"OPENLINEAGE_DISABLED": "true"}, 0)], 0),
-            ([conf_vars({("openlineage", "disabled"): "False"})], 1),
+            ([patch.dict(os.environ, {"OPENLINEAGE_DISABLED": "true"})], 0),
+            (
+                [
+                    conf_vars(
+                        {("openlineage", "transport"): '{"type": "http", "url": "http://localhost:5000"}'}
+                    ),
+                    patch.dict(os.environ, {"OPENLINEAGE_DISABLED": "true"}),
+                ],
+                0,
+            ),
+            ([patch.dict(os.environ, {"OPENLINEAGE_DISABLED": "false"})], 0),
+            (
+                [
+                    conf_vars(
+                        {
+                            ("openlineage", "disabled"): "False",
+                            ("openlineage", "transport"): '{"type": "http", "url": "http://localhost:5000"}',
+                        }
+                    )
+                ],
+                1,
+            ),
             (
                 [
                     conf_vars({("openlineage", "disabled"): "False"}),
@@ -48,7 +68,16 @@ class TestOpenLineageProviderPlugin:
                 ],
                 0,
             ),
-            ([], 1),
+            ([], 0),
+            ([patch.dict(os.environ, {"OPENLINEAGE_URL": "http://localhost:8080"})], 1),
+            (
+                [
+                    conf_vars(
+                        {("openlineage", "transport"): '{"type": "http", "url": "http://localhost:5000"}'}
+                    )
+                ],
+                1,
+            ),
         ],
     )
     def test_plugin_disablements(self, mocks, expected):
@@ -58,4 +87,5 @@ class TestOpenLineageProviderPlugin:
             from airflow.providers.openlineage.plugins.openlineage import OpenLineageProviderPlugin
 
             plugin = OpenLineageProviderPlugin()
+
             assert len(plugin.listeners) == expected