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

feat: Implement GuScheduledEcsTask pattern #791

Merged
merged 17 commits into from
Sep 14, 2021

Conversation

philmcmahon
Copy link
Contributor

@philmcmahon philmcmahon commented Sep 13, 2021

What does this change?

This adds a new pattern to the cdk library - a fargate task that is run on a schedule using a step function.

The purpose of the step function is to make alarming/alerting easier if the task times out or fails.

I've written quite a bit of documentation within the code files explaining the different props of this task but shout if something doesn't make sense.

See here (private repo so shout if you need access) for some example code using this pattern. That branch is destined for mergification fairly soon.

Hopefully it makes sense for this to live here, otherwise I can dump it back in the lurch project

Does this change require changes to existing projects or CDK CLI?

No

Does this change require changes to the library documentation?

I have added documentation in comments to the task code - maybe I need to add it somewhere else?

How to test

This is being used already in the lurch CODE and soon to be PROD environments. I've added a basic test file copied from the GuScheduledLambda tests.

How can we measure success?

A team other than investigations uses this

Have we considered potential risks?

Is this a generic enough need? In theory yes - anyone wanting to do a scheduled thing that takes longer than the 15 minute lambda time out.

@philmcmahon philmcmahon requested a review from a team September 13, 2021 11:35
@philmcmahon philmcmahon force-pushed the jw-scheduled-ecs-task-attempt branch 2 times, most recently from 19e9c21 to 21c9905 Compare September 13, 2021 11:38
Copy link
Member

@akash1810 akash1810 left a comment

Choose a reason for hiding this comment

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

A few questions added.

Similar to #761, I'd be interested to see how these commits get parsed (#761 (comment)) and improve the docs afterwards.

src/patterns/scheduled-ecs-task.ts Outdated Show resolved Hide resolved
src/patterns/scheduled-ecs-task.test.ts Outdated Show resolved Hide resolved
src/patterns/scheduled-ecs-task.test.ts Outdated Show resolved Hide resolved
src/patterns/scheduled-ecs-task.ts Outdated Show resolved Hide resolved
src/patterns/scheduled-ecs-task.ts Show resolved Hide resolved
src/patterns/scheduled-ecs-task.ts Outdated Show resolved Hide resolved
src/patterns/scheduled-ecs-task.ts Outdated Show resolved Hide resolved
src/patterns/scheduled-ecs-task.ts Outdated Show resolved Hide resolved
src/patterns/scheduled-ecs-task.ts Outdated Show resolved Hide resolved
src/patterns/scheduled-ecs-task.ts Outdated Show resolved Hide resolved
@philmcmahon philmcmahon force-pushed the jw-scheduled-ecs-task-attempt branch from 991851b to cb6a6fb Compare September 13, 2021 14:20
@philmcmahon
Copy link
Contributor Author

philmcmahon commented Sep 13, 2021

@adamnfish we had a stab at some better tests - dropped the simple snapshot one and instead tested for a couple of things that we care about. It could be more thorough but I think this is a good start 8e8b3a9

src/patterns/scheduled-ecs-task.ts Outdated Show resolved Hide resolved
src/patterns/scheduled-ecs-task.ts Outdated Show resolved Hide resolved
Copy link
Member

@akash1810 akash1810 left a comment

Choose a reason for hiding this comment

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

The changes look great. Added a small comment around type guards. Once the build passes, happy to approve - the linter is currently failing 😢 we'd recommend configuring your IDE to run eslint and prettier on save.

@philmcmahon philmcmahon force-pushed the jw-scheduled-ecs-task-attempt branch from 25b2e7f to e970025 Compare September 14, 2021 09:55
@philmcmahon philmcmahon force-pushed the jw-scheduled-ecs-task-attempt branch from e970025 to f794458 Compare September 14, 2021 09:57
@philmcmahon
Copy link
Contributor Author

Looks like the build is happy now. I've attempted to shorten the commit history a bit too and added the relevant chore/fix tags

Copy link
Member

@akash1810 akash1810 left a comment

Choose a reason for hiding this comment

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

Amazing, thanks for the contribution!

@philmcmahon philmcmahon merged commit abff02d into main Sep 14, 2021
@philmcmahon philmcmahon deleted the jw-scheduled-ecs-task-attempt branch September 14, 2021 11:20
@github-actions
Copy link
Contributor

🎉 This PR is included in version 25.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

5 participants