ResourceConfig¶
-
class
aws_cdk.aws_stepfunctions_tasks.
ResourceConfig
(*, instance_count, instance_type, volume_size, volume_encryption_key=None)¶ Bases:
object
Specifies the resources, ML compute instances, and ML storage volumes to deploy for model training.
- Parameters
instance_count (
Union
[int
,float
]) – The number of ML compute instances to use. Default: 1 instance.instance_type (
InstanceType
) – 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.”:: new ec2.InstanceType(sfn.JsonPath.stringAt(‘$.path.to.instanceType’)); Default: ec2.InstanceType(ec2.InstanceClass.M4, ec2.InstanceType.XLARGE)volume_size (
Size
) – Size of the ML storage volume that you want to provision. Default: 10 GB EBS volume.volume_encryption_key (
Optional
[IKey
]) – 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. Default: - Amazon SageMaker uses the default KMS key for Amazon S3 for your role’s account
- ExampleMetadata
infused
Example:
tasks.SageMakerCreateTrainingJob(self, "TrainSagemaker", training_job_name=sfn.JsonPath.string_at("$.JobName"), algorithm_specification=tasks.AlgorithmSpecification( algorithm_name="BlazingText", training_input_mode=tasks.InputMode.FILE ), input_data_config=[tasks.Channel( channel_name="train", data_source=tasks.DataSource( s3_data_source=tasks.S3DataSource( s3_data_type=tasks.S3DataType.S3_PREFIX, s3_location=tasks.S3Location.from_json_expression("$.S3Bucket") ) ) )], output_data_config=tasks.OutputDataConfig( s3_output_location=tasks.S3Location.from_bucket(s3.Bucket.from_bucket_name(self, "Bucket", "mybucket"), "myoutputpath") ), resource_config=tasks.ResourceConfig( instance_count=1, instance_type=ec2.InstanceType(sfn.JsonPath.string_at("$.InstanceType")), volume_size=Size.gibibytes(50) ), # optional: default is 1 instance of EC2 `M4.XLarge` with `10GB` volume stopping_condition=tasks.StoppingCondition( max_runtime=Duration.hours(2) ) )
Attributes
-
instance_count
¶ The number of ML compute instances to use.
- Default
1 instance.
- Return type
Union
[int
,float
]
-
instance_type
¶ 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.”:
ec2.InstanceType(sfn.JsonPath.string_at("$.path.to.instanceType"))
- Default
ec2.InstanceType(ec2.InstanceClass.M4, ec2.InstanceType.XLARGE)
- See
- Return type