Skip to main content

compilation_jobs

Creates, updates, deletes, gets or lists a compilation_jobs resource.

Overview

Namecompilation_jobs
TypeResource
Idaws.sagemaker.compilation_jobs

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
compilation_end_timestring (date-time)The time when the model compilation job on a compilation job instance ended. For a successful or stopped job, this is when the job's model artifacts have finished uploading. For a failed job, this is when Amazon SageMaker AI detected that the job failed.
compilation_job_arnstringThe Amazon Resource Name (ARN) of the model compilation job. (pattern: <code>arn:aws[a-z-]:sagemaker:[a-z0-9-]:[0-9]{12}:compilation-job/.*</code>)
compilation_job_namestringThe name of the model compilation job. (pattern: <code>[a-zA-Z0-9](-*[a-zA-Z0-9]){0,62}</code>)
compilation_job_statusstringThe status of the model compilation job. (INPROGRESS, COMPLETED, FAILED, STARTING, STOPPING, STOPPED)
compilation_start_timestring (date-time)The time when the model compilation job started the CompilationJob instances. You are billed for the time between this timestamp and the timestamp in the CompilationEndTime field. In Amazon CloudWatch Logs, the start time might be later than this time. That's because it takes time to download the compilation job, which depends on the size of the compilation job container.
creation_timestring (date-time)The time that the model compilation job was created.
derived_informationobjectInformation that SageMaker Neo automatically derived about the model.
failure_reasonstringIf a model compilation job failed, the reason it failed.
inference_imagestringThe inference image to use when compiling a model. Specify an image only if the target device is a cloud instance.
input_configobjectInformation about the location in Amazon S3 of the input model artifacts, the name and shape of the expected data inputs, and the framework in which the model was trained.
last_modified_timestring (date-time)The time that the status of the model compilation job was last modified.
model_artifactsobjectInformation about the location in Amazon S3 that has been configured for storing the model artifacts used in the compilation job.
model_digestsobjectProvides a BLAKE2 hash value that identifies the compiled model artifacts in Amazon S3.
model_package_version_arnstringThe Amazon Resource Name (ARN) of the versioned model package that was provided to SageMaker Neo when you initiated a compilation job. (pattern: <code>arn:aws[a-z-]*:sagemaker:[a-z0-9-]{9,16}:[0-9]{12}:model-package/[\S]{1,2048}</code>)
output_configobjectInformation about the output location for the compiled model and the target device that the model runs on.
role_arnstringThe Amazon Resource Name (ARN) of an IAM role that Amazon SageMaker AI assumes to perform the model compilation job. (pattern: <code>arn:aws[a-z-]*:iam::\d{12}:role/?[a-zA-Z_0-9+=,.@-_/]+</code>)
stopping_conditionobjectSpecifies a limit to how long a job can run. When the job reaches the time limit, SageMaker ends the job. Use this API to cap costs. To stop a training job, SageMaker sends the algorithm the SIGTERM signal, which delays job termination for 120 seconds. Algorithms can use this 120-second window to save the model artifacts, so the results of training are not lost. The training algorithms provided by SageMaker automatically save the intermediate results of a model training job when possible. This attempt to save artifacts is only a best effort case as model might not be in a state from which it can be saved. For example, if training has just started, the model might not be ready to save. When saved, this intermediate data is a valid model artifact. You can use it to create a model with CreateModel. The Neural Topic Model (NTM) currently does not support saving intermediate model artifacts. When training NTMs, make sure that the maximum runtime is sufficient for the training job to complete.
vpc_configobjectA VpcConfig object that specifies the VPC that you want your compilation job to connect to. Control access to your models by configuring the VPC. For more information, see Protect Compilation Jobs by Using an Amazon Virtual Private Cloud.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
describe_compilation_jobselectregionReturns information about a model compilation job. To create a model compilation job, use CreateCompilationJob. To get information about multiple model compilation jobs, use ListCompilationJobs.
list_compilation_jobsselectregionLists model compilation jobs that satisfy various filters. To create a model compilation job, use CreateCompilationJob. To get information about a particular model compilation job you have created, use DescribeCompilationJob.
create_compilation_jobinsertregion, CompilationJobName, RoleArn, OutputConfig, StoppingConditionStarts a model compilation job. After the model has been compiled, Amazon SageMaker AI saves the resulting model artifacts to an Amazon Simple Storage Service (Amazon S3) bucket that you specify. If you choose to host your model using Amazon SageMaker AI hosting services, you can use the resulting model artifacts as part of the model. You can also use the artifacts with Amazon Web Services IoT Greengrass. In that case, deploy them as an ML resource. In the request body, you provide the following: A name for the compilation job Information about the input model artifacts The output location for the compiled model and the device (target) that the model runs on The Amazon Resource Name (ARN) of the IAM role that Amazon SageMaker AI assumes to perform the model compilation job. You can also provide a Tag to track the model compilation job's resource use and costs. The response body contains the CompilationJobArn for the compiled job. To stop a model compilation job, use StopCompilationJob. To get information about a particular model compilation job, use DescribeCompilationJob. To get information about multiple model compilation jobs, use ListCompilationJobs.
delete_compilation_jobdeleteregionDeletes the specified compilation job. This action deletes only the compilation job resource in Amazon SageMaker AI. It doesn't delete other resources that are related to that job, such as the model artifacts that the job creates, the compilation logs in CloudWatch, the compiled model, or the IAM role. You can delete a compilation job only if its current status is COMPLETED, FAILED, or STOPPED. If the job status is STARTING or INPROGRESS, stop the job, and then delete it after its status becomes STOPPED.
stop_compilation_jobexecregion, CompilationJobNameStops a model compilation job. To stop a job, Amazon SageMaker AI sends the algorithm the SIGTERM signal. This gracefully shuts the job down. If the job hasn't stopped, it sends the SIGKILL signal. When it receives a StopCompilationJob request, Amazon SageMaker AI changes the CompilationJobStatus of the job to Stopping. After Amazon SageMaker stops the job, it sets the CompilationJobStatus to Stopped.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
regionstringAWS region (default: us-east-1)

