Class JobQueue
- All Implemented Interfaces:
IEnvironmentAware,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 ClassesNested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationModeNested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$DefaultNested classes/interfaces inherited from interface software.amazon.awscdk.services.batch.IJobQueue
IJobQueue.Jsii$Default, IJobQueue.Jsii$ProxyNested classes/interfaces inherited from interface software.amazon.awscdk.IResource
IResource.Jsii$Default -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedJobQueue(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedJobQueue(software.amazon.jsii.JsiiObjectRef objRef) JobQueue(software.constructs.Construct scope, String id, JobQueueProps props) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddComputeEnvironment(IComputeEnvironment computeEnvironment, Number order) Add aComputeEnvironmentto this Queue.static IJobQueuefromJobQueueArn(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, isResourceMethods inherited from class software.constructs.Construct
getNode, isConstruct, toStringMethods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface software.constructs.IConstruct
getNodeMethods inherited from interface software.amazon.awscdk.interfaces.IEnvironmentAware
getEnvMethods inherited from interface software.amazon.awscdk.IResource
applyRemovalPolicy, getStackMethods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Field Details
-
PROPERTY_INJECTION_ID
Uniquely identifies this class.
-
-
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 aComputeEnvironmentto this Queue.The Queue will prefer lower-order
ComputeEnvironments.- Specified by:
addComputeEnvironmentin 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:
getComputeEnvironmentsin interfaceIJobQueue
-
getJobQueueArn
The ARN of this job queue.- Specified by:
getJobQueueArnin 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:
getJobQueueNamein 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:
getPriorityin 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:
getEnabledin interfaceIJobQueue
-
getSchedulingPolicy
The SchedulingPolicy for this JobQueue.Instructs the Scheduler how to schedule different jobs.
- Specified by:
getSchedulingPolicyin interfaceIJobQueue
-