Skip to content

Commit

Permalink
Remove deprecated code from Airbyte provider (apache#44577)
Browse files Browse the repository at this point in the history
* Removed deprecated code of polling_interval

* Added unit test case to check the working of poke_interval

* updated CHANGELOG
  • Loading branch information
ajitg25 authored and Lefteris Gilmaz committed Jan 5, 2025
1 parent 7381812 commit 369226c
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 16 deletions.
9 changes: 9 additions & 0 deletions providers/src/airflow/providers/airbyte/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,15 @@
Changelog
---------

main
.....

.. warning::
All deprecated classes, parameters, and features have been removed from the Airbyte provider package.
The following breaking changes were introduced:

* Removed ``polling_interval`` parameter from ``AirbyteJobSensor``. Use the ``poke_interval`` parameter instead.

4.0.0
.....

Expand Down
21 changes: 5 additions & 16 deletions providers/src/airflow/providers/airbyte/sensors/airbyte.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,13 @@
from __future__ import annotations

import time
import warnings
from collections.abc import Sequence
from typing import TYPE_CHECKING, Any

from airbyte_api.models import JobStatusEnum

from airflow.configuration import conf
from airflow.exceptions import AirflowException, AirflowProviderDeprecationWarning
from airflow.exceptions import AirflowException
from airflow.providers.airbyte.hooks.airbyte import AirbyteHook
from airflow.providers.airbyte.triggers.airbyte import AirbyteSyncTrigger
from airflow.sensors.base import BaseSensorOperator
Expand Down Expand Up @@ -61,20 +60,10 @@ def __init__(
) -> None:
if deferrable:
if "poke_interval" not in kwargs:
# TODO: Remove once deprecated
if "polling_interval" in kwargs:
kwargs["poke_interval"] = kwargs["polling_interval"]
warnings.warn(
"Argument `poll_interval` is deprecated and will be removed "
"in a future release. Please use `poke_interval` instead.",
AirflowProviderDeprecationWarning,
stacklevel=2,
)
else:
kwargs["poke_interval"] = 5

if "timeout" not in kwargs:
kwargs["timeout"] = 60 * 60 * 24 * 7
kwargs["poke_interval"] = 5

if "timeout" not in kwargs:
kwargs["timeout"] = 60 * 60 * 24 * 7

super().__init__(**kwargs)
self.deferrable = deferrable
Expand Down
12 changes: 12 additions & 0 deletions providers/tests/airbyte/sensors/test_airbyte.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,15 @@ def test_cancelled(self, mock_get_job):
sensor.poke(context={})

mock_get_job.assert_called_once_with(request=GetJobRequest(job_id=self.job_id))

def test_airbyte_job_sensor_init(self):
"""Test initializing AirbyteJobSensor with `poke_interval`."""
sensor = AirbyteJobSensor(
task_id="test_sensor",
airbyte_job_id=1,
deferrable=True,
poke_interval=10,
timeout=3600,
)
assert sensor.poke_interval == 10
assert sensor.timeout == 3600

0 comments on commit 369226c

Please sign in to comment.