Class EcsJobDefinition
java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.Resource
software.amazon.awscdk.services.batch.EcsJobDefinition
- All Implemented Interfaces:
IResource
,IJobDefinition
,software.amazon.jsii.JsiiSerializable
,software.constructs.IConstruct
,software.constructs.IDependable
@Generated(value="jsii-pacmak/1.103.1 (build bef2dea)",
date="2024-10-25T14:21:10.932Z")
@Stability(Stable)
public class EcsJobDefinition
extends Resource
implements IJobDefinition
A JobDefinition that uses ECS orchestration.
Example:
IVpc vpc; EcsJobDefinition ecsJob = EcsJobDefinition.Builder.create(this, "JobDefn") .container(EcsEc2ContainerDefinition.Builder.create(this, "containerDefn") .image(ContainerImage.fromRegistry("public.ecr.aws/amazonlinux/amazonlinux:latest")) .memory(Size.mebibytes(2048)) .cpu(256) .build()) .build(); JobQueue queue = JobQueue.Builder.create(this, "JobQueue") .computeEnvironments(List.of(OrderedComputeEnvironment.builder() .computeEnvironment(ManagedEc2EcsComputeEnvironment.Builder.create(this, "managedEc2CE") .vpc(vpc) .build()) .order(1) .build())) .priority(10) .build(); User user = new User(this, "MyUser"); ecsJob.grantSubmitJob(user, queue);
-
Nested Class Summary
Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationMode
Nested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$Default
Nested classes/interfaces inherited from interface software.amazon.awscdk.services.batch.IJobDefinition
IJobDefinition.Jsii$Default, IJobDefinition.Jsii$Proxy
Nested classes/interfaces inherited from interface software.amazon.awscdk.IResource
IResource.Jsii$Default
-
Constructor Summary
ModifierConstructorDescriptionprotected
EcsJobDefinition
(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protected
EcsJobDefinition
(software.amazon.jsii.JsiiObjectRef objRef) EcsJobDefinition
(software.constructs.Construct scope, String id, EcsJobDefinitionProps props) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addRetryStrategy
(RetryStrategy strategy) Add a RetryStrategy to this JobDefinition.static IJobDefinition
fromJobDefinitionArn
(software.constructs.Construct scope, String id, String jobDefinitionArn) Import a JobDefinition by its arn.The container that this job will run.The ARN of this job definition.The name of this job definition.The default parameters passed to the container These parameters can be referenced in thecommand
that you give to the container.Whether to propogate tags from the JobDefinition to the ECS task that Batch spawns.The number of times to retry a job.Defines the retry behavior for this job.The priority of this Job.The timeout time for jobs that are submitted with this job definition.void
grantSubmitJob
(IGrantable identity, IJobQueue queue) Grants thebatch:submitJob
permission to the identity on both this job definition and thequeue
.Methods inherited from class software.amazon.awscdk.Resource
applyRemovalPolicy, generatePhysicalName, getEnv, getPhysicalName, getResourceArnAttribute, getResourceNameAttribute, getStack, isOwnedResource, isResource
Methods inherited from class software.constructs.Construct
getNode, isConstruct, toString
Methods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface software.constructs.IConstruct
getNode
Methods inherited from interface software.amazon.awscdk.IResource
applyRemovalPolicy, getEnv, getStack
Methods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Constructor Details
-
EcsJobDefinition
protected EcsJobDefinition(software.amazon.jsii.JsiiObjectRef objRef) -
EcsJobDefinition
protected EcsJobDefinition(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
EcsJobDefinition
@Stability(Stable) public EcsJobDefinition(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull EcsJobDefinitionProps props) - Parameters:
scope
- This parameter is required.id
- This parameter is required.props
- This parameter is required.
-
-
Method Details
-
fromJobDefinitionArn
@Stability(Stable) @NotNull public static IJobDefinition fromJobDefinitionArn(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull String jobDefinitionArn) Import a JobDefinition by its arn.- Parameters:
scope
- This parameter is required.id
- This parameter is required.jobDefinitionArn
- This parameter is required.
-
addRetryStrategy
Add a RetryStrategy to this JobDefinition.- Specified by:
addRetryStrategy
in interfaceIJobDefinition
- Parameters:
strategy
- This parameter is required.
-
grantSubmitJob
@Stability(Stable) public void grantSubmitJob(@NotNull IGrantable identity, @NotNull IJobQueue queue) Grants thebatch:submitJob
permission to the identity on both this job definition and thequeue
.- Parameters:
identity
- This parameter is required.queue
- This parameter is required.
-
getContainer
The container that this job will run. -
getJobDefinitionArn
The ARN of this job definition.- Specified by:
getJobDefinitionArn
in interfaceIJobDefinition
-
getJobDefinitionName
The name of this job definition.- Specified by:
getJobDefinitionName
in interfaceIJobDefinition
-
getRetryStrategies
Defines the retry behavior for this job.- Specified by:
getRetryStrategies
in interfaceIJobDefinition
-
getParameters
The default parameters passed to the container These parameters can be referenced in thecommand
that you give to the container.- Specified by:
getParameters
in interfaceIJobDefinition
- See Also:
-
getPropagateTags
Whether to propogate tags from the JobDefinition to the ECS task that Batch spawns. -
getRetryAttempts
The number of times to retry a job.The job is retried on failure the same number of attempts as the value.
- Specified by:
getRetryAttempts
in interfaceIJobDefinition
-
getSchedulingPriority
The priority of this Job.Only used in Fairshare Scheduling to decide which job to run first when there are multiple jobs with the same share identifier.
- Specified by:
getSchedulingPriority
in interfaceIJobDefinition
-
getTimeout
The timeout time for jobs that are submitted with this job definition.After the amount of time you specify passes, Batch terminates your jobs if they aren't finished.
- Specified by:
getTimeout
in interfaceIJobDefinition
-