-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Switch Cloud Formation waiters to WaiterConfig #2816
Conversation
try: | ||
waiter.wait(ChangeSetName=changeset_id, StackName=stack_name) | ||
waiter.wait(ChangeSetName=changeset_id, StackName=stack_name, | ||
WaiterConfig=waiter_config) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be aligned with ChangeSetName
waiter.config.delay = 5 | ||
waiter_config = { | ||
'Delay': 5, | ||
'MaxAttempts': 720, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 hour seems like a long time
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I set it to one hour to match the default waiter behavior as documented.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah the 720
is a bit concerning, given a typical waiter is an order of magnitude smaller (i.e. 30
or 45
). However, it is not too bad given the pricing model of CloudFormation where it should not cost money to be making these extra calls. Also there is not really any documentation on request rate limits, so we should be fine there as well. Out of curiosity, what was the previous total time waited (i.e. delay * max_attempts)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All three waiters used in this file (change_set_create_complete
, stack_create_complete
, and stack_update_complete
) all have a default delay of 30 seconds with a max attempts of 120.
I picked 720 to compensate for reducing the delay so that it will still wait 1 hour.
The original commit of this command used the default waiter behavior.
aws-cli/awscli/customizations/cloudformation/deployer.py
Lines 159 to 168 in 991e09e
if changeset_type == "CREATE": | |
waiter = self._client.get_waiter("stack_create_complete") | |
elif changeset_type == "UPDATE": | |
waiter = self._client.get_waiter("stack_update_complete") | |
else: | |
raise RuntimeError("Invalid changeset type {0}" | |
.format(changeset_type)) | |
try: | |
waiter.wait(StackName=stack_name) |
This was later reduced to 5 seconds, thus reducing the total time to wait by a factor of 6.
The change_set_create_complete
waiter started at a delay of 10 and the default max attempts of 120. All waiters were changed to a delay of 5 in the same commit. We haven't had any issue reports on this waiter as far as I know, so I didn't increase the max attempts there. Though the total time to wait here was cut in half.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright given that explanation and since the max_attempts
was already set at 120
, I am less concerned about increasing this.
Codecov Report
@@ Coverage Diff @@
## develop #2816 +/- ##
========================================
Coverage 95.58% 95.58%
========================================
Files 151 151
Lines 11853 11853
========================================
Hits 11330 11330
Misses 523 523
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine. Just had a couple of comments/questions.
@@ -132,9 +132,10 @@ def wait_for_changeset(self, changeset_id, stack_name): | |||
# Wait for changeset to be created | |||
waiter = self._client.get_waiter("change_set_create_complete") | |||
# Poll every 5 seconds. Changeset creation should be fast | |||
waiter.config.delay = 5 | |||
waiter_config = { 'Delay': 5 } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This goes against PEP8. Make sure to remove the space before and after the closing and start brackets respectively.
waiter.config.delay = 5 | ||
waiter_config = { | ||
'Delay': 5, | ||
'MaxAttempts': 720, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah the 720
is a bit concerning, given a typical waiter is an order of magnitude smaller (i.e. 30
or 45
). However, it is not too bad given the pricing model of CloudFormation where it should not cost money to be making these extra calls. Also there is not really any documentation on request rate limits, so we should be fine there as well. Out of curiosity, what was the previous total time waited (i.e. delay * max_attempts)?
9deebc3
to
df57e5d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚢 once the travis job passes.
df57e5d
to
a3fdac6
Compare
* Updated Deprecated compile to implementation * Updated Tabs to Spaces * Updated for Kotlin * Updated More Tabs to Spaces
This switches the Cloud Formation waiter configuration to use the new interface in botocore.
This also fixes #2754 by updating the
MaxAttempts
to compensate for the reduction inDelay
so that waiters don't prematurely fail.Closes #2761