Show / Hide Table of Contents

Class JobQueue

JobQueues can receive Jobs, which are removed from the queue when sent to the linked ComputeEnvironment(s) to be executed.

Inheritance
object
Resource
JobQueue
Implements
IJobQueue
IResource
IConstruct
IDependable
IEnvironmentAware
Inherited Members
Resource.IsOwnedResource(IConstruct)
Resource.IsResource(IConstruct)
Resource.ApplyRemovalPolicy(RemovalPolicy)
Resource.GeneratePhysicalName()
Resource.GetResourceArnAttribute(string, IArnComponents)
Resource.GetResourceNameAttribute(string)
Resource.Env
Resource.PhysicalName
Resource.Stack
Namespace: Amazon.CDK.AWS.Batch
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class JobQueue : Resource, IJobQueue, IResource, IConstruct, IDependable, IEnvironmentAware
Syntax (vb)
Public Class JobQueue Inherits Resource Implements IJobQueue, IResource, IConstruct, IDependable, IEnvironmentAware
Remarks

Jobs exit the queue in FIFO order unless a SchedulingPolicy is linked.

ExampleMetadata: infused

Examples
IVpc vpc;


             var ecsJob = new EcsJobDefinition(this, "JobDefn", new EcsJobDefinitionProps {
                 Container = new EcsEc2ContainerDefinition(this, "containerDefn", new EcsEc2ContainerDefinitionProps {
                     Image = ContainerImage.FromRegistry("public.ecr.aws/amazonlinux/amazonlinux:latest"),
                     Memory = Size.Mebibytes(2048),
                     Cpu = 256
                 })
             });

             var queue = new JobQueue(this, "JobQueue", new JobQueueProps {
                 ComputeEnvironments = new [] { new OrderedComputeEnvironment {
                     ComputeEnvironment = new ManagedEc2EcsComputeEnvironment(this, "managedEc2CE", new ManagedEc2EcsComputeEnvironmentProps {
                         Vpc = vpc
                     }),
                     Order = 1
                 } },
                 Priority = 10
             });

             var user = new User(this, "MyUser");
             ecsJob.GrantSubmitJob(user, queue);

Synopsis

Constructors

JobQueue(Construct, string, IJobQueueProps?)

JobQueues can receive Jobs, which are removed from the queue when sent to the linked ComputeEnvironment(s) to be executed.

Properties

ComputeEnvironments

The set of compute environments mapped to a job queue and their order relative to each other.

Enabled

If the job queue is enabled, it is able to accept jobs.

JobQueueArn

The ARN of this job queue.

JobQueueName

The name of the job queue.

PROPERTY_INJECTION_ID

Uniquely identifies this class.

Priority

The priority of the job queue.

SchedulingPolicy

The SchedulingPolicy for this JobQueue.

Methods

AddComputeEnvironment(IComputeEnvironment, double)

Add a ComputeEnvironment to this Queue.

FromJobQueueArn(Construct, string, string)

refer to an existing JobQueue by its arn.

Constructors

JobQueue(Construct, string, IJobQueueProps?)

JobQueues can receive Jobs, which are removed from the queue when sent to the linked ComputeEnvironment(s) to be executed.

public JobQueue(Construct scope, string id, IJobQueueProps? props = null)
Parameters
scope Construct
id string
props IJobQueueProps
Remarks

Jobs exit the queue in FIFO order unless a SchedulingPolicy is linked.

ExampleMetadata: infused

Examples
IVpc vpc;


             var ecsJob = new EcsJobDefinition(this, "JobDefn", new EcsJobDefinitionProps {
                 Container = new EcsEc2ContainerDefinition(this, "containerDefn", new EcsEc2ContainerDefinitionProps {
                     Image = ContainerImage.FromRegistry("public.ecr.aws/amazonlinux/amazonlinux:latest"),
                     Memory = Size.Mebibytes(2048),
                     Cpu = 256
                 })
             });

             var queue = new JobQueue(this, "JobQueue", new JobQueueProps {
                 ComputeEnvironments = new [] { new OrderedComputeEnvironment {
                     ComputeEnvironment = new ManagedEc2EcsComputeEnvironment(this, "managedEc2CE", new ManagedEc2EcsComputeEnvironmentProps {
                         Vpc = vpc
                     }),
                     Order = 1
                 } },
                 Priority = 10
             });

             var user = new User(this, "MyUser");
             ecsJob.GrantSubmitJob(user, queue);

Properties

ComputeEnvironments

The set of compute environments mapped to a job queue and their order relative to each other.

public virtual IOrderedComputeEnvironment[] ComputeEnvironments { get; }
Property Value

IOrderedComputeEnvironment[]

Remarks

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.

Enabled

If the job queue is enabled, it is able to accept jobs.

public virtual bool? Enabled { get; }
Property Value

bool?

Remarks

Otherwise, new jobs can't be added to the queue, but jobs already in the queue can finish.

JobQueueArn

The ARN of this job queue.

public virtual string JobQueueArn { get; }
Property Value

string

Remarks

Jobs exit the queue in FIFO order unless a SchedulingPolicy is linked.

ExampleMetadata: infused

JobQueueName

The name of the job queue.

public virtual string JobQueueName { get; }
Property Value

string

Remarks

It can be up to 128 letters long. It can contain uppercase and lowercase letters, numbers, hyphens (-), and underscores (_)

PROPERTY_INJECTION_ID

Uniquely identifies this class.

public static string PROPERTY_INJECTION_ID { get; }
Property Value

string

Remarks

Jobs exit the queue in FIFO order unless a SchedulingPolicy is linked.

ExampleMetadata: infused

Priority

The priority of the job queue.

public virtual double Priority { get; }
Property Value

double

Remarks

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.

SchedulingPolicy

The SchedulingPolicy for this JobQueue.

public virtual ISchedulingPolicy? SchedulingPolicy { get; }
Property Value

ISchedulingPolicy

Remarks

Instructs the Scheduler how to schedule different jobs.

Methods

AddComputeEnvironment(IComputeEnvironment, double)

Add a ComputeEnvironment to this Queue.

public virtual void AddComputeEnvironment(IComputeEnvironment computeEnvironment, double order)
Parameters
computeEnvironment IComputeEnvironment
order double
Remarks

The Queue will prefer lower-order ComputeEnvironments.

FromJobQueueArn(Construct, string, string)

refer to an existing JobQueue by its arn.

public static IJobQueue FromJobQueueArn(Construct scope, string id, string jobQueueArn)
Parameters
scope Construct
id string
jobQueueArn string
Returns

IJobQueue

Remarks

Jobs exit the queue in FIFO order unless a SchedulingPolicy is linked.

ExampleMetadata: infused

Implements

IJobQueue
IResource
Constructs.IConstruct
Constructs.IDependable
IEnvironmentAware
Back to top Generated by DocFX