SELECT examples

Returns information about a model compilation job. To create a model compilation job, use CreateCompilationJob. To get information about multiple model compilation jobs, use ListCompilationJobs.

SELECT
compilation_end_time,
compilation_job_arn,
compilation_job_name,
compilation_job_status,
compilation_start_time,
creation_time,
derived_information,
failure_reason,
inference_image,
input_config,
last_modified_time,
model_artifacts,
model_digests,
model_package_version_arn,
output_config,
role_arn,
stopping_condition,
vpc_config
FROM aws.sagemaker.compilation_jobs
WHERE region = '{{ region }}' -- required
;

INSERT examples

Starts a model compilation job. After the model has been compiled, Amazon SageMaker AI saves the resulting model artifacts to an Amazon Simple Storage Service (Amazon S3) bucket that you specify. If you choose to host your model using Amazon SageMaker AI hosting services, you can use the resulting model artifacts as part of the model. You can also use the artifacts with Amazon Web Services IoT Greengrass. In that case, deploy them as an ML resource. In the request body, you provide the following: A name for the compilation job Information about the input model artifacts The output location for the compiled model and the device (target) that the model runs on The Amazon Resource Name (ARN) of the IAM role that Amazon SageMaker AI assumes to perform the model compilation job. You can also provide a Tag to track the model compilation job's resource use and costs. The response body contains the CompilationJobArn for the compiled job. To stop a model compilation job, use StopCompilationJob. To get information about a particular model compilation job, use DescribeCompilationJob. To get information about multiple model compilation jobs, use ListCompilationJobs.

INSERT INTO aws.sagemaker.compilation_jobs (
CompilationJobName,
RoleArn,
ModelPackageVersionArn,
InputConfig,
OutputConfig,
VpcConfig,
StoppingCondition,
Tags,
region
)
SELECT
'{{ CompilationJobName }}' /* required */,
'{{ RoleArn }}' /* required */,
'{{ ModelPackageVersionArn }}',
'{{ InputConfig }}',
'{{ OutputConfig }}' /* required */,
'{{ VpcConfig }}',
'{{ StoppingCondition }}' /* required */,
'{{ Tags }}',
'{{ region }}'
RETURNING
compilation_job_arn
;

DELETE examples

Deletes the specified compilation job. This action deletes only the compilation job resource in Amazon SageMaker AI. It doesn't delete other resources that are related to that job, such as the model artifacts that the job creates, the compilation logs in CloudWatch, the compiled model, or the IAM role. You can delete a compilation job only if its current status is COMPLETED, FAILED, or STOPPED. If the job status is STARTING or INPROGRESS, stop the job, and then delete it after its status becomes STOPPED.

DELETE FROM aws.sagemaker.compilation_jobs
WHERE region = '{{ region }}' --required
;

Lifecycle Methods

Stops a model compilation job. To stop a job, Amazon SageMaker AI sends the algorithm the SIGTERM signal. This gracefully shuts the job down. If the job hasn't stopped, it sends the SIGKILL signal. When it receives a StopCompilationJob request, Amazon SageMaker AI changes the CompilationJobStatus of the job to Stopping. After Amazon SageMaker stops the job, it sets the CompilationJobStatus to Stopped.

EXEC aws.sagemaker.compilation_jobs.stop_compilation_job
@region='{{ region }}' --required
@@json=
'{
"CompilationJobName": "{{ CompilationJobName }}"
}'
;