uranusjr commented on code in PR #50791:
URL: https://github.com/apache/airflow/pull/50791#discussion_r2101472720
##########
providers/amazon/src/airflow/providers/amazon/aws/triggers/s3.py:
##########
@@ -123,6 +121,132 @@ async def run(self) -> AsyncIterator[TriggerEvent]:
yield TriggerEvent({"status": "error", "message": str(e)})
+class S3KeyUpsertedTrigger(BaseEventTrigger):
+ """
+ S3KeyUpsertedTrigger is fired as a deferred class with params to run the
task in the trigger worker when
+ a certain key in an S3 object is changed.
+
+ :param fail_if_missing: if True and key does not exist, an exception will
be raised
+ """
+
+ def __init__(
+ self,
+ bucket_name: str,
+ bucket_key: str,
+ wildcard_match: bool = False,
+ aws_conn_id: str | None = "aws_default",
+ from_datetime: str | datetime | None = None,
+ poke_interval: float = 5.0,
+ use_regex: bool = False,
+ region_name: str | None = None,
+ verify: bool | str | None = None,
+ botocore_config: dict | None = None,
+ fail_on_missing: bool = False, # TODO: Probably should get removed?
+ **kwargs
+ ):
+ # TODO: Add validation for the bucket_name and bucket_key
+ # TODO: Add use_regex and should_check_fn
+ self.bucket_name = bucket_name
+ self.bucket_key = bucket_key
+ self.wildcard_match = wildcard_match
+ self.aws_conn_id = aws_conn_id
+ self.poke_interval = poke_interval
+ self.use_regex = use_regex # TODO: Check this out
+ self.region_name = region_name
+ self.verify = verify
+ self.botocore_config = botocore_config
+ self.fail_on_missing = fail_on_missing
+
+ self.from_datetime = datetime.fromisoformat(from_datetime) \
+ if isinstance(from_datetime, str) \
+ else from_datetime
Review Comment:
Supporting str seems like an unnecessary feature to me. Users can do it
themselves.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]