ramitkataria commented on code in PR #76646:
URL: https://github.com/apache/airflow/pull/76646#discussion_r4534818280
##########
providers/amazon/src/airflow/providers/amazon/aws/operators/bedrock.py:
##########
@@ -1547,8 +1574,18 @@ def execute(self, context: Context) -> str:
}
)
response = self.hook.conn.create_guardrail_version(**kwargs)
+ guardrail_id = response["guardrailId"]
version = response["version"]
- self.log.info("Guardrail %s version %s created.",
response["guardrailId"], version)
+ self.log.info("Guardrail %s version %s created.", guardrail_id,
version)
+
+ if self.wait_for_completion:
+ self.log.info("Waiting for guardrail %s to be ready.",
guardrail_id)
+ self.hook.get_waiter("guardrail_ready").wait(
+ guardrailIdentifier=guardrail_id,
+ guardrailVersion="DRAFT",
+ WaiterConfig={"Delay": self.waiter_delay, "MaxAttempts":
self.waiter_max_attempts},
Review Comment:
Good question, I hadn't confirmed it, but just had an agent run a test: it
polled both versions right after `CreateGuardrailVersion` returned (3 runs,
us-west-2):
- first read: DRAFT is `VERSIONING`, version 1 is `READY`
- next read, 213 to 261 ms later: both `READY`
The numbered version was `READY` on the first read every time, so DRAFT is
the one to wait on. A delete sent immediately after versioning still succeeded
in the 3 runs where I tried it, which fits the failure being intermittent.
Since the transition is that short, I also lowered the default
`waiter_delay` from 5 to 2 seconds and raised `waiter_max_attempts` to 60 to
keep the 2 minute cap
--
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]