Skip to content
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

Merged
merged 1 commit into from
Sep 13, 2017

Conversation

joguSD
Copy link
Contributor

@joguSD joguSD commented Sep 8, 2017

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 in Delay so that waiters don't prematurely fail.

Closes #2761

try:
waiter.wait(ChangeSetName=changeset_id, StackName=stack_name)
waiter.wait(ChangeSetName=changeset_id, StackName=stack_name,
WaiterConfig=waiter_config)
Copy link
Member

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,
Copy link
Member

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

Copy link
Contributor Author

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.

Copy link
Contributor

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)?

Copy link
Contributor Author

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.

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.

Copy link
Contributor

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-io
Copy link

codecov-io commented Sep 8, 2017

Codecov Report

Merging #2816 into develop will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff            @@
##           develop    #2816   +/-   ##
========================================
  Coverage    95.58%   95.58%           
========================================
  Files          151      151           
  Lines        11853    11853           
========================================
  Hits         11330    11330           
  Misses         523      523
Impacted Files Coverage Δ
awscli/customizations/cloudformation/deployer.py 96.29% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1cdb9f9...a3fdac6. Read the comment docs.

Copy link
Contributor

@kyleknap kyleknap left a 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 }
Copy link
Contributor

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,
Copy link
Contributor

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)?

Copy link
Contributor

@kyleknap kyleknap left a 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.

@joguSD joguSD merged commit bb92a40 into aws:develop Sep 13, 2017
thoward-godaddy pushed a commit to thoward-godaddy/aws-cli that referenced this pull request Feb 12, 2022
* Updated Deprecated compile to implementation

* Updated Tabs to Spaces

* Updated for Kotlin

* Updated More Tabs to Spaces
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

aws cloudformation deploy command could not wait stack create/update more than 10 minutes
4 participants