Class: AWSCDK::Batch::ManagedEC2ComputeEnvironmentProps
- Inherits:
-
ManagedComputeEnvironmentProps
- Object
- ManagedComputeEnvironmentProps
- AWSCDK::Batch::ManagedEC2ComputeEnvironmentProps
- Defined in:
- batch/managed_ec2_compute_environment_props.rb
Overview
Props for a ManagedEc2ComputeEnvironment.
Direct Known Subclasses
ManagedEC2ECSComputeEnvironmentProps, ManagedEC2EKSComputeEnvironmentProps
Instance Attribute Summary collapse
-
#compute_environment_name ⇒ String?
readonly
The name of the ComputeEnvironment.
-
#enabled ⇒ Boolean?
readonly
Whether or not this ComputeEnvironment can accept jobs from a Queue.
-
#instance_classes ⇒ Array<AWSCDK::EC2::InstanceClass>?
readonly
The instance classes that this Compute Environment can launch.
-
#instance_types ⇒ Array<AWSCDK::EC2::InstanceType>?
readonly
The instance types that this Compute Environment can launch.
-
#maxv_cpus ⇒ Numeric?
readonly
The maximum vCpus this
ManagedComputeEnvironmentcan scale up to. -
#replace_compute_environment ⇒ Boolean?
readonly
Specifies whether this Compute Environment is replaced if an update is made that requires replacing its instances.
-
#security_groups ⇒ Array<AWSCDK::EC2::ISecurityGroup>?
readonly
The security groups this Compute Environment will launch instances in.
-
#service_role ⇒ AWSCDK::IAM::IRole?
readonly
The role Batch uses to perform actions on your behalf in your account, such as provision instances to run your jobs.
-
#spot ⇒ Boolean?
readonly
Whether or not to use spot instances.
-
#terminate_on_update ⇒ Boolean?
readonly
Whether or not any running jobs will be immediately terminated when an infrastructure update occurs.
-
#update_timeout ⇒ AWSCDK::Duration?
readonly
Only meaningful if
terminateOnUpdateisfalse. -
#update_to_latest_image_version ⇒ Boolean?
readonly
Whether or not the AMI is updated to the latest one supported by Batch when an infrastructure update occurs.
-
#vpc ⇒ AWSCDK::EC2::IVPC
readonly
VPC in which this Compute Environment will launch Instances.
-
#vpc_subnets ⇒ AWSCDK::EC2::SubnetSelection?
readonly
The VPC Subnets this Compute Environment will launch instances in.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(compute_environment_name: nil, enabled: nil, service_role: nil, vpc:, maxv_cpus: nil, replace_compute_environment: nil, security_groups: nil, spot: nil, terminate_on_update: nil, update_timeout: nil, update_to_latest_image_version: nil, vpc_subnets: nil, instance_classes: nil, instance_types: nil) ⇒ ManagedEC2ComputeEnvironmentProps
constructor
A new instance of ManagedEC2ComputeEnvironmentProps.
- #to_jsii ⇒ Object
Constructor Details
#initialize(compute_environment_name: nil, enabled: nil, service_role: nil, vpc:, maxv_cpus: nil, replace_compute_environment: nil, security_groups: nil, spot: nil, terminate_on_update: nil, update_timeout: nil, update_to_latest_image_version: nil, vpc_subnets: nil, instance_classes: nil, instance_types: nil) ⇒ ManagedEC2ComputeEnvironmentProps
Returns a new instance of ManagedEC2ComputeEnvironmentProps.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'batch/managed_ec2_compute_environment_props.rb', line 21 def initialize(compute_environment_name: nil, enabled: nil, service_role: nil, vpc:, maxv_cpus: nil, replace_compute_environment: nil, security_groups: nil, spot: nil, terminate_on_update: nil, update_timeout: nil, update_to_latest_image_version: nil, vpc_subnets: nil, instance_classes: nil, instance_types: nil) @compute_environment_name = compute_environment_name Jsii::Type.check_type(@compute_environment_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "computeEnvironmentName") unless @compute_environment_name.nil? @enabled = enabled Jsii::Type.check_type(@enabled, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "enabled") unless @enabled.nil? @service_role = service_role Jsii::Type.check_type(@service_role, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklSb2xlIn0=")), "serviceRole") unless @service_role.nil? @vpc = vpc Jsii::Type.check_type(@vpc, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLklWcGMifQ==")), "vpc") @maxv_cpus = maxv_cpus Jsii::Type.check_type(@maxv_cpus, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "maxvCpus") unless @maxv_cpus.nil? @replace_compute_environment = replace_compute_environment Jsii::Type.check_type(@replace_compute_environment, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "replaceComputeEnvironment") unless @replace_compute_environment.nil? @security_groups = security_groups Jsii::Type.check_type(@security_groups, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19lYzIuSVNlY3VyaXR5R3JvdXAifSwia2luZCI6ImFycmF5In19")), "securityGroups") unless @security_groups.nil? @spot = spot Jsii::Type.check_type(@spot, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "spot") unless @spot.nil? @terminate_on_update = terminate_on_update Jsii::Type.check_type(@terminate_on_update, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "terminateOnUpdate") unless @terminate_on_update.nil? @update_timeout = update_timeout Jsii::Type.check_type(@update_timeout, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5EdXJhdGlvbiJ9")), "updateTimeout") unless @update_timeout.nil? @update_to_latest_image_version = update_to_latest_image_version Jsii::Type.check_type(@update_to_latest_image_version, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "updateToLatestImageVersion") unless @update_to_latest_image_version.nil? @vpc_subnets = vpc_subnets.is_a?(Hash) ? ::AWSCDK::EC2::SubnetSelection.new(**vpc_subnets.transform_keys(&:to_sym)) : vpc_subnets Jsii::Type.check_type(@vpc_subnets, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLlN1Ym5ldFNlbGVjdGlvbiJ9")), "vpcSubnets") unless @vpc_subnets.nil? @instance_classes = instance_classes Jsii::Type.check_type(@instance_classes, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19lYzIuSW5zdGFuY2VDbGFzcyJ9LCJraW5kIjoiYXJyYXkifX0=")), "instanceClasses") unless @instance_classes.nil? @instance_types = instance_types Jsii::Type.check_type(@instance_types, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19lYzIuSW5zdGFuY2VUeXBlIn0sImtpbmQiOiJhcnJheSJ9fQ==")), "instanceTypes") unless @instance_types.nil? end |
Instance Attribute Details
#compute_environment_name ⇒ String? (readonly)
Default: - generated by CloudFormation
The name of the ComputeEnvironment.
56 57 58 |
# File 'batch/managed_ec2_compute_environment_props.rb', line 56 def compute_environment_name @compute_environment_name end |
#enabled ⇒ Boolean? (readonly)
Default: true
Whether or not this ComputeEnvironment can accept jobs from a Queue.
Enabled ComputeEnvironments can accept jobs from a Queue and can scale instances up or down. Disabled ComputeEnvironments cannot accept jobs from a Queue or scale instances up or down.
If you change a ComputeEnvironment from enabled to disabled while it is executing jobs,
Jobs in the STARTED or RUNNING states will not
be interrupted. As jobs complete, the ComputeEnvironment will scale instances down to minv_cpus.
To ensure you aren't billed for unused capacity, set minv_cpus to 0.
72 73 74 |
# File 'batch/managed_ec2_compute_environment_props.rb', line 72 def enabled @enabled end |
#instance_classes ⇒ Array<AWSCDK::EC2::InstanceClass>? (readonly)
Default: - the instances Batch considers will be used (currently C4, M4, and R4)
The instance classes that this Compute Environment can launch.
Which one is chosen depends on the AllocationStrategy used.
Batch will automatically choose the instance size.
166 167 168 |
# File 'batch/managed_ec2_compute_environment_props.rb', line 166 def instance_classes @instance_classes end |
#instance_types ⇒ Array<AWSCDK::EC2::InstanceType>? (readonly)
Default: - the instances Batch considers will be used (currently C4, M4, and R4)
The instance types that this Compute Environment can launch.
Which one is chosen depends on the AllocationStrategy used.
173 174 175 |
# File 'batch/managed_ec2_compute_environment_props.rb', line 173 def instance_types @instance_types end |
#maxv_cpus ⇒ Numeric? (readonly)
Default: 256
The maximum vCpus this ManagedComputeEnvironment can scale up to. Each vCPU is equivalent to 1024 CPU shares.
Note: if this Compute Environment uses EC2 resources (not Fargate) with either AllocationStrategy.BEST_FIT_PROGRESSIVE or
AllocationStrategy.SPOT_CAPACITY_OPTIMIZED, or AllocationStrategy.BEST_FIT with Spot instances,
The scheduler may exceed this number by at most one of the instances specified in instance_types
or instance_classes.
91 92 93 |
# File 'batch/managed_ec2_compute_environment_props.rb', line 91 def maxv_cpus @maxv_cpus end |
#replace_compute_environment ⇒ Boolean? (readonly)
Default: false
Specifies whether this Compute Environment is replaced if an update is made that requires replacing its instances.
To enable more properties to be updated,
set this property to false. When changing the value of this property to false,
do not change any other properties at the same time.
If other properties are changed at the same time,
and the change needs to be rolled back but it can't,
it's possible for the stack to go into the UPDATE_ROLLBACK_FAILED state.
You can't update a stack that is in the UPDATE_ROLLBACK_FAILED state.
However, if you can continue to roll it back,
you can return the stack to its original settings and then try to update it again.
The properties which require a replacement of the Compute Environment are:
109 110 111 |
# File 'batch/managed_ec2_compute_environment_props.rb', line 109 def replace_compute_environment @replace_compute_environment end |
#security_groups ⇒ Array<AWSCDK::EC2::ISecurityGroup>? (readonly)
Default: new security groups will be created
The security groups this Compute Environment will launch instances in.
114 115 116 |
# File 'batch/managed_ec2_compute_environment_props.rb', line 114 def security_groups @security_groups end |
#service_role ⇒ AWSCDK::IAM::IRole? (readonly)
Default: - a serviceRole will be created for managed CEs, none for unmanaged CEs
The role Batch uses to perform actions on your behalf in your account, such as provision instances to run your jobs.
77 78 79 |
# File 'batch/managed_ec2_compute_environment_props.rb', line 77 def service_role @service_role end |
#spot ⇒ Boolean? (readonly)
Default: false
Whether or not to use spot instances.
Spot instances are less expensive EC2 instances that can be reclaimed by EC2 at any time; your job will be given two minutes of notice before reclamation.
123 124 125 |
# File 'batch/managed_ec2_compute_environment_props.rb', line 123 def spot @spot end |
#terminate_on_update ⇒ Boolean? (readonly)
Default: false
Whether or not any running jobs will be immediately terminated when an infrastructure update occurs.
If this is enabled, any terminated jobs may be retried, depending on the job's retry policy.
132 133 134 |
# File 'batch/managed_ec2_compute_environment_props.rb', line 132 def terminate_on_update @terminate_on_update end |
#update_timeout ⇒ AWSCDK::Duration? (readonly)
Default: 30 minutes
Only meaningful if terminateOnUpdate is false.
If so,
when an infrastructure update is triggered, any running jobs
will be allowed to run until update_timeout has expired.
142 143 144 |
# File 'batch/managed_ec2_compute_environment_props.rb', line 142 def update_timeout @update_timeout end |
#update_to_latest_image_version ⇒ Boolean? (readonly)
Default: false
Whether or not the AMI is updated to the latest one supported by Batch when an infrastructure update occurs.
If you specify a specific AMI, this property will be ignored.
Note: the CDK will never set this value by default, false will set by CFN.
This is to avoid a deployment failure that occurs when this value is set.
153 154 155 |
# File 'batch/managed_ec2_compute_environment_props.rb', line 153 def update_to_latest_image_version @update_to_latest_image_version end |
#vpc ⇒ AWSCDK::EC2::IVPC (readonly)
VPC in which this Compute Environment will launch Instances.
81 82 83 |
# File 'batch/managed_ec2_compute_environment_props.rb', line 81 def vpc @vpc end |
#vpc_subnets ⇒ AWSCDK::EC2::SubnetSelection? (readonly)
Default: new subnets will be created
The VPC Subnets this Compute Environment will launch instances in.
158 159 160 |
# File 'batch/managed_ec2_compute_environment_props.rb', line 158 def vpc_subnets @vpc_subnets end |
Class Method Details
.jsii_properties ⇒ Object
175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 |
# File 'batch/managed_ec2_compute_environment_props.rb', line 175 def self.jsii_properties { :compute_environment_name => "computeEnvironmentName", :enabled => "enabled", :service_role => "serviceRole", :vpc => "vpc", :maxv_cpus => "maxvCpus", :replace_compute_environment => "replaceComputeEnvironment", :security_groups => "securityGroups", :spot => "spot", :terminate_on_update => "terminateOnUpdate", :update_timeout => "updateTimeout", :update_to_latest_image_version => "updateToLatestImageVersion", :vpc_subnets => "vpcSubnets", :instance_classes => "instanceClasses", :instance_types => "instanceTypes", } end |
Instance Method Details
#to_jsii ⇒ Object
194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 |
# File 'batch/managed_ec2_compute_environment_props.rb', line 194 def to_jsii result = {} result.merge!(super) result.merge!({ "computeEnvironmentName" => @compute_environment_name, "enabled" => @enabled, "serviceRole" => @service_role, "vpc" => @vpc, "maxvCpus" => @maxv_cpus, "replaceComputeEnvironment" => @replace_compute_environment, "securityGroups" => @security_groups, "spot" => @spot, "terminateOnUpdate" => @terminate_on_update, "updateTimeout" => @update_timeout, "updateToLatestImageVersion" => @update_to_latest_image_version, "vpcSubnets" => @vpc_subnets, "instanceClasses" => @instance_classes, "instanceTypes" => @instance_types, }) result.compact end |