createJobQueue method

Future<CreateJobQueueResponse> createJobQueue({
  1. required List<ComputeEnvironmentOrder> computeEnvironmentOrder,
  2. required String jobQueueName,
  3. required int priority,
  4. JQState? state,
  5. Map<String, String>? tags,
})

Creates an AWS Batch job queue. When you create a job queue, you associate one or more compute environments to the queue and assign an order of preference for the compute environments.

You also set a priority to the job queue that determines the order in which the AWS Batch scheduler places jobs onto its associated compute environments. For example, if a compute environment is associated with more than one job queue, the job queue with a higher priority is given preference for scheduling jobs to that compute environment.

May throw ClientException. May throw ServerException.

Parameter computeEnvironmentOrder : 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 should run 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.

Parameter jobQueueName : The name of the job queue. Up to 128 letters (uppercase and lowercase), numbers, and underscores are allowed.

Parameter priority : The priority of the job queue. Job queues with a higher priority (or a higher integer value for the priority parameter) 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. All of the compute environments must be either EC2 (EC2 or SPOT) or Fargate (FARGATE or FARGATE_SPOT); EC2 and Fargate compute environments cannot be mixed.

Parameter state : The state of the job queue. If the job queue state is ENABLED, it is able to accept jobs. If the job queue state is DISABLED, new jobs can't be added to the queue, but jobs already in the queue can finish.

Parameter tags : The tags that you apply to the job queue to help you categorize and organize your resources. Each tag consists of a key and an optional value. For more information, see Tagging your AWS Batch resources in AWS Batch User Guide.

Implementation

Future<CreateJobQueueResponse> createJobQueue({
  required List<ComputeEnvironmentOrder> computeEnvironmentOrder,
  required String jobQueueName,
  required int priority,
  JQState? state,
  Map<String, String>? tags,
}) async {
  ArgumentError.checkNotNull(
      computeEnvironmentOrder, 'computeEnvironmentOrder');
  ArgumentError.checkNotNull(jobQueueName, 'jobQueueName');
  ArgumentError.checkNotNull(priority, 'priority');
  final $payload = <String, dynamic>{
    'computeEnvironmentOrder': computeEnvironmentOrder,
    'jobQueueName': jobQueueName,
    'priority': priority,
    if (state != null) 'state': state.toValue(),
    if (tags != null) 'tags': tags,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/v1/createjobqueue',
    exceptionFnMap: _exceptionFns,
  );
  return CreateJobQueueResponse.fromJson(response);
}