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

Deprecate EmrContainerOperatorAsync #1393

Merged
merged 3 commits into from
Dec 25, 2023
Merged

Conversation

Lee-W
Copy link
Contributor

@Lee-W Lee-W commented Dec 21, 2023

What's changed

Deprecate EmrContainerOperatorAsync and fallback to EmrContainerOperator with deferrable=True

Why this change

The logic of EmrContainerOperatorAsync has been contributed back to OSS airflow as part of EmrContainerOperator

EmrContainerOperatorAsync

def execute(self, context: Context) -> None:
"""Defers trigger class to poll for state of the job run until it reaches a failure state or success state"""
if not poke(self, context):
self.defer(
timeout=timedelta(seconds=self.timeout),
trigger=EmrContainerSensorTrigger(
virtual_cluster_id=self.virtual_cluster_id,
job_id=self.job_id,
max_tries=self.max_retries,
aws_conn_id=self.aws_conn_id,
poll_interval=self.poll_interval,
),
method_name="execute_complete",
)
# Ignoring the override type check because the parent class specifies "context: Any" but specifying it as
# "context: Context" is accurate as it's more specific.
def execute_complete(self, context: Context, event: dict[str, str]) -> None: # type: ignore[override]
"""
Callback for when the trigger fires - returns immediately.
Relies on trigger to throw an exception, otherwise it assumes execution was
successful.
"""
if event:
if event["status"] == "error":
raise_error_or_skip_exception(self.soft_fail, event["message"])
self.log.info(event["message"])
return None

EmrContainerOperator

https://github.com/apache/airflow/blob/999b70178a1f5d891fd2c88af4831a4ba4c2cbc9/airflow/providers/amazon/aws/sensors/emr.py#L318-L346

@Lee-W Lee-W changed the title feat(amazon): deprecate EmrContainerOperatorAsync Deprecate EmrContainerOperatorAsync Dec 21, 2023
@Lee-W Lee-W force-pushed the deprecate-EmrContainerOperatorAsync branch 2 times, most recently from a8b5262 to 520dc28 Compare December 21, 2023 04:11
@Lee-W Lee-W marked this pull request as ready for review December 21, 2023 04:13
Copy link

codecov bot commented Dec 21, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (37f2d35) 98.53% compared to head (6671a06) 98.40%.
Report is 2 commits behind head on main.

❗ Current head 6671a06 differs from pull request most recent head 5f1789f. Consider uploading reports for the commit 5f1789f to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1393      +/-   ##
==========================================
- Coverage   98.53%   98.40%   -0.13%     
==========================================
  Files          91       91              
  Lines        5320     5268      -52     
==========================================
- Hits         5242     5184      -58     
- Misses         78       84       +6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@pankajkoti pankajkoti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor inline corrections to be addressed please before merging.

astronomer/providers/amazon/aws/operators/emr.py Outdated Show resolved Hide resolved
astronomer/providers/amazon/aws/operators/emr.py Outdated Show resolved Hide resolved
@Lee-W Lee-W force-pushed the deprecate-EmrContainerOperatorAsync branch from 422d119 to e021c33 Compare December 21, 2023 06:41
@Lee-W Lee-W force-pushed the deprecate-EmrContainerOperatorAsync branch from e021c33 to 67b4326 Compare December 21, 2023 06:42
@Lee-W Lee-W force-pushed the deprecate-EmrContainerOperatorAsync branch from 67b4326 to 6671a06 Compare December 21, 2023 06:44
@Lee-W Lee-W merged commit 60546e4 into main Dec 25, 2023
7 of 8 checks passed
@Lee-W Lee-W deleted the deprecate-EmrContainerOperatorAsync branch December 25, 2023 00:53
Lee-W added a commit that referenced this pull request Dec 25, 2023
Lee-W added a commit that referenced this pull request Dec 26, 2023
Lee-W added a commit that referenced this pull request Dec 26, 2023
* feat(amazon): deprecate EmrContainerOperatorAsync
* feat(amazon): remove EmrContainerOperatorTrigger
Lee-W added a commit that referenced this pull request Dec 28, 2023
* feat(amazon): deprecate EmrContainerOperatorAsync
* feat(amazon): remove EmrContainerOperatorTrigger
Lee-W added a commit that referenced this pull request Jan 10, 2024
* feat(amazon): deprecate EmrContainerOperatorAsync
* feat(amazon): remove EmrContainerOperatorTrigger
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants