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

Efficient deploy log fetching #1768

Merged
merged 9 commits into from Feb 12, 2020

Conversation

smatsumt
Copy link
Contributor

@smatsumt smatsumt commented Feb 1, 2020

Why is this change necessary?

This PR improves sam deploy inefficient log fetching. Current implementation fetches events repeatidly until deploy finished. And it fetches "all" log events for every fetches. It includes already shown events and old events before the current deployment starts.

So, when we update a stack in many times, sam-cli event showing becomes quite slow. And it takes a little bit longer time after actual stack deployment finished.

How does it address the issue?

The PR implementation skip older events and prevent to fetch all, old events.

What side effects does this change have?

I guess almost nothing. Maybe the number of API calls increases because it does not fetch all old events.

Checklist:

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

for event_items in response_iterator:
for event in event_items["StackEvents"]:
if event["EventId"] not in events and utc_to_timestamp(event["Timestamp"]) > time_stamp_marker:
events.add(event["EventId"])
latest_time_stamp_marker = max(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand the logic here, could you add a unit test to showcase this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the review!
I've added the unit test. Could you review it?

Shinji Matsumoto added 2 commits February 8, 2020 21:03
In past logic, if the stack is newly created, time_stamp_marker would never be updated.
@jfuss jfuss merged commit e1951c0 into aws:develop Feb 12, 2020
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.

None yet

3 participants