o-nikolas commented on code in PR #71653:
URL: https://github.com/apache/airflow/pull/71653#discussion_r3884581926
##########
providers/amazon/src/airflow/providers/amazon/aws/triggers/sagemaker.py:
##########
@@ -108,6 +108,90 @@ def hook(self) -> AwsGenericHook:
config=self.botocore_config,
)
+ async def run(self) -> AsyncIterator[TriggerEvent]:
+ hook = self.hook()
+
+ async with await hook.get_async_conn() as conn:
+ waiter = hook.get_waiter(
+ self.waiter_name,
+ deferrable=True,
+ client=conn,
+ )
+
+ for _ in range(self.attempts):
+ try:
+ await waiter.wait(
+ **self.waiter_args,
+ WaiterConfig={"MaxAttempts": 1},
+ )
+ except WaiterError as error:
Review Comment:
We're also losing handling for other common errors the api can throw by
trying to hand roll a solution here instead of using the async_wait
ThrottlingError for example, how does this code handle that? Will it result in
the Trigger reporting the task as failing?
--
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]