Skip to content

Instantly share code, notes, and snippets.

@filipeandre
Last active June 17, 2024 07:40
Show Gist options
  • Save filipeandre/c1f86c9d3b178b52383bd783088aaf48 to your computer and use it in GitHub Desktop.
Save filipeandre/c1f86c9d3b178b52383bd783088aaf48 to your computer and use it in GitHub Desktop.
Implementation of batch get builds boto3 waiter
import botocore.waiter
import botocore.session
batch_get_builds_model = botocore.waiter.WaiterModel({
"version": 2,
"waiters": {
"BuildSuccess": {
"delay": 5,
"operation": "BatchGetBuilds",
"maxAttempts": 60,
"description": "Wait until build is finished",
"acceptors": [
{
"state": "failure",
"matcher": "path",
"argument": "length(builds) != `1`",
"expected": True
},
{
"state": "retry",
"matcher": "path",
"argument": "Status",
"expected": "IN_PROGRESS"
},
{
"state": "failure",
"matcher": "path",
"argument": "builds[0].buildStatus",
"expected": "FAILED"
},
{
"state": "failure",
"matcher": "path",
"argument": "builds[0].buildStatus",
"expected": "FAULT"
},
{
"state": "failure",
"matcher": "path",
"argument": "builds[0].buildStatus",
"expected": "STOPPED"
},
{
"state": "failure",
"matcher": "path",
"argument": "builds[0].buildStatus",
"expected": "TIMED_OUT"
},
{
"state": "success",
"matcher": "path",
"argument": "builds[0].buildStatus",
"expected": "SUCCEEDED"
}
]
},
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment