Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add deprecation warning in core provider #1439

Merged
merged 3 commits into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions astronomer/providers/core/sensors/external_task.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import datetime
import warnings
from typing import TYPE_CHECKING, Any, Dict, List, Optional

from airflow.sensors.external_task import ExternalTaskSensor
Expand All @@ -23,6 +24,15 @@ def __init__(
poke_interval: float = 5.0,
**kwargs: Any,
) -> None:
warnings.warn(
(
"This module is deprecated and will be removed in airflow>=2.9.0"
"Please use `airflow.sensors.external_task.ExternalTaskSensor` "
"and set deferrable to True instead."
),
DeprecationWarning,
stacklevel=2,
)
super().__init__(**kwargs)
self.poke_interval = poke_interval

Expand Down
13 changes: 13 additions & 0 deletions astronomer/providers/core/sensors/filesystem.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import warnings
from datetime import timedelta
from typing import Any, Dict, Optional

Expand All @@ -23,6 +24,18 @@ class FileSensorAsync(FileSensor):
``**`` in glob filepath parameter. Defaults to ``False``.
"""

def __init__(self, *args, **kwargs):
warnings.warn(
(
"This module is deprecated and will be removed in airflow>=2.9.0"
"Please use `airflow.sensors.filesystem.FileSensor` "
"and set deferrable to True instead."
),
DeprecationWarning,
stacklevel=2,
)
super().__init__(*args, **kwargs)

def execute(self, context: Context) -> None:
"""Airflow runs this method on the worker and defers using the trigger."""
if not self.poke(context=context):
Expand Down
10 changes: 10 additions & 0 deletions astronomer/providers/core/triggers/external_task.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import asyncio
import datetime
import typing
import warnings
from typing import Any, AsyncIterator, Dict, List, Tuple

from airflow import AirflowException
Expand Down Expand Up @@ -105,6 +106,15 @@ def __init__(
execution_dates: List[datetime.datetime],
poll_interval: float = 5.0,
):
warnings.warn(
(
"This module is deprecated and will be removed in airflow>=2.9.0"
"Please use `airflow.triggers.external_task.WorkflowTrigger` "
"and set deferrable to True instead."
),
DeprecationWarning,
stacklevel=2,
)
super().__init__()
self.dag_id = dag_id
self.states = states
Expand Down
10 changes: 10 additions & 0 deletions astronomer/providers/core/triggers/filesystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import datetime
import os
import typing
import warnings
from glob import glob
from typing import Any, Dict, Tuple

Expand All @@ -26,6 +27,15 @@ def __init__(
recursive: bool = False,
poll_interval: float = 5.0,
):
warnings.warn(
(
"This module is deprecated and will be removed in airflow>=2.9.0"
"Please use `airflow.triggers.file.FileTrigger` "
"and set deferrable to True instead."
),
DeprecationWarning,
stacklevel=2,
)
super().__init__()
self.filepath = filepath
self.recursive = recursive
Expand Down
Loading