Skip to content

Conversation

@rantoniuk
Copy link
Contributor

@rantoniuk rantoniuk commented Jun 3, 2025

Issue # (if applicable)

Closes #33505

Reason for this change

The Ec2TaskDefinition should not pass the @deprecated props.inferenceAccelerators property if it's unset or empty, because this results in showing deprecation notices in the console.
See this comment.

Description of changes

Do not rely only on passing the props, but check if the array actually contains any elements.

Describe any new or updated permissions being added

Description of how you validated changes

Cannot test by hand due to #34610.
UPDATE: manually tested in a production CDK stack. Result as expected, warnings are not shown during cdk diff.

Checklist


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

@aws-cdk-automation aws-cdk-automation requested a review from a team June 3, 2025 15:40
@github-actions github-actions bot added beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK bug This issue is a bug. p2 labels Jun 3, 2025
@rantoniuk rantoniuk force-pushed the 33505-inferenceAccelerators branch from 636d2c4 to 6669f97 Compare June 3, 2025 15:41
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.

(This review is outdated)

@rantoniuk rantoniuk changed the title rebase needed fix: check if inferenceAccellerators has any elements Jun 3, 2025
@rantoniuk
Copy link
Contributor Author

Clarification Request: I don't see any case like this being tested in packages/aws-cdk-lib/aws-ecs/test/task-definition.test.ts and I think this is a cosmetic change to how the condition is evaluated.

I'm happy to add a test if required but please suggest the correct place and approach.

@aws-cdk-automation aws-cdk-automation added the pr/reviewer-clarification-requested The contributor has requested clarification on feedback, a failing build, or a failing PR Linter run label Jun 3, 2025
@rantoniuk rantoniuk marked this pull request as ready for review June 4, 2025 12:54
@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 Jun 4, 2025
@leonmk-aws leonmk-aws self-assigned this Jun 4, 2025
@rantoniuk rantoniuk force-pushed the 33505-inferenceAccelerators branch from 6669f97 to 191fcd4 Compare June 4, 2025 19:58
@rantoniuk
Copy link
Contributor Author

@leonmk-aws any thoughts?

@leonmk-aws
Copy link
Contributor

Thank you for your contribution, I have looked at this PR, unfortunately I don't believe it will close the issue that is linked.
Here is my reasoning:
The value of the optional list of inference accelerators props.inferenceAccelerator is undefined when not specified, which means that the addInferenceAccelerator is never called because of the conditional check:

if (props.inferenceAccelerators) {
props.inferenceAccelerators.forEach(ia => this.addInferenceAccelerator(ia));
}

I also tried to see if the fix was working by pulling your change in my repo, and using the the reproduction stack posted in the issue thread, I had the same warning without and with the changes.
I am not sure how you validated that the changes were working in your setup, here is how I did it:

  • First compile the repo without your changes, use the linker script to link it to a fresh cdk app containing the reproduction stack linked above, run cdk list (or any cdk command like cdk synth, note that you don't need to deploy the stack for the warning to appear), the warning should be printed in the console.
  • In a second time, make your changes to the repo and rebuild it, in the same cdk app you used in step 1, re-run the same command, if the changes are working the warning should have disappeared.

@leonmk-aws leonmk-aws added the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Jun 10, 2025
@github-actions
Copy link
Contributor

This PR has not received a response in a while. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.

@github-actions github-actions bot added the closing-soon This issue will automatically close in 4 days unless further comments are made. label Jun 10, 2025
@rantoniuk
Copy link
Contributor Author

Hold your horses gh-bot, I will take a look at this this week

@github-actions github-actions bot removed closing-soon This issue will automatically close in 4 days unless further comments are made. response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. labels Jun 10, 2025
Copy link
Contributor

@leonmk-aws leonmk-aws left a comment

Choose a reason for hiding this comment

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

@rantoniuk Did you get time to look at it ? Mainly commenting on this to add the Changes Requested Github status and seeing if my explanation are enough, we are not in a hurry here

@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 17, 2025
@rantoniuk
Copy link
Contributor Author

rantoniuk commented Jun 18, 2025

I can confirm I can reproduce it using the small stack but I'm sure that it worked for my prod stack (but it doesn't now), very weird.

I see one big difference between the two, ES2022 vs ES2020 so I had to juggle the tsconfig settings a bit.
I'll try to find the root cause, appreciate it!

@rantoniuk rantoniuk force-pushed the 33505-inferenceAccelerators branch from 191fcd4 to 3b612c8 Compare June 18, 2025 23:54
@rantoniuk rantoniuk changed the title fix: check if inferenceAccellerators has any elements fix: don't use inferenceAccellerators in the constructors if not needed Jun 18, 2025
@rantoniuk rantoniuk requested a review from leonmk-aws June 19, 2025 00:09
@rantoniuk
Copy link
Contributor Author

@leonmk-aws that should do it - I checked this with both, the sample app and my prod stack.

@rantoniuk
Copy link
Contributor Author

I see some checks have failed but at first glance it doesn't look they are related to my change?

Copy link
Contributor

@leonmk-aws leonmk-aws 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 finding the issue, I added some comments. Regarding the failing checks I believe it is because the branch is out-of-date, you can rebase before making the changes I added in the comments and we'll see if that fixes the issue.

@rantoniuk rantoniuk force-pushed the 33505-inferenceAccelerators branch from 3b612c8 to d4406eb Compare June 20, 2025 12:04
@rantoniuk rantoniuk requested a review from leonmk-aws June 20, 2025 13:40
@rantoniuk rantoniuk requested a review from leonmk-aws June 20, 2025 16:34
@rantoniuk rantoniuk changed the title fix: don't use inferenceAccellerators in the constructors if not needed fix(ec2): don't use inferenceAccellerators in the constructors if not needed Jun 20, 2025
Copy link
Contributor

@leonmk-aws leonmk-aws 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 the fix, approved

@rantoniuk
Copy link
Contributor Author

@leonmk-aws is it still waiting for Exemption Request?

@aws-cdk-automation aws-cdk-automation added the pr-linter/exemption-requested The contributor has requested an exemption to the PR Linter feedback. label Jun 23, 2025
@leonmk-aws leonmk-aws added pr-linter/exempt-test The PR linter will not require test changes pr-linter/exempt-integ-test The PR linter will not require integ test changes labels Jun 23, 2025
@aws-cdk-automation aws-cdk-automation dismissed their stale review June 23, 2025 14:38

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

@mergify
Copy link
Contributor

mergify bot commented Jun 23, 2025

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

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

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

@mergify
Copy link
Contributor

mergify bot commented Jun 23, 2025

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify mergify bot merged commit 054c6c5 into aws:main Jun 23, 2025
17 checks passed
@github-actions
Copy link
Contributor

Comments on closed issues and PRs are hard for our team to see.
If you need help, please open a new issue that references this one.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 23, 2025
@rantoniuk rantoniuk deleted the 33505-inferenceAccelerators branch June 24, 2025 13:22
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK bug This issue is a bug. p2 pr/reviewer-clarification-requested The contributor has requested clarification on feedback, a failing build, or a failing PR Linter run pr-linter/exempt-integ-test The PR linter will not require integ test changes pr-linter/exempt-test The PR linter will not require test changes pr-linter/exemption-requested The contributor has requested an exemption to the PR Linter feedback.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

aws-ecs: aws-cdk-lib.aws_ecs.TaskDefinitionProps#inferenceAccelerators

3 participants