Class: AWSCDK::StepFunctionsTasks::ResourceConfig

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
step_functions_tasks/resource_config.rb

Overview

Specifies the resources, ML compute instances, and ML storage volumes to deploy for model training.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(instance_count:, instance_type:, volume_size:, volume_encryption_key: nil) ⇒ ResourceConfig

Returns a new instance of ResourceConfig.

Parameters:

  • instance_count (Numeric)

    The number of ML compute instances to use.

  • instance_type (AWSCDK::EC2::InstanceType)

    ML compute instance type.

  • volume_size (AWSCDK::Size)

    Size of the ML storage volume that you want to provision.

  • volume_encryption_key (AWSCDK::KMS::IKey, nil) (defaults to: nil)

    KMS key that Amazon SageMaker uses to encrypt data on the storage volume attached to the ML compute instance(s) that run the training job.



11
12
13
14
15
16
17
18
19
20
# File 'step_functions_tasks/resource_config.rb', line 11

def initialize(instance_count:, instance_type:, volume_size:, volume_encryption_key: nil)
  @instance_count = instance_count
  Jsii::Type.check_type(@instance_count, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "instanceCount")
  @instance_type = instance_type
  Jsii::Type.check_type(@instance_type, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLkluc3RhbmNlVHlwZSJ9")), "instanceType")
  @volume_size = volume_size
  Jsii::Type.check_type(@volume_size, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5TaXplIn0=")), "volumeSize")
  @volume_encryption_key = volume_encryption_key
  Jsii::Type.check_type(@volume_encryption_key, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3Nfa21zLklLZXkifQ==")), "volumeEncryptionKey") unless @volume_encryption_key.nil?
end

Instance Attribute Details

#instance_countNumeric (readonly)

Note:

Default: 1 instance.

The number of ML compute instances to use.

Returns:

  • (Numeric)


26
27
28
# File 'step_functions_tasks/resource_config.rb', line 26

def instance_count
  @instance_count
end

#instance_typeAWSCDK::EC2::InstanceType (readonly)

Note:

Default: ec2.InstanceType(ec2.InstanceClass.M4, ec2.InstanceType.XLARGE)

ML compute instance type.

To provide an instance type from the task input, supply an instance type in the following way where the value in the task input is an EC2 instance type prepended with "ml.":

AWSCDK::EC2::InstanceType.new(AWSCDK::StepFunctions::JsonPath.string_at("$.path.to.instanceType"))


39
40
41
# File 'step_functions_tasks/resource_config.rb', line 39

def instance_type
  @instance_type
end

#volume_encryption_keyAWSCDK::KMS::IKey? (readonly)

Note:

Default: - Amazon SageMaker uses the default KMS key for Amazon S3 for your role's account

KMS key that Amazon SageMaker uses to encrypt data on the storage volume attached to the ML compute instance(s) that run the training job.

Returns:



49
50
51
# File 'step_functions_tasks/resource_config.rb', line 49

def volume_encryption_key
  @volume_encryption_key
end

#volume_sizeAWSCDK::Size (readonly)

Note:

Default: 10 GB EBS volume.

Size of the ML storage volume that you want to provision.

Returns:



44
45
46
# File 'step_functions_tasks/resource_config.rb', line 44

def volume_size
  @volume_size
end

Class Method Details

.jsii_propertiesObject



51
52
53
54
55
56
57
58
# File 'step_functions_tasks/resource_config.rb', line 51

def self.jsii_properties
  {
    :instance_count => "instanceCount",
    :instance_type => "instanceType",
    :volume_size => "volumeSize",
    :volume_encryption_key => "volumeEncryptionKey",
  }
end

Instance Method Details

#to_jsiiObject



60
61
62
63
64
65
66
67
68
69
# File 'step_functions_tasks/resource_config.rb', line 60

def to_jsii
  result = {}
  result.merge!({
    "instanceCount" => @instance_count,
    "instanceType" => @instance_type,
    "volumeSize" => @volume_size,
    "volumeEncryptionKey" => @volume_encryption_key,
  })
  result.compact
end