Amazon SageMaker Service

2018/07/30 - Amazon SageMaker Service - 1 updated api methods

Changes  Added SecondaryStatusTransitions to DescribeTrainingJob to provide more visibility into SageMaker training job progress and lifecycle.

DescribeTrainingJob (updated) Link ΒΆ
Changes (response)
{'SecondaryStatus': {'DownloadingTrainingImage',
                     'LaunchingMLInstances',
                     'PreparingTrainingStack'},
 'SecondaryStatusTransitions': [{'EndTime': 'timestamp',
                                 'StartTime': 'timestamp',
                                 'Status': 'Starting | LaunchingMLInstances | '
                                           'PreparingTrainingStack | '
                                           'Downloading | '
                                           'DownloadingTrainingImage | '
                                           'Training | Uploading | Stopping | '
                                           'Stopped | MaxRuntimeExceeded | '
                                           'Completed | Failed',
                                 'StatusMessage': 'string'}]}

Returns information about a training job.

See also: AWS API Documentation

Request Syntax

client.describe_training_job(
    TrainingJobName='string'
)
type TrainingJobName

string

param TrainingJobName

[REQUIRED]

The name of the training job.

rtype

dict

returns

Response Syntax

{
    'TrainingJobName': 'string',
    'TrainingJobArn': 'string',
    'TuningJobArn': 'string',
    'ModelArtifacts': {
        'S3ModelArtifacts': 'string'
    },
    'TrainingJobStatus': 'InProgress'|'Completed'|'Failed'|'Stopping'|'Stopped',
    'SecondaryStatus': 'Starting'|'LaunchingMLInstances'|'PreparingTrainingStack'|'Downloading'|'DownloadingTrainingImage'|'Training'|'Uploading'|'Stopping'|'Stopped'|'MaxRuntimeExceeded'|'Completed'|'Failed',
    'FailureReason': 'string',
    'HyperParameters': {
        'string': 'string'
    },
    'AlgorithmSpecification': {
        'TrainingImage': 'string',
        'TrainingInputMode': 'Pipe'|'File'
    },
    'RoleArn': 'string',
    'InputDataConfig': [
        {
            'ChannelName': 'string',
            'DataSource': {
                'S3DataSource': {
                    'S3DataType': 'ManifestFile'|'S3Prefix',
                    'S3Uri': 'string',
                    'S3DataDistributionType': 'FullyReplicated'|'ShardedByS3Key'
                }
            },
            'ContentType': 'string',
            'CompressionType': 'None'|'Gzip',
            'RecordWrapperType': 'None'|'RecordIO'
        },
    ],
    'OutputDataConfig': {
        'KmsKeyId': 'string',
        'S3OutputPath': 'string'
    },
    'ResourceConfig': {
        'InstanceType': 'ml.m4.xlarge'|'ml.m4.2xlarge'|'ml.m4.4xlarge'|'ml.m4.10xlarge'|'ml.m4.16xlarge'|'ml.m5.large'|'ml.m5.xlarge'|'ml.m5.2xlarge'|'ml.m5.4xlarge'|'ml.m5.12xlarge'|'ml.m5.24xlarge'|'ml.c4.xlarge'|'ml.c4.2xlarge'|'ml.c4.4xlarge'|'ml.c4.8xlarge'|'ml.p2.xlarge'|'ml.p2.8xlarge'|'ml.p2.16xlarge'|'ml.p3.2xlarge'|'ml.p3.8xlarge'|'ml.p3.16xlarge'|'ml.c5.xlarge'|'ml.c5.2xlarge'|'ml.c5.4xlarge'|'ml.c5.9xlarge'|'ml.c5.18xlarge',
        'InstanceCount': 123,
        'VolumeSizeInGB': 123,
        'VolumeKmsKeyId': 'string'
    },
    'VpcConfig': {
        'SecurityGroupIds': [
            'string',
        ],
        'Subnets': [
            'string',
        ]
    },
    'StoppingCondition': {
        'MaxRuntimeInSeconds': 123
    },
    'CreationTime': datetime(2015, 1, 1),
    'TrainingStartTime': datetime(2015, 1, 1),
    'TrainingEndTime': datetime(2015, 1, 1),
    'LastModifiedTime': datetime(2015, 1, 1),
    'SecondaryStatusTransitions': [
        {
            'Status': 'Starting'|'LaunchingMLInstances'|'PreparingTrainingStack'|'Downloading'|'DownloadingTrainingImage'|'Training'|'Uploading'|'Stopping'|'Stopped'|'MaxRuntimeExceeded'|'Completed'|'Failed',
            'StartTime': datetime(2015, 1, 1),
            'EndTime': datetime(2015, 1, 1),
            'StatusMessage': 'string'
        },
    ]
}

