Skip to content

Commit bcc3923

Browse files
dirraouranusjr
authored andcommitted
Util helper deprecated functions removal (apache#41520)
* util helper depreaction removal * Tame Mypy * news fragment added --------- Co-authored-by: Tzu-ping Chung <[email protected]>
1 parent c48892e commit bcc3923

File tree

3 files changed

+9
-26
lines changed

3 files changed

+9
-26
lines changed

airflow/utils/helpers.py

+1-23
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,14 @@
2121
import itertools
2222
import re
2323
import signal
24-
import warnings
2524
from datetime import datetime
2625
from functools import reduce
2726
from typing import TYPE_CHECKING, Any, Callable, Generator, Iterable, Mapping, MutableMapping, TypeVar, cast
2827

2928
from lazy_object_proxy import Proxy
3029

3130
from airflow.configuration import conf
32-
from airflow.exceptions import AirflowException, RemovedInAirflow3Warning
33-
from airflow.utils.module_loading import import_string
31+
from airflow.exceptions import AirflowException
3432
from airflow.utils.types import NOTSET
3533

3634
if TYPE_CHECKING:
@@ -231,26 +229,6 @@ def partition(pred: Callable[[T], bool], iterable: Iterable[T]) -> tuple[Iterabl
231229
return itertools.filterfalse(pred, iter_1), filter(pred, iter_2)
232230

233231

234-
def chain(*args, **kwargs):
235-
"""Use `airflow.models.baseoperator.chain`, this function is deprecated."""
236-
warnings.warn(
237-
"This function is deprecated. Please use `airflow.models.baseoperator.chain`.",
238-
RemovedInAirflow3Warning,
239-
stacklevel=2,
240-
)
241-
return import_string("airflow.models.baseoperator.chain")(*args, **kwargs)
242-
243-
244-
def cross_downstream(*args, **kwargs):
245-
"""Use `airflow.models.baseoperator.cross_downstream`, this function is deprecated."""
246-
warnings.warn(
247-
"This function is deprecated. Please use `airflow.models.baseoperator.cross_downstream`.",
248-
RemovedInAirflow3Warning,
249-
stacklevel=2,
250-
)
251-
return import_string("airflow.models.baseoperator.cross_downstream")(*args, **kwargs)
252-
253-
254232
def build_airflow_url_with_query(query: dict[str, Any]) -> str:
255233
"""
256234
Build airflow url using base_url and default_view and provided query.

newsfragments/41520.significant.rst

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Removed deprecated methods in airflow/utils/helpers.py
2+
3+
Methods removed:
4+
* chain (Use ``airflow.models.baseoperator.chain``)
5+
* cross_downstream (Use ``airflow.models.baseoperator.cross_downstream``)

tests/system/providers/amazon/aws/example_bedrock_retrieve_and_generate.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535

3636
from airflow import DAG
3737
from airflow.decorators import task, task_group
38+
from airflow.models.baseoperator import chain
3839
from airflow.operators.empty import EmptyOperator
3940
from airflow.providers.amazon.aws.hooks.bedrock import BedrockAgentHook
4041
from airflow.providers.amazon.aws.hooks.opensearch_serverless import OpenSearchServerlessHook
@@ -58,7 +59,6 @@
5859
)
5960
from airflow.providers.amazon.aws.utils import get_botocore_version
6061
from airflow.utils.edgemodifier import Label
61-
from airflow.utils.helpers import chain
6262
from airflow.utils.trigger_rule import TriggerRule
6363
from tests.system.providers.amazon.aws.utils import SystemTestContextBuilder
6464

@@ -450,7 +450,7 @@ def delete_opensearch_policies(collection_name: str):
450450

451451
create_bucket = S3CreateBucketOperator(task_id="create_bucket", bucket_name=bucket_name)
452452

453-
create_opensearch_policies = create_opensearch_policies(
453+
opensearch_policies = create_opensearch_policies(
454454
bedrock_role_arn=test_context[ROLE_ARN_KEY],
455455
collection_name=vector_store_name,
456456
policy_name_suffix=env_id,
@@ -563,7 +563,7 @@ def delete_opensearch_policies(collection_name: str):
563563
# TEST SETUP
564564
test_context,
565565
create_bucket,
566-
create_opensearch_policies,
566+
opensearch_policies,
567567
collection,
568568
await_collection,
569569
create_vector_index(index_name=index_name, collection_id=collection, region=region_name),

0 commit comments

Comments
 (0)