class CfnProcessingJob (construct)
Language | Type name |
---|---|
![]() | Amazon.CDK.AWS.Sagemaker.CfnProcessingJob |
![]() | github.com/aws/aws-cdk-go/awscdk/v2/awssagemaker#CfnProcessingJob |
![]() | software.amazon.awscdk.services.sagemaker.CfnProcessingJob |
![]() | aws_cdk.aws_sagemaker.CfnProcessingJob |
![]() | aws-cdk-lib » aws_sagemaker » CfnProcessingJob |
Implements
IConstruct
, IDependable
, IInspectable
, ITaggable
An Amazon SageMaker processing job that is used to analyze data and evaluate models.
For more information, see Process Data and Evaluate Models .
Also, note the following details specific to processing jobs created using CloudFormation stacks:
- When you delete a CloudFormation stack with a processing job resource, the processing job is stopped using the StopProcessingJob API but not deleted. Any tags associated with the processing job are deleted using the DeleteTags API.
- If any part of your CloudFormation stack deployment fails and a rollback initiates, processing jobs with a specified
ProcessingJobName
value might cause the stack to become stuck in a failed state. This occurs because during a rollback, CloudFormation attempts to recreate the stack resources. Processing job names must be unique, so when CloudFormation attempts to recreate a processing job using the already defined name, this results in anAlreadyExists
error. To prevent this, we recommend that you don't specify the optionalProcessingJobName
property, thereby allowing SageMaker to auto-generate a unique name for your processing job. This ensures successful stack rollbacks when necessary. If you must use custom job names, you have to manually modify theProcessingJobName
and redeploy the stack to recover from a failed rollback.
Example
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_sagemaker as sagemaker } from 'aws-cdk-lib';
const cfnProcessingJob = new sagemaker.CfnProcessingJob(this, 'MyCfnProcessingJob', {
appSpecification: {
imageUri: 'imageUri',
// the properties below are optional
containerArguments: ['containerArguments'],
containerEntrypoint: ['containerEntrypoint'],
},
processingResources: {
clusterConfig: {
instanceCount: 123,
instanceType: 'instanceType',
volumeSizeInGb: 123,
// the properties below are optional
volumeKmsKeyId: 'volumeKmsKeyId',
},
},
roleArn: 'roleArn',
// the properties below are optional
environment: {
environmentKey: 'environment',
},
experimentConfig: {
experimentName: 'experimentName',
runName: 'runName',
trialComponentDisplayName: 'trialComponentDisplayName',
trialName: 'trialName',
},
networkConfig: {
enableInterContainerTrafficEncryption: false,
enableNetworkIsolation: false,
vpcConfig: {
securityGroupIds: ['securityGroupIds'],
subnets: ['subnets'],
},
},
processingInputs: [{
inputName: 'inputName',
// the properties below are optional
appManaged: false,
datasetDefinition: {
athenaDatasetDefinition: {
catalog: 'catalog',
database: 'database',
outputFormat: 'outputFormat',
outputS3Uri: 'outputS3Uri',
queryString: 'queryString',
// the properties below are optional
kmsKeyId: 'kmsKeyId',
outputCompression: 'outputCompression',
workGroup: 'workGroup',
},
dataDistributionType: 'dataDistributionType',
inputMode: 'inputMode',
localPath: 'localPath',
redshiftDatasetDefinition: {
clusterId: 'clusterId',
clusterRoleArn: 'clusterRoleArn',
database: 'database',
dbUser: 'dbUser',
outputFormat: 'outputFormat',
outputS3Uri: 'outputS3Uri',
queryString: 'queryString',
// the properties below are optional
kmsKeyId: 'kmsKeyId',
outputCompression: 'outputCompression',
},
},
s3Input: {
s3DataType: 's3DataType',
s3Uri: 's3Uri',
// the properties below are optional
localPath: 'localPath',
s3CompressionType: 's3CompressionType',
s3DataDistributionType: 's3DataDistributionType',
s3InputMode: 's3InputMode',
},
}],
processingJobName: 'processingJobName',
processingOutputConfig: {
outputs: [{
outputName: 'outputName',
// the properties below are optional
appManaged: false,
featureStoreOutput: {
featureGroupName: 'featureGroupName',
},
s3Output: {
s3UploadMode: 's3UploadMode',
s3Uri: 's3Uri',
// the properties below are optional
localPath: 'localPath',
},
}],
// the properties below are optional
kmsKeyId: 'kmsKeyId',
},
stoppingCondition: {
maxRuntimeInSeconds: 123,
},
tags: [{
key: 'key',
value: 'value',
}],
});
Initializer
new CfnProcessingJob(scope: Construct, id: string, props: CfnProcessingJobProps)
Parameters
- scope
Construct
— Scope in which this resource is defined. - id
string
— Construct identifier for this resource (unique in its scope). - props
Cfn
— Resource properties.Processing Job Props
Construct Props
Name | Type | Description |
---|---|---|
app | IResolvable | App | Configuration to run a processing job in a specified container image. |
processing | IResolvable | Processing | Identifies the resources, ML compute instances, and ML storage volumes to deploy for a processing job. |
role | string | The ARN of the role used to create the processing job. |
environment? | { [string]: string } | IResolvable | Sets the environment variables in the Docker container. |
experiment | IResolvable | Experiment | Associates a SageMaker job as a trial component with an experiment and trial. |
network | IResolvable | Network | Networking options for a job, such as network traffic encryption between containers, whether to allow inbound and outbound network calls to and from containers, and the VPC subnets and security groups to use for VPC-enabled jobs. |
processing | IResolvable | IResolvable | Processing [] | List of input configurations for the processing job. |
processing | string | The name of the processing job. |
processing | IResolvable | Processing | Contains information about the output location for the compiled model and the target device that the model runs on. |
stopping | IResolvable | Stopping | Configures conditions under which the processing job should be stopped, such as how long the processing job has been running. |
tags? | Cfn [] | An array of key-value pairs. |
appSpecification
Type:
IResolvable
|
App
Configuration to run a processing job in a specified container image.
processingResources
Type:
IResolvable
|
Processing
Identifies the resources, ML compute instances, and ML storage volumes to deploy for a processing job.
In distributed training, you specify more than one instance.
roleArn
Type:
string
The ARN of the role used to create the processing job.
environment?
Type:
{ [string]: string } |
IResolvable
(optional)
Sets the environment variables in the Docker container.
experimentConfig?
Type:
IResolvable
|
Experiment
(optional)
Associates a SageMaker job as a trial component with an experiment and trial.
Specified when you call the CreateProcessingJob API.
networkConfig?
Type:
IResolvable
|
Network
(optional)
Networking options for a job, such as network traffic encryption between containers, whether to allow inbound and outbound network calls to and from containers, and the VPC subnets and security groups to use for VPC-enabled jobs.
processingInputs?
Type:
IResolvable
|
IResolvable
|
Processing
[]
(optional)
List of input configurations for the processing job.
processingJobName?
Type:
string
(optional)
The name of the processing job.
If you don't provide a job name, then a unique name is automatically created for the job.
processingOutputConfig?
Type:
IResolvable
|
Processing
(optional)
Contains information about the output location for the compiled model and the target device that the model runs on.
TargetDevice
and TargetPlatform
are mutually exclusive, so you need to choose one between the two to specify your target device or platform. If you cannot find your device you want to use from the TargetDevice
list, use TargetPlatform
to describe the platform of your edge device and CompilerOptions
if there are specific settings that are required or recommended to use for particular TargetPlatform.
stoppingCondition?
Type:
IResolvable
|
Stopping
(optional)
Configures conditions under which the processing job should be stopped, such as how long the processing job has been running.
After the condition is met, the processing job is stopped.
tags?
Type:
Cfn
[]
(optional)
An array of key-value pairs.
For more information, see Using Cost Allocation Tags in the AWS Billing and Cost Management User Guide .
Properties
Name | Type | Description |
---|---|---|
app | IResolvable | App | Configuration to run a processing job in a specified container image. |
attr | string | The Amazon Resource Name (ARN) of the AutoML job associated with this processing job. |
attr | string | The time the processing job was created. |
attr | string | A string, up to one KB in size, that contains metadata from the processing container when the processing job exits. |
attr | string | A string, up to one KB in size, that contains the reason a processing job failed, if it failed. |
attr | string | The time the processing job was last modified. |
attr | string | The ARN of a monitoring schedule for an endpoint associated with this processing job. |
attr | string | The time that the processing job ended. |
attr | string | The ARN of the processing job. |
attr | string | The status of the processing job. |
attr | string | The time that the processing job started. |
attr | string | The ARN of the training job associated with this processing job. |
cdk | Tag | Tag Manager which manages the tags for this resource. |
cfn | ICfn | Options for this resource, such as condition, update policy etc. |
cfn | { [string]: any } | |
cfn | string | AWS resource type. |
creation | string[] | |
logical | string | The logical ID for this CloudFormation stack element. |
node | Node | The tree node. |
processing | IResolvable | Processing | Identifies the resources, ML compute instances, and ML storage volumes to deploy for a processing job. |
ref | string | Return a string that will be resolved to a CloudFormation { Ref } for this element. |
role | string | The ARN of the role used to create the processing job. |
stack | Stack | The stack in which this element is defined. |
environment? | { [string]: string } | IResolvable | Sets the environment variables in the Docker container. |
experiment | IResolvable | Experiment | Associates a SageMaker job as a trial component with an experiment and trial. |
network | IResolvable | Network | Networking options for a job, such as network traffic encryption between containers, whether to allow inbound and outbound network calls to and from containers, and the VPC subnets and security groups to use for VPC-enabled jobs. |
processing | IResolvable | IResolvable | Processing [] | List of input configurations for the processing job. |
processing | string | The name of the processing job. |
processing | IResolvable | Processing | Contains information about the output location for the compiled model and the target device that the model runs on. |
stopping | IResolvable | Stopping | Configures conditions under which the processing job should be stopped, such as how long the processing job has been running. |
tags? | Cfn [] | An array of key-value pairs. |
static CFN_RESOURCE_TYPE_NAME | string | The CloudFormation resource type name for this resource class. |
appSpecification
Type:
IResolvable
|
App
Configuration to run a processing job in a specified container image.
attrAutoMlJobArn
Type:
string
The Amazon Resource Name (ARN) of the AutoML job associated with this processing job.
attrCreationTime
Type:
string
The time the processing job was created.
attrExitMessage
Type:
string
A string, up to one KB in size, that contains metadata from the processing container when the processing job exits.
attrFailureReason
Type:
string
A string, up to one KB in size, that contains the reason a processing job failed, if it failed.
attrLastModifiedTime
Type:
string
The time the processing job was last modified.
attrMonitoringScheduleArn
Type:
string
The ARN of a monitoring schedule for an endpoint associated with this processing job.
attrProcessingEndTime
Type:
string
The time that the processing job ended.
attrProcessingJobArn
Type:
string
The ARN of the processing job.
attrProcessingJobStatus
Type:
string
The status of the processing job.
attrProcessingStartTime
Type:
string
The time that the processing job started.
attrTrainingJobArn
Type:
string
The ARN of the training job associated with this processing job.
cdkTagManager
Type:
Tag
Tag Manager which manages the tags for this resource.
cfnOptions
Type:
ICfn
Options for this resource, such as condition, update policy etc.
cfnProperties
Type:
{ [string]: any }
cfnResourceType
Type:
string
AWS resource type.
creationStack
Type:
string[]
logicalId
Type:
string
The logical ID for this CloudFormation stack element.
The logical ID of the element is calculated from the path of the resource node in the construct tree.
To override this value, use overrideLogicalId(newLogicalId)
.
node
Type:
Node
The tree node.
processingResources
Type:
IResolvable
|
Processing
Identifies the resources, ML compute instances, and ML storage volumes to deploy for a processing job.
ref
Type:
string
Return a string that will be resolved to a CloudFormation { Ref }
for this element.
If, by any chance, the intrinsic reference of a resource is not a string, you could
coerce it to an IResolvable through Lazy.any({ produce: resource.ref })
.
roleArn
Type:
string
The ARN of the role used to create the processing job.
stack
Type:
Stack
The stack in which this element is defined.
CfnElements must be defined within a stack scope (directly or indirectly).
environment?
Type:
{ [string]: string } |
IResolvable
(optional)
Sets the environment variables in the Docker container.
experimentConfig?
Type:
IResolvable
|
Experiment
(optional)
Associates a SageMaker job as a trial component with an experiment and trial.
networkConfig?
Type:
IResolvable
|
Network
(optional)
Networking options for a job, such as network traffic encryption between containers, whether to allow inbound and outbound network calls to and from containers, and the VPC subnets and security groups to use for VPC-enabled jobs.
processingInputs?
Type:
IResolvable
|
IResolvable
|
Processing
[]
(optional)
List of input configurations for the processing job.
processingJobName?
Type:
string
(optional)
The name of the processing job.
processingOutputConfig?
Type:
IResolvable
|
Processing
(optional)
Contains information about the output location for the compiled model and the target device that the model runs on.
stoppingCondition?
Type:
IResolvable
|
Stopping
(optional)
Configures conditions under which the processing job should be stopped, such as how long the processing job has been running.
tags?
Type:
Cfn
[]
(optional)
An array of key-value pairs.
static CFN_RESOURCE_TYPE_NAME
Type:
string
The CloudFormation resource type name for this resource class.
Methods
Name | Description |
---|---|
add | Syntactic sugar for addOverride(path, undefined) . |
add | Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned. |
add | Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned. |
add | Add a value to the CloudFormation Resource Metadata. |
add | Adds an override to the synthesized CloudFormation resource. |
add | Adds an override that deletes the value of a property from the resource definition. |
add | Adds an override to a resource property. |
apply | Sets the deletion policy of the resource based on the removal policy specified. |
get | Returns a token for an runtime attribute of this resource. |
get | Retrieve a value value from the CloudFormation Resource Metadata. |
inspect(inspector) | Examines the CloudFormation resource and discloses attributes. |
obtain | Retrieves an array of resources this resource depends on. |
obtain | Get a shallow copy of dependencies between this resource and other resources in the same stack. |
override | Overrides the auto-generated logical ID with a specific ID. |
remove | Indicates that this resource no longer depends on another resource. |
replace | Replaces one dependency with another. |
to | Returns a string representation of this construct. |
protected render |
addDeletionOverride(path)
public addDeletionOverride(path: string): void
Parameters
- path
string
— The path of the value to delete.
Syntactic sugar for addOverride(path, undefined)
.
addDependency(target)
public addDependency(target: CfnResource): void
Parameters
- target
Cfn
Resource
Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned.
This can be used for resources across stacks (or nested stack) boundaries and the dependency will automatically be transferred to the relevant scope.
addDependsOn(target)
public addDependsOn(target: CfnResource): void
⚠️ Deprecated: use addDependency
Parameters
- target
Cfn
Resource
Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned.
addMetadata(key, value)
public addMetadata(key: string, value: any): void
Parameters
- key
string
- value
any
Add a value to the CloudFormation Resource Metadata.
Note that this is a different set of metadata from CDK node metadata; this metadata ends up in the stack template under the resource, whereas CDK node metadata ends up in the Cloud Assembly.](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html
Note that this is a different set of metadata from CDK node metadata; this metadata ends up in the stack template under the resource, whereas CDK node metadata ends up in the Cloud Assembly.)
addOverride(path, value)
public addOverride(path: string, value: any): void
Parameters
- path
string
— - The path of the property, you can use dot notation to override values in complex types. - value
any
— - The value.
Adds an override to the synthesized CloudFormation resource.
To add a
property override, either use addPropertyOverride
or prefix path
with
"Properties." (i.e. Properties.TopicName
).
If the override is nested, separate each nested level using a dot (.) in the path parameter. If there is an array as part of the nesting, specify the index in the path.
To include a literal .
in the property name, prefix with a \
. In most
programming languages you will need to write this as "\\."
because the
\
itself will need to be escaped.
For example,
cfnResource.addOverride('Properties.GlobalSecondaryIndexes.0.Projection.NonKeyAttributes', ['myattribute']);
cfnResource.addOverride('Properties.GlobalSecondaryIndexes.1.ProjectionType', 'INCLUDE');
would add the overrides
"Properties": {
"GlobalSecondaryIndexes": [
{
"Projection": {
"NonKeyAttributes": [ "myattribute" ]
...
}
...
},
{
"ProjectionType": "INCLUDE"
...
},
]
...
}
The value
argument to addOverride
will not be processed or translated
in any way. Pass raw JSON values in here with the correct capitalization
for CloudFormation. If you pass CDK classes or structs, they will be
rendered with lowercased key names, and CloudFormation will reject the
template.
addPropertyDeletionOverride(propertyPath)
public addPropertyDeletionOverride(propertyPath: string): void
Parameters
- propertyPath
string
— The path to the property.
Adds an override that deletes the value of a property from the resource definition.
addPropertyOverride(propertyPath, value)
public addPropertyOverride(propertyPath: string, value: any): void
Parameters
- propertyPath
string
— The path of the property. - value
any
— The value.
Adds an override to a resource property.
Syntactic sugar for addOverride("Properties.<...>", value)
.
applyRemovalPolicy(policy?, options?)
public applyRemovalPolicy(policy?: RemovalPolicy, options?: RemovalPolicyOptions): void
Parameters
- policy
Removal
Policy - options
Removal
Policy Options
Sets the deletion policy of the resource based on the removal policy specified.
The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.
The resource can be deleted (RemovalPolicy.DESTROY
), or left in your AWS
account for data recovery and cleanup later (RemovalPolicy.RETAIN
). In some
cases, a snapshot can be taken of the resource prior to deletion
(RemovalPolicy.SNAPSHOT
). A list of resources that support this policy
can be found in the following link:
getAtt(attributeName, typeHint?)
public getAtt(attributeName: string, typeHint?: ResolutionTypeHint): Reference
Parameters
- attributeName
string
— The name of the attribute. - typeHint
Resolution
Type Hint
Returns
Returns a token for an runtime attribute of this resource.
Ideally, use generated attribute accessors (e.g. resource.arn
), but this can be used for future compatibility
in case there is no generated attribute.
getMetadata(key)
public getMetadata(key: string): any
Parameters
- key
string
Returns
any
Retrieve a value value from the CloudFormation Resource Metadata.
Note that this is a different set of metadata from CDK node metadata; this metadata ends up in the stack template under the resource, whereas CDK node metadata ends up in the Cloud Assembly.](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html
Note that this is a different set of metadata from CDK node metadata; this metadata ends up in the stack template under the resource, whereas CDK node metadata ends up in the Cloud Assembly.)
inspect(inspector)
public inspect(inspector: TreeInspector): void
Parameters
- inspector
Tree
— tree inspector to collect and process attributes.Inspector
Examines the CloudFormation resource and discloses attributes.
obtainDependencies()
public obtainDependencies(): Stack | CfnResource[]
Returns
Stack
|
Cfn
Resource []
Retrieves an array of resources this resource depends on.
This assembles dependencies on resources across stacks (including nested stacks) automatically.
obtainResourceDependencies()
public obtainResourceDependencies(): CfnResource[]
Returns
Get a shallow copy of dependencies between this resource and other resources in the same stack.
overrideLogicalId(newLogicalId)
public overrideLogicalId(newLogicalId: string): void
Parameters
- newLogicalId
string
— The new logical ID to use for this stack element.
Overrides the auto-generated logical ID with a specific ID.
removeDependency(target)
public removeDependency(target: CfnResource): void
Parameters
- target
Cfn
Resource
Indicates that this resource no longer depends on another resource.
This can be used for resources across stacks (including nested stacks) and the dependency will automatically be removed from the relevant scope.
replaceDependency(target, newTarget)
public replaceDependency(target: CfnResource, newTarget: CfnResource): void
Parameters
- target
Cfn
— The dependency to replace.Resource - newTarget
Cfn
— The new dependency to add.Resource
Replaces one dependency with another.
toString()
public toString(): string
Returns
string
Returns a string representation of this construct.
protected renderProperties(props)
protected renderProperties(props: { [string]: any }): { [string]: any }
Parameters
- props
{ [string]: any }
Returns
{ [string]: any }