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 S3KeysUnchangedSensorAsync #1392

Merged
merged 3 commits into from
Dec 21, 2023
Merged

Conversation

Lee-W
Copy link
Contributor

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

What's changed

Deprecate S3KeysUnchangedSensorAsync and fallback to S3KeysUnchangedSensor with deferrable=True

Why this change

The logic of S3KeysUnchangedSensorAsync has been contributed back to OSS airflow as part of S3KeysUnchangedSensor

S3KeysUnchangedSensorAsync

def execute(self, context: Context) -> None:
"""Defers Trigger class to check for changes in the number of objects at prefix in AWS S3"""
if not poke(self, context):
self.defer(
timeout=timedelta(seconds=self.timeout),
trigger=S3KeysUnchangedTrigger(
bucket_name=self.bucket_name,
prefix=self.prefix,
inactivity_period=self.inactivity_period,
min_objects=self.min_objects,
previous_objects=self.previous_objects,
inactivity_seconds=self.inactivity_seconds,
allow_delete=self.allow_delete,
aws_conn_id=self.aws_conn_id,
verify=self.verify,
last_activity_time=self.last_activity_time,
),
method_name="execute_complete",
)
def execute_complete(self, context: Context, event: Any = None) -> None:
"""
Callback for when the trigger fires - returns immediately.
Relies on trigger to throw an exception, otherwise it assumes execution was
successful.
"""
if event["status"] == "error":
raise_error_or_skip_exception(self.soft_fail, event["message"])
return None

S3KeysUnchangedSensor

https://github.com/apache/airflow/blob/999b70178a1f5d891fd2c88af4831a4ba4c2cbc9/airflow/providers/amazon/aws/sensors/s3.py#L340-L374

@Lee-W Lee-W changed the title feat(amazon): deprecate S3KeysUnchangedSensorAsync Deprecate S3KeysUnchangedSensorAsync Dec 21, 2023
@Lee-W Lee-W force-pushed the deprecate-S3KeysUnchangedSensorAsync branch from 38d2a89 to 841a514 Compare December 21, 2023 04:02
@Lee-W Lee-W force-pushed the deprecate-S3KeysUnchangedSensorAsync branch from 40f2573 to ce595c6 Compare December 21, 2023 04:12
@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 (6781996) 98.57% compared to head (1f3677a) 98.55%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1392      +/-   ##
==========================================
- Coverage   98.57%   98.55%   -0.02%     
==========================================
  Files          91       91              
  Lines        5460     5416      -44     
==========================================
- Hits         5382     5338      -44     
  Misses         78       78              

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

@Lee-W Lee-W merged commit d6cbd8e into main Dec 21, 2023
11 checks passed
@Lee-W Lee-W deleted the deprecate-S3KeysUnchangedSensorAsync branch December 21, 2023 06:36
@phanikumv
Copy link
Collaborator

This PR is breaking our integration DAGs , @Lee-W to take a look

@pankajkoti
Copy link
Collaborator

It maybe an issue with OSS sensor, will leave it to Wei to check once. If it’s an upstream issue, I would suggest reverting this PR for the time being until a new OSS amazon provider including the fix is released.

Lee-W added a commit that referenced this pull request Dec 22, 2023
Lee-W added a commit that referenced this pull request Dec 22, 2023
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.

3 participants