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

aws_batch_alpha: FargateComputeEnvironment compute_environment_name not being respected #25794

Closed
roketworks opened this issue May 31, 2023 · 3 comments · Fixed by #25944
Closed
Labels
@aws-cdk/aws-batch Related to AWS Batch bug This issue is a bug. effort/small Small work item – less than a day of effort good first issue Related to contributions. See CONTRIBUTING.md p1

Comments

@roketworks
Copy link
Contributor

Describe the bug

When creating a FargateComputeEnvironment using the construct and passing in compute_environment_name the resulting cloudformatation does not have the ComputeEnvironmentName property set.

Expected Behavior

ComputeEnvironmentName property set on the resulting AWS::Batch::ComputeEnvironment resource in the outputted CloudFormation.

Current Behavior

ComputeEnvironmentName property is not set on the resulting AWS::Batch::ComputeEnvironment resource in the outputted CloudFormation.

This only seems to affect the FargateComputeEnvironment construct and not others.

Reproduction Steps

# Resulting CloudFormation will not have ComputeEnvironmentName set
self.fargate_compute_env = batch.FargateComputeEnvironment(
    self, 'FargateComputeEnv',
    compute_environment_name='fargate',
    enabled=True,
    vpc=vpc,
)

# Resulting CloudFormation will have ComputeEnvironmentName set
self.gpu_compute_env = batch.ManagedEc2EcsComputeEnvironment(
    self, 'GPUComputeEnv',
    compute_environment_name='gpu',
    enabled=True,
    maxv_cpus=196,
    vpc=vpc,
    instance_types=[
        ec2.InstanceType.of(ec2.InstanceClass.G5, ec2.InstanceSize.XLARGE2),
        ec2.InstanceType.of(ec2.InstanceClass.G4DN, ec2.InstanceSize.XLARGE4)
    ],
)

Possible Solution

No response

Additional Information/Context

  FargateComputeEnv155F00A9:
    Type: AWS::Batch::ComputeEnvironment
    Properties:
      Type: managed
      ComputeResources:
        MaxvCpus: 256
        SecurityGroupIds:
          - Fn::GetAtt:
              - FargateComputeEnvSecurityGroup914E8A54
              - GroupId
        Subnets:
          - Ref: VpcIsolatedSubnet1SubnetE48C5737
          - Ref: VpcIsolatedSubnet2Subnet16364B91
        Type: FARGATE
        UpdateToLatestImageVersion: true
      ReplaceComputeEnvironment: false
      State: ENABLED
      UpdatePolicy: {}
    Metadata:
      aws:cdk:path: IdentificationTrainingInfra/FargateComputeEnv/Resource
.......
  TrainingComputeEnvEDCE302F:
    Type: AWS::Batch::ComputeEnvironment
    Properties:
      Type: managed
      ComputeEnvironmentName:training-gpu
      ComputeResources:
        AllocationStrategy: BEST_FIT_PROGRESSIVE
        InstanceRole:
          Fn::GetAtt:
            - TrainingComputeEnvInstanceProfile93AE79CA
            - Arn
        InstanceTypes:
          - g5.2xlarge
          - g4dn.4xlarge
          - optimal
        MaxvCpus: 196
        MinvCpus: 0
        SecurityGroupIds:
          - Fn::GetAtt:
              - TrainingComputeEnvSecurityGroup0C7AEB8B
              - GroupId
        Subnets:
          - Ref: VpcIsolatedSubnet1SubnetE48C5737
          - Ref: VpcIsolatedSubnet2Subnet16364B91
        Type: EC2
        UpdateToLatestImageVersion: true
      ReplaceComputeEnvironment: false
      State: ENABLED
      UpdatePolicy: {}
    Metadata:
      aws:cdk:path: IdentificationTrainingInfra/TrainingComputeEnv/Resource

CDK CLI Version

2.81.0

Framework Version

No response

Node.js Version

19.8.1

OS

Mac OS 12

Language

Python

Language Version

3.11

Other information

No response

@roketworks roketworks added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels May 31, 2023
@github-actions github-actions bot added the @aws-cdk/aws-batch Related to AWS Batch label May 31, 2023
@peterwoodworth
Copy link
Contributor

Thanks for reporting!

It looks like it's just missing this line

computeEnvironmentName: props.computeEnvironmentName,

Would need to add it here

const resource = new CfnComputeEnvironment(this, 'Resource', {
...baseManagedResourceProperties(this, subnetIds),
computeResources: {
...baseManagedResourceProperties(this, subnetIds).computeResources as CfnComputeEnvironment.ComputeResourcesProperty,
type: this.spot ? 'FARGATE_SPOT' : 'FARGATE',
},
});

@peterwoodworth peterwoodworth added good first issue Related to contributions. See CONTRIBUTING.md p1 effort/small Small work item – less than a day of effort and removed needs-triage This issue or PR still needs to be triaged. labels May 31, 2023
akshaypilankar added a commit to akshaypilankar/aws-cdk that referenced this issue Jun 1, 2023
…uteEnvironment aws#25794

Updated managed-compute-environment to reflect the fix made in FargateComputeEnvironment.
@akshaypilankar
Copy link
Contributor

akshaypilankar commented Jun 1, 2023

Hello @peterwoodworth @roketworks Please review and approve the above PR and assign the task to me.

Thank you

@mergify mergify bot closed this as completed in #25944 Jun 12, 2023
mergify bot pushed a commit that referenced this issue Jun 12, 2023
…nment (#25944)

computeEnvironmentName property was missing in FargateComputeEnvironment due to which ComputeEnvironmentName property set on the resulting AWS::Batch::ComputeEnvironment resource in the outputted CloudFormation.
Updated managed-compute-environment to reflect the fix made in FargateComputeEnvironment.

Closes #25794.
@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-batch Related to AWS Batch bug This issue is a bug. effort/small Small work item – less than a day of effort good first issue Related to contributions. See CONTRIBUTING.md p1
Projects
None yet
3 participants