create_job_queue
¶
create_job_queue(
*,
config_overrides: Optional[BatchClientConfig] = None,
job_queue_name: Optional[String] = None,
state: Optional[JQState] = None,
scheduling_policy_arn: Optional[String] = None,
priority: Optional[Integer] = None,
compute_environment_order: Optional[ComputeEnvironmentOrders] = None,
service_environment_order: Optional[ServiceEnvironmentOrders] = None,
job_queue_type: Optional[JobQueueType] = None,
tags: Optional[TagrisTagsMap] = None,
job_state_time_limit_actions: Optional[JobStateTimeLimitActions] = None,
) -> CreateJobQueueResponse
Creates an 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 that the 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.
Parameters:
-
job_queue_name(Optional[String], default:None) –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 (_).
-
state(Optional[JQState], default:None) –The state of the job queue. If the job queue state is
ENABLED, it is able to accept jobs. If the job queue state isDISABLED, new jobs can't be added to the queue, but jobs already in the queue can finish. -
scheduling_policy_arn(Optional[String], default:None) –The Amazon Resource Name (ARN) of the fair-share scheduling policy. Job queues that don't have a fair-share scheduling policy are scheduled in a first-in, first-out (FIFO) model. After a job queue has a fair-share scheduling policy, it can be replaced but can't be removed.
The format is
aws:Partition:batch:Region:Account:scheduling-policy/Name.An example is
aws:aws:batch:us-west-2:123456789012:scheduling-policy/MySchedulingPolicy.A job queue without a fair-share scheduling policy is scheduled as a FIFO job queue and can't have a fair-share scheduling policy added. Jobs queues with a fair-share scheduling policy can have a maximum of 500 active share identifiers. When the limit has been reached, submissions of any jobs that add a new share identifier fail.
-
priority(Optional[Integer], default:None) –The priority of the job queue. Job queues with a higher priority (or a higher integer value for the
priorityparameter) 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 of10is given scheduling preference over a job queue with a priority value of1. All of the compute environments must be either EC2 (EC2orSPOT) or Fargate (FARGATEorFARGATE_SPOT); EC2 and Fargate compute environments can't be mixed. -
compute_environment_order(Optional[ComputeEnvironmentOrders], default:None) –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
VALIDstate 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 (EC2orSPOT) or Fargate (FARGATEorFARGATE_SPOT); EC2 and Fargate compute environments can't be mixed.All compute environments that are associated with a job queue must share the same architecture. Batch doesn't support mixing compute environment architecture types in a single job queue.
-
service_environment_order(Optional[ServiceEnvironmentOrders], default:None) –A list of service environments that this job queue can use to allocate jobs. All serviceEnvironments must have the same type. A job queue can't have both a serviceEnvironmentOrder and a computeEnvironmentOrder field.
-
job_queue_type(Optional[JobQueueType], default:None) –The type of job queue. For service jobs that run on SageMaker Training, this value is
SAGEMAKER_TRAINING. For regular container jobs, this value isEKS,ECS, orECS_FARGATEdepending on the compute environment. -
tags(Optional[TagrisTagsMap], default:None) –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 Batch resources in Batch User Guide.
-
job_state_time_limit_actions(Optional[JobStateTimeLimitActions], default:None) –The set of actions that Batch performs on jobs that remain at the head of the job queue in the specified state longer than specified times. Batch will perform each action after
maxTimeSecondshas passed. (Note: The minimum value for maxTimeSeconds is 600 (10 minutes) and its maximum value is 86,400 (24 hours).)
Raises:
-
ClientException–These errors are usually caused by a client action. One example cause is using an action or resource on behalf of a user that doesn't have permissions to use the action or resource. Another cause is specifying an identifier that's not valid.
-
ServerException–These errors are usually caused by a server issue.
-
UnknownServiceError–The service returned an error code this client does not model.
Examples:
To create a job queue with a single compute environment This example creates a job queue called LowPriority that uses the M4Spot compute environment.
>>> client.create_job_queue(priority=1, state='ENABLED', compute_environment_order=[{'computeEnvironment': 'M4Spot', 'order': 1}], job_queue_name='LowPriority')
To create a job queue with an ECS Managed Instances compute environment
This example creates a job queue called ManagedInstancesQueue that uses an ECS Managed Instances compute environment.
>>> client.create_job_queue(priority=10, state='ENABLED', compute_environment_order=[{'computeEnvironment': 'my-managed-instances-ce', 'order': 1}], job_queue_name='ManagedInstancesQueue')
To create a job queue with multiple compute environments
This example creates a job queue called HighPriority that uses the C4OnDemand compute environment with an order of 1 and the M4Spot compute environment with an order of 2.
>>> client.create_job_queue(priority=10, state='ENABLED', compute_environment_order=[{'computeEnvironment': 'C4OnDemand', 'order': 1}, {'computeEnvironment': 'M4Spot', 'order': 2}], job_queue_name='HighPriority')
To create a job queue with On-Demand and Spot ECS Managed Instances compute environments
This example creates a job queue that uses both On-Demand and Spot ECS Managed Instances compute environments. On-Demand environments must be ordered before Spot environments.
>>> client.create_job_queue(priority=5, state='ENABLED', compute_environment_order=[{'computeEnvironment': 'my-managed-instances-ce', 'order': 1}, {'computeEnvironment': 'my-spot-managed-instances-ce', 'order': 2}], job_queue_name='ManagedInstancesMixedQueue')
Source code in docs_src/capo_batch/_services/batch.py
591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 | |