Response Structure

  • (dict) --

    • TrainingJobName (string) --

      Name of the model training job.

    • TrainingJobArn (string) --

      The Amazon Resource Name (ARN) of the training job.

    • TuningJobArn (string) --

      The Amazon Resource Name (ARN) of the associated hyperparameter tuning job if the training job was launched by a hyperparameter tuning job.

    • ModelArtifacts (dict) --

      Information about the Amazon S3 location that is configured for storing model artifacts.

      • S3ModelArtifacts (string) --

        The path of the S3 object that contains the model artifacts. For example, s3://bucket-name/keynameprefix/model.tar.gz .

    • TrainingJobStatus (string) --

      The status of the training job.

      For the InProgress status, Amazon SageMaker can return these secondary statuses:

      • Starting - Preparing for training.

      • Downloading - Optional stage for algorithms that support File training input mode. It indicates data is being downloaded to ML storage volumes.

      • Training - Training is in progress.

      • Uploading - Training is complete and model upload is in progress.

      For the Stopped training status, Amazon SageMaker can return these secondary statuses:

      • MaxRuntimeExceeded - Job stopped as a result of maximum allowed runtime exceeded.

    • SecondaryStatus (string) --

      Provides granular information about the system state. For more information, see TrainingJobStatus .

      • Starting - starting the training job.

      • LaunchingMLInstances - launching ML instances for the training job.

      • PreparingTrainingStack - preparing the ML instances for the training job.

      • Downloading - downloading the input data.

      • DownloadingTrainingImage - downloading the training algorithm image.

      • Training - model training is in progress.

      • Uploading - uploading the trained model.

      • Stopping - stopping the training job.

      • Stopped - the training job has stopped.

      • MaxRuntimeExceeded - the training job exceeded the specified max run time and has been stopped.

      • Completed - the training job has completed.

      • Failed - the training job has failed. The failure reason is provided in the StatusMessage .

      Warning

      The valid values for SecondaryStatus are subject to change. They primarily provide information on the progress of the training job.

    • FailureReason (string) --

      If the training job failed, the reason it failed.

    • HyperParameters (dict) --

      Algorithm-specific parameters.

      • (string) --

        • (string) --

    • AlgorithmSpecification (dict) --

      Information about the algorithm used for training, and algorithm metadata.

      • TrainingImage (string) --

        The registry path of the Docker image that contains the training algorithm. For information about docker registry paths for built-in algorithms, see sagemaker-algo-docker-registry-paths.

      • TrainingInputMode (string) --

        The input mode that the algorithm supports. For the input modes that Amazon SageMaker algorithms support, see Algorithms. If an algorithm supports the File input mode, Amazon SageMaker downloads the training data from S3 to the provisioned ML storage Volume, and mounts the directory to docker volume for training container. If an algorithm supports the Pipe input mode, Amazon SageMaker streams data directly from S3 to the container.

        In File mode, make sure you provision ML storage volume with sufficient capacity to accommodate the data download from S3. In addition to the training data, the ML storage volume also stores the output model. The algorithm container use ML storage volume to also store intermediate information, if any.

        For distributed algorithms using File mode, training data is distributed uniformly, and your training duration is predictable if the input data objects size is approximately same. Amazon SageMaker does not split the files any further for model training. If the object sizes are skewed, training won't be optimal as the data distribution is also skewed where one host in a training cluster is overloaded, thus becoming bottleneck in training.

    • RoleArn (string) --

      The AWS Identity and Access Management (IAM) role configured for the training job.

    • InputDataConfig (list) --

      An array of Channel objects that describes each data input channel.

      • (dict) --

        A channel is a named input source that training algorithms can consume.

        • ChannelName (string) --

          The name of the channel.

        • DataSource (dict) --

          The location of the channel data.

          • S3DataSource (dict) --

            The S3 location of the data source that is associated with a channel.

            • S3DataType (string) --

              If you choose S3Prefix , S3Uri identifies a key name prefix. Amazon SageMaker uses all objects with the specified key name prefix for model training.

              If you choose ManifestFile , S3Uri identifies an object that is a manifest file containing a list of object keys that you want Amazon SageMaker to use for model training.

            • S3Uri (string) --

              Depending on the value specified for the S3DataType , identifies either a key name prefix or a manifest. For example:

              • A key name prefix might look like this: s3://bucketname/exampleprefix .

              • A manifest might look like this: s3://bucketname/example.manifest The manifest is an S3 object which is a JSON file with the following format: [ {"prefix": "s3://customer_bucket/some/prefix/"}, "relative/path/to/custdata-1", "relative/path/custdata-2", ... ] The preceding JSON matches the following s3Uris : s3://customer_bucket/some/prefix/relative/path/to/custdata-1 s3://customer_bucket/some/prefix/relative/path/custdata-1 ... The complete set of s3uris in this manifest constitutes the input data for the channel for this datasource. The object that each s3uris points to must readable by the IAM role that Amazon SageMaker uses to perform tasks on your behalf.

            • S3DataDistributionType (string) --

              If you want Amazon SageMaker to replicate the entire dataset on each ML compute instance that is launched for model training, specify FullyReplicated .

              If you want Amazon SageMaker to replicate a subset of data on each ML compute instance that is launched for model training, specify ShardedByS3Key . If there are n ML compute instances launched for a training job, each instance gets approximately 1/n of the number of S3 objects. In this case, model training on each machine uses only the subset of training data.

              Don't choose more ML compute instances for training than available S3 objects. If you do, some nodes won't get any data and you will pay for nodes that aren't getting any training data. This applies in both FILE and PIPE modes. Keep this in mind when developing algorithms.

              In distributed training, where you use multiple ML compute EC2 instances, you might choose ShardedByS3Key . If the algorithm requires copying training data to the ML storage volume (when TrainingInputMode is set to File ), this copies 1/n of the number of objects.

        • ContentType (string) --

          The MIME type of the data.

        • CompressionType (string) --

          If training data is compressed, the compression type. The default value is None . CompressionType is used only in Pipe input mode. In File mode, leave this field unset or set it to None.

        • RecordWrapperType (string) --

          Specify RecordIO as the value when input data is in raw format but the training algorithm requires the RecordIO format, in which case, Amazon SageMaker wraps each individual S3 object in a RecordIO record. If the input data is already in RecordIO format, you don't need to set this attribute. For more information, see Create a Dataset Using RecordIO.

          In FILE mode, leave this field unset or set it to None.

    • OutputDataConfig (dict) --

      The S3 path where model artifacts that you configured when creating the job are stored. Amazon SageMaker creates subfolders for model artifacts.

      • KmsKeyId (string) --

        The AWS Key Management Service (AWS KMS) key that Amazon SageMaker uses to encrypt the model artifacts at rest using Amazon S3 server-side encryption.

        Note

        If you don't provide the KMS key ID, Amazon SageMaker uses the default KMS key for Amazon S3 for your role's account. For more information, see KMS-Managed Encryption Keys in Amazon Simple Storage Service developer guide.

        Note

        The KMS key policy must grant permission to the IAM role you specify in your CreateTrainingJob request. Using Key Policies in AWS KMS in the AWS Key Management Service Developer Guide.

      • S3OutputPath (string) --

        Identifies the S3 path where you want Amazon SageMaker to store the model artifacts. For example, s3://bucket-name/key-name-prefix .

    • ResourceConfig (dict) --

      Resources, including ML compute instances and ML storage volumes, that are configured for model training.

      • InstanceType (string) --

        The ML compute instance type.

      • InstanceCount (integer) --

        The number of ML compute instances to use. For distributed training, provide a value greater than 1.

      • VolumeSizeInGB (integer) --

        The size of the ML storage volume that you want to provision.

        ML storage volumes store model artifacts and incremental states. Training algorithms might also use the ML storage volume for scratch space. If you want to store the training data in the ML storage volume, choose File as the TrainingInputMode in the algorithm specification.

        You must specify sufficient ML storage for your scenario.

        Note

        Amazon SageMaker supports only the General Purpose SSD (gp2) ML storage volume type.

      • VolumeKmsKeyId (string) --

        The Amazon Resource Name (ARN) of a AWS Key Management Service key that Amazon SageMaker uses to encrypt data on the storage volume attached to the ML compute instance(s) that run the training job.

    • VpcConfig (dict) --

      A VpcConfig object that specifies the VPC that this training job has access to. For more information, see train-vpc.

      • SecurityGroupIds (list) --

        The VPC security group IDs, in the form sg-xxxxxxxx. Specify the security groups for the VPC that is specified in the Subnets field.

        • (string) --

      • Subnets (list) --

        The ID of the subnets in the VPC to which you want to connect your training job or model.

        • (string) --

    • StoppingCondition (dict) --

      The condition under which to stop the training job.

      • MaxRuntimeInSeconds (integer) --

        The maximum length of time, in seconds, that the training job can run. If model training does not complete during this time, Amazon SageMaker ends the job. If value is not specified, default value is 1 day. Maximum value is 5 days.

    • CreationTime (datetime) --

      A timestamp that indicates when the training job was created.

    • TrainingStartTime (datetime) --

      Indicates the time when the training job starts on training instances. You are billed for the time interval between this time and the value of TrainingEndTime . The start time in CloudWatch Logs might be later than this time. The difference is due to the time it takes to download the training data and to the size of the training container.

    • TrainingEndTime (datetime) --

      Indicates the time when the training job ends on training instances. You are billed for the time interval between the value of TrainingStartTime and this time. For successful jobs and stopped jobs, this is the time after model artifacts are uploaded. For failed jobs, this is the time when Amazon SageMaker detects a job failure.

    • LastModifiedTime (datetime) --

      A timestamp that indicates when the status of the training job was last modified.

    • SecondaryStatusTransitions (list) --

      To give an overview of the training job lifecycle, SecondaryStatusTransitions is a log of time-ordered secondary statuses that a training job has transitioned.

      • (dict) --

        Specifies a secondary status the job has transitioned into. It includes a start timestamp and later an end timestamp. The end timestamp is added either after the job transitions to a different secondary status or after the job has ended.

        • Status (string) --

          Provides granular information about the system state. For more information, see SecondaryStatus under the DescribeTrainingJob response elements.

        • StartTime (datetime) --

          A timestamp that shows when the training job has entered this secondary status.

        • EndTime (datetime) --

          A timestamp that shows when the secondary status has ended and the job has transitioned into another secondary status. The EndTime timestamp is also set after the training job has ended.

        • StatusMessage (string) --

          Shows a brief description and other information about the secondary status. For example, the LaunchingMLInstances secondary status could show a status message of "Insufficent capacity error while launching instances".