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(stepfunctions-tasks): create scheduler #29458

Open
wants to merge 60 commits into
base: main
Choose a base branch
from

Conversation

badmintoncryer
Copy link
Contributor

@badmintoncryer badmintoncryer commented Mar 12, 2024

Issue # (if applicable)

Closes #29351.

Reason for this change

Although the creation of schedule task is supported, the AWS CDK currently lacks the capability to create these without a custom task definition.

Description of changes

I've introduced the EventBridgeSchedulerCreateScheduleTask class to address this gap.

The original issue discussed the need for both creating and updating schedules. However, to maintain focus and simplicity, this PR will only cover the creation aspect. A subsequent PR will be dedicated to schedule updates.

Description of how you validated changes

I have added both integ and unit tests.

Checklist


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

@github-actions github-actions bot added effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2 labels Mar 12, 2024
@aws-cdk-automation aws-cdk-automation requested a review from a team March 12, 2024 06:06
@github-actions github-actions bot added the star-contributor [Pilot] contributed between 25-49 PRs to the CDK label Mar 12, 2024
@badmintoncryer
Copy link
Contributor Author

@cshields236 Please wait for a while.

Copy link
Collaborator

@aws-cdk-automation aws-cdk-automation left a comment

Choose a reason for hiding this comment

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

The pull request linter has failed. See the aws-cdk-automation comment below for failure reasons. If you believe this pull request should receive an exemption, please comment and provide a justification.

A comment requesting an exemption should contain the text Exemption Request. Additionally, if clarification is needed add Clarification Request to a comment.

@aws-cdk-automation aws-cdk-automation dismissed their stale review March 14, 2024 01:28

✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.

@badmintoncryer badmintoncryer marked this pull request as ready for review March 14, 2024 01:43
@badmintoncryer badmintoncryer force-pushed the 29351-schedulerIntegration branch 2 times, most recently from 562fae8 to 6a21c6d Compare March 15, 2024 04:36
@aws-cdk-automation aws-cdk-automation added the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Mar 15, 2024
Copy link
Contributor

@lpizzinidev lpizzinidev left a comment

Choose a reason for hiding this comment

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

Thanks 👍 Left comments for adjustments

*
* @see https://docs.aws.amazon.com/scheduler/latest/UserGuide/schedule-types.html
*/
readonly scheduleExpression: string;
Copy link
Contributor

Choose a reason for hiding this comment

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

What about using a Schedule class similar to 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.

It's a really nice suggestion. Do you mean implementing the Schedule class in create-schedule.ts? Or importing this class directly?

Copy link
Contributor

Choose a reason for hiding this comment

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

I see that the class is declared in multiple packages already.
I think you can create it inside the aws-stepfunctions-tasks/lib package.

Copy link
Contributor Author

@badmintoncryer badmintoncryer Jul 4, 2024

Choose a reason for hiding this comment

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

I defined Schedule class in create-schedule.ts.

I also referred to this class, particularly the rate() method.
https://github.com/aws/aws-cdk/blob/main/packages/aws-cdk-lib/aws-events/lib/schedule.ts#L11

packages/aws-cdk-lib/aws-stepfunctions-tasks/README.md Outdated Show resolved Hide resolved
@aws-cdk-automation aws-cdk-automation removed the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Jun 12, 2024
Copy link
Contributor Author

@badmintoncryer badmintoncryer left a comment

Choose a reason for hiding this comment

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

Thank you for your review!! I've addressed your comments.
I have one question about implementation of Schedule class.

*
* @see https://docs.aws.amazon.com/scheduler/latest/UserGuide/managing-targets.html
*/
readonly target: string;
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 want to name this parameter as targetArn but it causes linter failure.

error: [awslint:props-no-arn-refs:aws-cdk-lib.aws_stepfunctions_tasks.EventBridgeSchedulerCreateScheduleTaskProps.targetArn] props must use strong types instead of attributes. props should not have "arn" suffix 

*
* @see https://docs.aws.amazon.com/scheduler/latest/UserGuide/schedule-types.html
*/
readonly scheduleExpression: string;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's a really nice suggestion. Do you mean implementing the Schedule class in create-schedule.ts? Or importing this class directly?

packages/aws-cdk-lib/aws-stepfunctions-tasks/README.md Outdated Show resolved Hide resolved
Copy link
Contributor

@lpizzinidev lpizzinidev left a comment

Choose a reason for hiding this comment

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

Thanks 👍 Left some comments for adjustments.
Sorry for the late review, I've been a bit busy recently.

badmintoncryer and others added 7 commits July 20, 2024 09:37
…cheduler/create-schedule.ts

Co-authored-by: Luca Pizzini <lpizzini7@gmail.com>
…cheduler/create-schedule.ts

Co-authored-by: Luca Pizzini <lpizzini7@gmail.com>
…cheduler/create-schedule.ts

Co-authored-by: Luca Pizzini <lpizzini7@gmail.com>
…cheduler/create-schedule.ts

Co-authored-by: Luca Pizzini <lpizzini7@gmail.com>
@badmintoncryer
Copy link
Contributor Author

@lpizzinidev Thanks always!! I've addressed your comments. There is no rush, so please feel free to review it whenever you have time.

Copy link
Contributor

@lpizzinidev lpizzinidev left a comment

Choose a reason for hiding this comment

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

Thanks 👍 Left suggestions for some final adjustments.

@aws-cdk-automation aws-cdk-automation added the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Jul 21, 2024
badmintoncryer and others added 4 commits July 22, 2024 09:21
…cheduler/create-schedule.ts

Co-authored-by: Luca Pizzini <lpizzini7@gmail.com>
…cheduler/create-schedule.ts

Co-authored-by: Luca Pizzini <lpizzini7@gmail.com>
…cheduler/create-schedule.ts

Co-authored-by: Luca Pizzini <lpizzini7@gmail.com>
@badmintoncryer
Copy link
Contributor Author

@lpizzinidev Thanks a lot!! I've updated my PR according to your suggestion😁

@paulhcsun paulhcsun self-assigned this Jul 29, 2024
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: 1de32c7
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2 pr/needs-maintainer-review This PR needs a review from a Core Team Member star-contributor [Pilot] contributed between 25-49 PRs to the CDK
Projects
None yet
Development

Successfully merging this pull request may close these issues.

(stepfunction-tasks): eventbridge scheduler create, update schedule
4 participants