You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by ta...@apache.org on 2023/09/02 19:34:54 UTC

[airflow] branch main updated: Remove `AzureDataFactoryPipelineRunStatusAsyncSensor` class (#34036)

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

taragolis pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new d946ff40d6 Remove `AzureDataFactoryPipelineRunStatusAsyncSensor` class (#34036)
d946ff40d6 is described below

commit d946ff40d6bf336a75faf6480c80aea24721c037
Author: Elad Kalif <45...@users.noreply.github.com>
AuthorDate: Sat Sep 2 22:34:45 2023 +0300

    Remove `AzureDataFactoryPipelineRunStatusAsyncSensor` class (#34036)
    
    * Remove `AzureDataFactoryPipelineRunStatusAsyncSensor` class
    
    * Fix tests
---
 airflow/providers/microsoft/azure/CHANGELOG.rst    |  1 +
 .../microsoft/azure/sensors/data_factory.py        | 35 ++--------------------
 .../azure/sensors/test_azure_data_factory.py       | 14 ++++-----
 .../microsoft/azure/example_adf_run_pipeline.py    | 10 ++-----
 4 files changed, 11 insertions(+), 49 deletions(-)

diff --git a/airflow/providers/microsoft/azure/CHANGELOG.rst b/airflow/providers/microsoft/azure/CHANGELOG.rst
index 728cb7dfb2..84bcb59d0c 100644
--- a/airflow/providers/microsoft/azure/CHANGELOG.rst
+++ b/airflow/providers/microsoft/azure/CHANGELOG.rst
@@ -52,6 +52,7 @@ Breaking changes
 
 .. note::
   ``LocalToAzureDataLakeStorageOperator`` class has been removed in favor of ``LocalFilesystemToADLSOperator``
+  ``AzureDataFactoryPipelineRunStatusAsyncSensor`` class has been removed in favor of ``AzureDataFactoryPipelineRunStatusSensor``
 
 6.3.0
 .....
diff --git a/airflow/providers/microsoft/azure/sensors/data_factory.py b/airflow/providers/microsoft/azure/sensors/data_factory.py
index 91bc4072c0..b3e6947f0e 100644
--- a/airflow/providers/microsoft/azure/sensors/data_factory.py
+++ b/airflow/providers/microsoft/azure/sensors/data_factory.py
@@ -16,13 +16,12 @@
 # under the License.
 from __future__ import annotations
 
-import warnings
 from datetime import timedelta
 from functools import cached_property
-from typing import TYPE_CHECKING, Any, Sequence
+from typing import TYPE_CHECKING, Sequence
 
 from airflow.configuration import conf
-from airflow.exceptions import AirflowException, AirflowProviderDeprecationWarning
+from airflow.exceptions import AirflowException
 from airflow.providers.microsoft.azure.hooks.data_factory import (
     AzureDataFactoryHook,
     AzureDataFactoryPipelineRunException,
@@ -126,33 +125,3 @@ class AzureDataFactoryPipelineRunStatusSensor(BaseSensorOperator):
                 raise AirflowException(event["message"])
             self.log.info(event["message"])
         return None
-
-
-class AzureDataFactoryPipelineRunStatusAsyncSensor(AzureDataFactoryPipelineRunStatusSensor):
-    """
-    Checks the status of a pipeline run asynchronously.
-
-    This class is deprecated and will be removed in a future release.
-
-    Please use
-    :class:`airflow.providers.microsoft.azure.sensors.data_factory.AzureDataFactoryPipelineRunStatusSensor`
-    and set *deferrable* attribute to *True* instead.
-
-    :param azure_data_factory_conn_id: The connection identifier for connecting to Azure Data Factory.
-    :param run_id: The pipeline run identifier.
-    :param resource_group_name: The resource group name.
-    :param factory_name: The data factory name.
-    :param poke_interval: polling period in seconds to check for the status
-    :param deferrable: Run sensor in the deferrable mode.
-    """
-
-    def __init__(self, **kwargs: Any) -> None:
-        warnings.warn(
-            "Class `AzureDataFactoryPipelineRunStatusAsyncSensor` is deprecated and "
-            "will be removed in a future release. "
-            "Please use `AzureDataFactoryPipelineRunStatusSensor` and "
-            "set `deferrable` attribute to `True` instead",
-            AirflowProviderDeprecationWarning,
-            stacklevel=2,
-        )
-        super().__init__(**kwargs, deferrable=True)
diff --git a/tests/providers/microsoft/azure/sensors/test_azure_data_factory.py b/tests/providers/microsoft/azure/sensors/test_azure_data_factory.py
index ecc3a7c7b9..ca67444b5a 100644
--- a/tests/providers/microsoft/azure/sensors/test_azure_data_factory.py
+++ b/tests/providers/microsoft/azure/sensors/test_azure_data_factory.py
@@ -27,14 +27,11 @@ from airflow.providers.microsoft.azure.hooks.data_factory import (
     AzureDataFactoryPipelineRunException,
     AzureDataFactoryPipelineRunStatus,
 )
-from airflow.providers.microsoft.azure.sensors.data_factory import (
-    AzureDataFactoryPipelineRunStatusAsyncSensor,
-    AzureDataFactoryPipelineRunStatusSensor,
-)
+from airflow.providers.microsoft.azure.sensors.data_factory import AzureDataFactoryPipelineRunStatusSensor
 from airflow.providers.microsoft.azure.triggers.data_factory import ADFPipelineRunStatusSensorTrigger
 
 
-class TestPipelineRunStatusSensor:
+class TestAzureDataFactoryPipelineRunStatusSensor:
     def setup_method(self):
         self.config = {
             "azure_data_factory_conn_id": "azure_data_factory_test",
@@ -121,11 +118,10 @@ class TestPipelineRunStatusSensor:
             self.defered_sensor.execute_complete(context={}, event={"status": "error", "message": ""})
 
 
-class TestAzureDataFactoryPipelineRunStatusAsyncSensor:
+class TestAzureDataFactoryPipelineRunStatusSensorWithAsync:
     RUN_ID = "7f8c6c72-c093-11ec-a83d-0242ac120007"
-    SENSOR = AzureDataFactoryPipelineRunStatusAsyncSensor(
-        task_id="pipeline_run_sensor_async",
-        run_id=RUN_ID,
+    SENSOR = AzureDataFactoryPipelineRunStatusSensor(
+        task_id="pipeline_run_sensor_async", run_id=RUN_ID, deferrable=True
     )
 
     @mock.patch("airflow.providers.microsoft.azure.sensors.data_factory.AzureDataFactoryHook")
diff --git a/tests/system/providers/microsoft/azure/example_adf_run_pipeline.py b/tests/system/providers/microsoft/azure/example_adf_run_pipeline.py
index dbac6e8a0a..ee1b7d92a7 100644
--- a/tests/system/providers/microsoft/azure/example_adf_run_pipeline.py
+++ b/tests/system/providers/microsoft/azure/example_adf_run_pipeline.py
@@ -29,10 +29,7 @@ except ModuleNotFoundError:
     from airflow.operators.dummy import DummyOperator as EmptyOperator  # type: ignore
 
 from airflow.providers.microsoft.azure.operators.data_factory import AzureDataFactoryRunPipelineOperator
-from airflow.providers.microsoft.azure.sensors.data_factory import (
-    AzureDataFactoryPipelineRunStatusAsyncSensor,
-    AzureDataFactoryPipelineRunStatusSensor,
-)
+from airflow.providers.microsoft.azure.sensors.data_factory import AzureDataFactoryPipelineRunStatusSensor
 from airflow.utils.edgemodifier import Label
 
 ENV_ID = os.environ.get("SYSTEM_TESTS_ENV_ID")
@@ -82,11 +79,10 @@ with DAG(
         deferrable=True,
     )
 
-    # The following sensor is deprecated.
-    # Please use the AzureDataFactoryPipelineRunStatusSensor and set deferrable to True
-    pipeline_run_async_sensor = AzureDataFactoryPipelineRunStatusAsyncSensor(
+    pipeline_run_async_sensor = AzureDataFactoryPipelineRunStatusSensor(
         task_id="pipeline_run_async_sensor",
         run_id=cast(str, XComArg(run_pipeline2, key="run_id")),
+        deferrable=True,
     )
     # [END howto_operator_adf_run_pipeline_async]