-
Notifications
You must be signed in to change notification settings - Fork 4k
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
fix(batch): managed compute environment now properly works with compute resources and instanceRole has correct docstring and type definition #6549
Conversation
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Hi @andrestone, thanks so much for submitting this PR! You mentioned:
Can you provide some details as to what exactly was misinterpreted? And what is the behavioral change you are proposing? It's not that I disagree, I'm just looking for some more context to ease the review process and also provide more clarify to those seeing this PR that were not part of earlier discussions. It's great to references other data sources, but we also strive for each PR to contain just enough content so it can be reviewed on its own. Also, since our PR titles eventually end up in our release notes, we try making these title briefly explain what the expected result will be. Basically, instead of saying: fixing 'managed' compute environment, try formulating this as: 'managed' compute environment will now..., or something of that nature. You also noted that this PR adds launch template support and fixes some bugs. I would probably leave the 'bugs' out of the title and simply mention what was fixed in the PR description. If you want to be super diligent, you can open separate issues on those bugs and add In the meantime i will start digging into this PR :) Thanks again! |
Sure thing, @iliapolo! I'll rewrite the PR description and title ASAP, since this is a fundamental flaw in the implementation. To be honest, these tests deserve a full review, but I opted to simply tweaking them into passing in order to quickly fix it. What do you think about fixing the tests in another issue / PR? Thanks for reviewing. PS.: there's more to it, but basically what the current behaviour does is to require compute resources specification when it shouldn't and deny specifying the compute resources when they're needed. Tests were passing because the L0 construct was receiving the opposite boolean value for the "managed" property in the compute environment. |
Hey @andrestone
Do you have specific things you think are missing from the tests? Or is it just a general need for review? I don't mind waiting to improve the tests, but i wouldn't want us to ship this code without a critical test.
Got it, thanks 👍 One other thing, after going over the code, i feel it won't be a major effort to separate the launch template support to its own PR. What do you think? This will make things much clearer because its actually a new feature in the system and we want it to appear under |
@andrestone We should also mention in the description that this PR fixes #6590 |
Hello @iliapolo,
I didn't have the time to take a closer look at the tests, but they felt a bit loose while I was tweaking them. The integration test felt ok tho.
Ok, I'll do it. Thanks again for reviewing. PS.: Lunch time! I'll go over the other questions when I get back. |
@andrestone Enjoy your lunch :) |
…upport to a different pr
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
We just encountered the same issue while building an MVP for our new product. Thanks for working on it! |
@andrestone looks great! Also appreciate you splitting the launch template PR 👍 Ok, just one final thing regarding the PR description. To ensure that the final commit message will contain the necessary details, we either require a squash commit, or, which i personally like better, use special markdown headers in the PR description. Basically, the PR description should include the following: Commit Messagefix(batch): managed compute environment now properly works with compute resources and instanceRole has correct docstring and type definition (#6549) {optional-extended-commit-message}
BREAKING CHANGE: the End Commit MessageThe content between these two headers is then picked up by the mergify bot who does our merges for us. As an example, have a look at this PR, which generated this commit message Thanks for bearing with me! :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just the comment about the PR description
Hello! I tried to edit as you said. Thanks again for reviewing. |
Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
This PR breaks the |
@andrestone see my #6615 (comment). @ayush987goyal how did you discover this? just your usage? I'm wondering why you said the integration tests are failing, to make sure we didn't miss anything. |
@iliapolo I am creating a sfn-task to run a batch job #6396 |
@ayush987goyal Got it, thanks. This use-case will now be covered after the PR for #6396 |
…te resources and instanceRole has correct docstring and type definition (#6549)
…te resources and instanceRole has correct docstring and type definition (aws#6549)
Commit Message
fix(batch): managed compute environment now properly works with compute resources and instanceRole has correct docstring and type definition (#6549)
"Managed" vs "Unmanaged" compute environments
Current implementation was built based on a misinterpretation of the "Managed Compute Environment". The
ComputeEnvironment
class was originally designed assuming that a "managed" compute environment wouldn't needComputeResource
specifications, since it was a "managed" environment.However, as described in the documentation, a "managed" compute environment requires the
ComputeResources
specification in order to automatically provision your host instances, according to yourAllocationStrategy
. The "unmanaged" compute environment, in turn, won't deal with thecomputeResources
property and launching the necessary compute instances inside the linked ECS cluster is a manual task.Tests were passing because of inverted logic on this line.
ComputeResource instanceRole property
In the current implementation, the instanceRole property is of type
iam.Role
but the service actually requires an Instance Profile (in this case "instance" refers to the underlying EC2 resources) associated with a Role that has theAmazonEC2ContainerServiceforEC2Role
managed policy attached. The property is optional because the default behaviour is to create one. Moreover, a default Role and an Instance Profile are created at first console experience on the region, with the nameecsInstanceRole
. This PR allows you to easily refer to this existing instance profile (or any other that has the same policy), if you don't want to create new Instance Profile and a new Instance Role, by simply passing the profile name.BREAKING CHANGE: the
allocationStrategy
property was moved fromComputeEnvironmentProps
to theComputeResources
interface, which is where it semantically belongs.End Commit Message
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license