Skip to content

Commit

Permalink
Resolving EMR deprecated warnings (#39743)
Browse files Browse the repository at this point in the history
  • Loading branch information
dirrao authored May 23, 2024
1 parent 57dab13 commit e565cea
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
24 changes: 13 additions & 11 deletions airflow/providers/amazon/aws/operators/emr.py
Original file line number Diff line number Diff line change
Expand Up @@ -742,10 +742,20 @@ def __init__(
waiter_max_attempts: int | None = None,
waiter_delay: int | None = None,
waiter_countdown: int | None = None,
waiter_check_interval_seconds: int = 60,
waiter_check_interval_seconds: int | None = None,
deferrable: bool = conf.getboolean("operators", "default_deferrable", fallback=False),
**kwargs: Any,
):
if waiter_check_interval_seconds:
warnings.warn(
"The parameter `waiter_check_interval_seconds` has been deprecated to "
"standardize naming conventions. Please `use waiter_delay instead`. In the "
"future this will default to None and defer to the waiter's default value.",
AirflowProviderDeprecationWarning,
stacklevel=2,
)
else:
waiter_check_interval_seconds = 60
if waiter_countdown:
warnings.warn(
"The parameter waiter_countdown has been deprecated to standardize "
Expand All @@ -757,23 +767,15 @@ def __init__(
# waiter_countdown defaults to never timing out, which is not supported
# by boto waiters, so we will set it here to "a very long time" for now.
waiter_max_attempts = (waiter_countdown or 999) // waiter_check_interval_seconds
if waiter_check_interval_seconds:
warnings.warn(
"The parameter waiter_check_interval_seconds has been deprecated to "
"standardize naming conventions. Please use waiter_delay instead. In the "
"future this will default to None and defer to the waiter's default value.",
AirflowProviderDeprecationWarning,
stacklevel=2,
)
waiter_delay = waiter_check_interval_seconds

super().__init__(**kwargs)
self.aws_conn_id = aws_conn_id
self.emr_conn_id = emr_conn_id
self.job_flow_overrides = job_flow_overrides or {}
self.region_name = region_name
self.wait_for_completion = wait_for_completion
self.waiter_max_attempts = waiter_max_attempts or 60
self.waiter_delay = waiter_delay or 30
self.waiter_delay = waiter_delay or waiter_check_interval_seconds or 60
self.deferrable = deferrable

@cached_property
Expand Down
1 change: 0 additions & 1 deletion tests/always/test_example_dags.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
# If the deprecation is postponed, the item should be added to this tuple,
# and a corresponding Issue should be created on GitHub.
"tests/system/providers/amazon/aws/example_ecs_fargate.py",
"tests/system/providers/amazon/aws/example_emr.py",
"tests/system/providers/amazon/aws/example_emr_notebook_execution.py",
"tests/system/providers/google/cloud/bigquery/example_bigquery_operations.py",
"tests/system/providers/google/cloud/bigquery/example_bigquery_sensors.py",
Expand Down

0 comments on commit e565cea

Please sign in to comment.