Class SageMakerCreateTrainingJob

java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
All Implemented Interfaces:
IConstruct, IDependable, IConnectable, IGrantable, IChainable, INextable, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct

@Generated(value="jsii-pacmak/1.84.0 (build 5404dcf)", date="2023-06-19T16:30:48.190Z") @Stability(Stable) public class SageMakerCreateTrainingJob extends TaskStateBase implements IGrantable, IConnectable
Class representing the SageMaker Create Training Job task.

Example:

 SageMakerCreateTrainingJob.Builder.create(this, "TrainSagemaker")
         .trainingJobName(JsonPath.stringAt("$.JobName"))
         .algorithmSpecification(AlgorithmSpecification.builder()
                 .algorithmName("BlazingText")
                 .trainingInputMode(InputMode.FILE)
                 .build())
         .inputDataConfig(List.of(Channel.builder()
                 .channelName("train")
                 .dataSource(DataSource.builder()
                         .s3DataSource(S3DataSource.builder()
                                 .s3DataType(S3DataType.S3_PREFIX)
                                 .s3Location(S3Location.fromJsonExpression("$.S3Bucket"))
                                 .build())
                         .build())
                 .build()))
         .outputDataConfig(OutputDataConfig.builder()
                 .s3OutputLocation(S3Location.fromBucket(Bucket.fromBucketName(this, "Bucket", "mybucket"), "myoutputpath"))
                 .build())
         .resourceConfig(ResourceConfig.builder()
                 .instanceCount(1)
                 .instanceType(new InstanceType(JsonPath.stringAt("$.InstanceType")))
                 .volumeSize(Size.gibibytes(50))
                 .build()) // optional: default is 1 instance of EC2 `M4.XLarge` with `10GB` volume
         .stoppingCondition(StoppingCondition.builder()
                 .maxRuntime(Duration.hours(2))
                 .build())
         .build();
 
  • Constructor Details

    • SageMakerCreateTrainingJob

      protected SageMakerCreateTrainingJob(software.amazon.jsii.JsiiObjectRef objRef)
    • SageMakerCreateTrainingJob

      protected SageMakerCreateTrainingJob(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • SageMakerCreateTrainingJob

      @Stability(Stable) public SageMakerCreateTrainingJob(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull SageMakerCreateTrainingJobProps props)
      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
      props - This parameter is required.
  • Method Details

    • addSecurityGroup

      @Stability(Stable) public void addSecurityGroup(@NotNull ISecurityGroup securityGroup)
      Add the security group to all instances via the launch configuration security groups array.

      Parameters:
      securityGroup - : The security group to add. This parameter is required.
    • getConnections

      @Stability(Stable) @NotNull public Connections getConnections()
      Allows specify security group connections for instances of this fleet.
      Specified by:
      getConnections in interface IConnectable
    • getGrantPrincipal

      @Stability(Stable) @NotNull public IPrincipal getGrantPrincipal()
      The principal to grant permissions to.
      Specified by:
      getGrantPrincipal in interface IGrantable
    • getRole

      @Stability(Stable) @NotNull public IRole getRole()
      The execution role for the Sagemaker training job.

      Only available after task has been added to a state machine.

    • getTaskMetrics

      @Stability(Stable) @Nullable protected TaskMetricsConfig getTaskMetrics()
      Specified by:
      getTaskMetrics in class TaskStateBase
    • getTaskPolicies

      @Stability(Stable) @Nullable protected List<PolicyStatement> getTaskPolicies()
      Specified by:
      getTaskPolicies in class TaskStateBase