Class JobQueue
JobQueues can receive Jobs, which are removed from the queue when sent to the linked ComputeEnvironment(s) to be executed.
Inherited Members
Namespace: Amazon.CDK.AWS.Batch
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class JobQueue : Resource, IJobQueue, IResource
Syntax (vb)
Public Class JobQueue
Inherits Resource
Implements IJobQueue, IResource
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(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
JobQueue(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
JobQueue(Construct, String, IJobQueueProps) |
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. |
Priority | The priority of the job queue. |
SchedulingPolicy | The SchedulingPolicy for this JobQueue. |
Methods
AddComputeEnvironment(IComputeEnvironment, Double) | Add a |
FromJobQueueArn(Construct, String, String) | refer to an existing JobQueue by its arn. |
Constructors
JobQueue(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected JobQueue(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
JobQueue(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected JobQueue(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
JobQueue(Construct, String, IJobQueueProps)
public JobQueue(Construct scope, string id, IJobQueueProps props = null)
Parameters
- scope Constructs.Construct
- id System.String
- props IJobQueueProps
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
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 Nullable<bool> Enabled { get; }
Property Value
System.Nullable<System.Boolean>
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
System.String
JobQueueName
The name of the job queue.
public virtual string JobQueueName { get; }
Property Value
System.String
Remarks
It can be up to 128 letters long. It can contain uppercase and lowercase letters, numbers, hyphens (-), and underscores (_)
Priority
The priority of the job queue.
public virtual double Priority { get; }
Property Value
System.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
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 System.Double
Remarks
The Queue will prefer lower-order ComputeEnvironment
s.
FromJobQueueArn(Construct, String, String)
refer to an existing JobQueue by its arn.
public static IJobQueue FromJobQueueArn(Construct scope, string id, string jobQueueArn)
Parameters
- scope Constructs.Construct
- id System.String
- jobQueueArn System.String
Returns