diff --git a/airflow/sensors/weekday.py b/airflow/sensors/weekday.py index f48f0bef1e2dc..b3e873b70e987 100644 --- a/airflow/sensors/weekday.py +++ b/airflow/sensors/weekday.py @@ -17,10 +17,8 @@ # under the License. from __future__ import annotations -import warnings from typing import TYPE_CHECKING, Iterable -from airflow.exceptions import RemovedInAirflow3Warning from airflow.sensors.base import BaseSensorOperator from airflow.utils import timezone from airflow.utils.weekday import WeekDay @@ -75,7 +73,6 @@ class DayOfWeekSensor(BaseSensorOperator): with week_day. Execution Date is Useful for backfilling. If ``False``, uses system's day of the week. Useful when you don't want to run anything on weekdays on the system. - :param use_task_execution_day: deprecated parameter, same effect as `use_task_logical_date` .. seealso:: For more information on how to use this sensor, take a look at the guide: @@ -88,19 +85,11 @@ def __init__( *, week_day: str | Iterable[str] | WeekDay | Iterable[WeekDay], use_task_logical_date: bool = False, - use_task_execution_day: bool = False, **kwargs, ) -> None: super().__init__(**kwargs) self.week_day = week_day self.use_task_logical_date = use_task_logical_date - if use_task_execution_day: - self.use_task_logical_date = use_task_execution_day - warnings.warn( - "Parameter ``use_task_execution_day`` is deprecated. Use ``use_task_logical_date``.", - RemovedInAirflow3Warning, - stacklevel=2, - ) self._week_day_num = WeekDay.validate_week_day(week_day) def poke(self, context: Context) -> bool: diff --git a/newsfragments/newsfragments/41393.significant.rst b/newsfragments/newsfragments/41393.significant.rst new file mode 100644 index 0000000000000..d81e2858bb59b --- /dev/null +++ b/newsfragments/newsfragments/41393.significant.rst @@ -0,0 +1,18 @@ +**Breaking Change** + +The ``use_task_execution_day`` parameter has been removed from the ``DayOfWeekSensor`` class. +This parameter was previously deprecated in favor of ``use_task_logical_date``. + +If your code still uses ``use_task_execution_day``, you should update it to use ``use_task_logical_date`` +instead to ensure compatibility with future Airflow versions. + +Example update: + +.. code-block:: python + + sensor = DayOfWeekSensor( + task_id="example", + week_day="Tuesday", + use_task_logical_date=True, + dag=dag, + ) diff --git a/tests/sensors/test_weekday_sensor.py b/tests/sensors/test_weekday_sensor.py index b8ff6c563bae0..eaa2fa4ee661c 100644 --- a/tests/sensors/test_weekday_sensor.py +++ b/tests/sensors/test_weekday_sensor.py @@ -129,18 +129,3 @@ def test_weekday_sensor_timeout_with_set(self): ) with pytest.raises(AirflowSensorTimeout): op.run(start_date=WEEKDAY_DATE, end_date=WEEKDAY_DATE, ignore_ti_state=True) - - def test_deprecation_warning(self): - warning_message = ( - """Parameter ``use_task_execution_day`` is deprecated. Use ``use_task_logical_date``.""" - ) - with pytest.warns(DeprecationWarning) as warnings: - DayOfWeekSensor( - task_id="week_day_warn", - poke_interval=1, - timeout=2, - week_day="Tuesday", - use_task_execution_day=True, - dag=self.dag, - ) - assert warning_message == str(warnings[0].message)