Skip to main content

optimization_jobs

Creates, updates, deletes, gets or lists an optimization_jobs resource.

Overview

Nameoptimization_jobs
TypeResource
Idaws.sagemaker.optimization_jobs

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
creation_timestring (date-time)The time when you created the optimization job.
deployment_instance_typestringThe type of instance that hosts the optimized model that you create with the optimization job. (ml.p4d.24xlarge, ml.p4de.24xlarge, ml.p5.48xlarge, ml.p5e.48xlarge, ml.p5en.48xlarge, ml.g4dn.xlarge, ml.g4dn.2xlarge, ml.g4dn.4xlarge, ml.g4dn.8xlarge, ml.g4dn.12xlarge, ml.g4dn.16xlarge, ml.g5.xlarge, ml.g5.2xlarge, ml.g5.4xlarge, ml.g5.8xlarge, ml.g5.12xlarge, ml.g5.16xlarge, ml.g5.24xlarge, ml.g5.48xlarge, ml.g6.xlarge, ml.g6.2xlarge, ml.g6.4xlarge, ml.g6.8xlarge, ml.g6.12xlarge, ml.g6.16xlarge, ml.g6.24xlarge, ml.g6.48xlarge, ml.g6e.xlarge, ml.g6e.2xlarge, ml.g6e.4xlarge, ml.g6e.8xlarge, ml.g6e.12xlarge, ml.g6e.16xlarge, ml.g6e.24xlarge, ml.g6e.48xlarge, ml.inf2.xlarge, ml.inf2.8xlarge, ml.inf2.24xlarge, ml.inf2.48xlarge, ml.trn1.2xlarge, ml.trn1.32xlarge, ml.trn1n.32xlarge, ml.p6-b200.48xlarge, ml.g7e.2xlarge, ml.g7e.4xlarge, ml.g7e.8xlarge, ml.g7e.12xlarge, ml.g7e.24xlarge, ml.g7e.48xlarge)
failure_reasonstringIf the optimization job status is FAILED, the reason for the failure.
last_modified_timestring (date-time)The time when the optimization job was last updated.
max_instance_countintegerThe maximum number of instances to use for the optimization job.
model_sourceobjectThe location of the source model to optimize with an optimization job.
optimization_configsarraySettings for each of the optimization techniques that the job applies.
optimization_end_timestring (date-time)The time when the optimization job finished processing.
optimization_environmentobjectThe environment variables to set in the model container.
optimization_job_arnstringThe Amazon Resource Name (ARN) of the optimization job. (pattern: <code>arn:aws[a-z-]:sagemaker:[a-z0-9-]:[0-9]{12}:optimization-job/.*</code>)
optimization_job_namestringThe name that you assigned to the optimization job. (pattern: <code>[a-zA-Z0-9](-*[a-zA-Z0-9]){0,62}</code>)
optimization_job_statusstringThe current status of the optimization job. (INPROGRESS, COMPLETED, FAILED, STARTING, STOPPING, STOPPED)
optimization_outputobjectOutput values produced by an optimization job.
optimization_start_timestring (date-time)The time when the optimization job started.
output_configobjectDetails for where to store the optimized model that you create with the optimization job.
role_arnstringThe ARN of the IAM role that you assigned to the optimization 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.
training_plan_arnsarrayThe Amazon Resource Name (ARN) of the training plan associated with this optimization job. This field appears only when you specified a training plan when you created the job. Optimization jobs that use on-demand capacity don't return this field.
vpc_configobjectA VPC in Amazon VPC that your optimized model has access to.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
describe_optimization_jobselectregionProvides the properties of the specified optimization job.
list_optimization_jobsselectregionLists the optimization jobs in your account and their properties.
create_optimization_jobinsertregion, OptimizationJobName, RoleArn, ModelSource, DeploymentInstanceType, OptimizationConfigs, OutputConfig, StoppingConditionCreates a job that optimizes a model for inference performance. To create the job, you provide the location of a source model, and you provide the settings for the optimization techniques that you want the job to apply. When the job completes successfully, SageMaker uploads the new optimized model to the output destination that you specify. For more information about how to use this action, and about the supported optimization techniques, see Optimize model inference with Amazon SageMaker.
delete_optimization_jobdeleteregionDeletes an optimization job.
stop_optimization_jobexecregion, OptimizationJobNameEnds a running inference optimization job.

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

Provides the properties of the specified optimization job.

SELECT
creation_time,
deployment_instance_type,
failure_reason,
last_modified_time,
max_instance_count,
model_source,
optimization_configs,
optimization_end_time,
optimization_environment,
optimization_job_arn,
optimization_job_name,
optimization_job_status,
optimization_output,
optimization_start_time,
output_config,
role_arn,
stopping_condition,
training_plan_arns,
vpc_config
FROM aws.sagemaker.optimization_jobs
WHERE region = '{{ region }}' -- required
;

INSERT examples

Creates a job that optimizes a model for inference performance. To create the job, you provide the location of a source model, and you provide the settings for the optimization techniques that you want the job to apply. When the job completes successfully, SageMaker uploads the new optimized model to the output destination that you specify. For more information about how to use this action, and about the supported optimization techniques, see Optimize model inference with Amazon SageMaker.

INSERT INTO aws.sagemaker.optimization_jobs (
OptimizationJobName,
RoleArn,
ModelSource,
DeploymentInstanceType,
MaxInstanceCount,
OptimizationEnvironment,
OptimizationConfigs,
OutputConfig,
StoppingCondition,
Tags,
VpcConfig,
TrainingPlanArns,
region
)
SELECT
'{{ OptimizationJobName }}' /* required */,
'{{ RoleArn }}' /* required */,
'{{ ModelSource }}' /* required */,
'{{ DeploymentInstanceType }}' /* required */,
{{ MaxInstanceCount }},
'{{ OptimizationEnvironment }}',
'{{ OptimizationConfigs }}' /* required */,
'{{ OutputConfig }}' /* required */,
'{{ StoppingCondition }}' /* required */,
'{{ Tags }}',
'{{ VpcConfig }}',
'{{ TrainingPlanArns }}',
'{{ region }}'
RETURNING
optimization_job_arn
;

DELETE examples

Deletes an optimization job.

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

Lifecycle Methods

Ends a running inference optimization job.

EXEC aws.sagemaker.optimization_jobs.stop_optimization_job
@region='{{ region }}' --required
@@json=
'{
"OptimizationJobName": "{{ OptimizationJobName }}"
}'
;