Class JobQueue
- All Implemented Interfaces:
IResource
,IJobQueue
,software.amazon.jsii.JsiiSerializable
,software.constructs.IConstruct
,software.constructs.IDependable
Jobs exit the queue in FIFO order unless a SchedulingPolicy
is linked.
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.IJobQueue
IJobQueue.Jsii$Default, IJobQueue.Jsii$Proxy
Nested classes/interfaces inherited from interface software.amazon.awscdk.IResource
IResource.Jsii$Default
-
Constructor Summary
ModifierConstructorDescriptionprotected
JobQueue
(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protected
JobQueue
(software.amazon.jsii.JsiiObjectRef objRef) JobQueue
(software.constructs.Construct scope, String id, JobQueueProps props) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addComputeEnvironment
(IComputeEnvironment computeEnvironment, Number order) Add aComputeEnvironment
to this Queue.static IJobQueue
fromJobQueueArn
(software.constructs.Construct scope, String id, String jobQueueArn) refer to an existing JobQueue by its arn.The set of compute environments mapped to a job queue and their order relative to each other.If the job queue is enabled, it is able to accept jobs.The ARN of this job queue.The name of the job queue.The priority of the job queue.The SchedulingPolicy for this JobQueue.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
-
JobQueue
protected JobQueue(software.amazon.jsii.JsiiObjectRef objRef) -
JobQueue
protected JobQueue(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
JobQueue
@Stability(Stable) public JobQueue(@NotNull software.constructs.Construct scope, @NotNull String id, @Nullable JobQueueProps props) - Parameters:
scope
- This parameter is required.id
- This parameter is required.props
-
-
JobQueue
@Stability(Stable) public JobQueue(@NotNull software.constructs.Construct scope, @NotNull String id) - Parameters:
scope
- This parameter is required.id
- This parameter is required.
-
-
Method Details
-
fromJobQueueArn
@Stability(Stable) @NotNull public static IJobQueue fromJobQueueArn(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull String jobQueueArn) refer to an existing JobQueue by its arn.- Parameters:
scope
- This parameter is required.id
- This parameter is required.jobQueueArn
- This parameter is required.
-
addComputeEnvironment
@Stability(Stable) public void addComputeEnvironment(@NotNull IComputeEnvironment computeEnvironment, @NotNull Number order) Add aComputeEnvironment
to this Queue.The Queue will prefer lower-order
ComputeEnvironment
s.- Specified by:
addComputeEnvironment
in interfaceIJobQueue
- Parameters:
computeEnvironment
- This parameter is required.order
- This parameter is required.
-
getComputeEnvironments
The set of compute environments mapped to a job queue and their order relative to each other.The job scheduler uses this parameter to determine which compute environment runs a specific job. Compute environments must be in the VALID state before you can associate them with a job queue. You can associate up to three compute environments with a job queue. All of the compute environments must be either EC2 (EC2 or SPOT) or Fargate (FARGATE or FARGATE_SPOT); EC2 and Fargate compute environments can't be mixed.
Note: All compute environments that are associated with a job queue must share the same architecture. AWS Batch doesn't support mixing compute environment architecture types in a single job queue.
- Specified by:
getComputeEnvironments
in interfaceIJobQueue
-
getJobQueueArn
The ARN of this job queue.- Specified by:
getJobQueueArn
in interfaceIJobQueue
-
getJobQueueName
The name of the job queue.It can be up to 128 letters long. It can contain uppercase and lowercase letters, numbers, hyphens (-), and underscores (_)
- Specified by:
getJobQueueName
in interfaceIJobQueue
-
getPriority
The priority of the job queue.Job queues with a higher priority are evaluated first when associated with the same compute environment. Priority is determined in descending order. For example, a job queue with a priority value of 10 is given scheduling preference over a job queue with a priority value of 1.
- Specified by:
getPriority
in interfaceIJobQueue
-
getEnabled
If the job queue is enabled, it is able to accept jobs.Otherwise, new jobs can't be added to the queue, but jobs already in the queue can finish.
- Specified by:
getEnabled
in interfaceIJobQueue
-
getSchedulingPolicy
The SchedulingPolicy for this JobQueue.Instructs the Scheduler how to schedule different jobs.
- Specified by:
getSchedulingPolicy
in interfaceIJobQueue
-