

# AWS PCS queues
Queues

An AWS PCS queue is a lightweight abstraction over the scheduler’s native implementation of a work queue. In the case of Slurm, an AWS PCS queue is equivalent to a Slurm partition. 

 Users submit jobs to a queue where they reside until they can be scheduled to run on nodes provided by one or more compute node groups. An AWS PCS cluster can have multiple job queues. For example, you can create a queue that uses Amazon EC2 On-demand Instances for high priority jobs and another queue that uses Amazon EC2 Spot Instances for low-priority jobs. 

**Topics**
+ [

# Creating a queue in AWS PCS
](working-with_queues_create.md)
+ [

# Updating an AWS PCS queue
](working-with_queues_update.md)
+ [

# Deleting a queue in AWS PCS
](working-with_queues_delete.md)

# Creating a queue in AWS PCS
Creating a queue

This topic provides an overview of available options and describes what to consider when you create a queue in AWS PCS.

**Note**  
You can configure custom Slurm settings on queues to implement partition-specific scheduling policies and resource management. For more information, see [Configuring custom Slurm settings in AWS PCS](slurm-custom-settings.md).

## Prerequisites

+ An AWS PCS cluster - queues can only be created in association with a specific AWS PCS cluster.
+ One or more AWS PCS compute node groups - a queue must be associated with at least one AWS PCS compute node group.

## To create a queue in AWS PCS


You can create a queue using the AWS Management Console or the AWS CLI.

------
#### [ AWS Management Console ]

**To create a queue using the console**

1. Open the [AWS PCS console](https://console.aws.amazon.com/pcs/home#/clusters).

1. Select the cluster for the queue. Navigate to **Queues** and choose **Create queue**.

1. In the **Queue configuration** section, provide the following values:

   1. **Queue name** – A name for your queue. The name can contain only alphanumeric characters (case-sensitive) and hyphens. It must start with an alphabetic character and can't be longer than 25 characters. The name must be unique within the cluster.

   1. **Compute node groups** – Select 1 or more compute node groups to service this queue. A compute node group can be associated with more than 1 queue.

1. (Optional) In the **Additional scheduler settings** section, you can add parameter name and value pairs to configure additional Slurm settings. For a complete list of supported parameters, see [Custom Slurm settings for AWS PCS queues](slurm-custom-settings-queue.md).

1. (Optional) Under **Tags**, add any tags to your AWS PCS queue

1. Choose **Create queue**. The **Status** field will show **Creating** while AWS PCS creates the queue. Queue creation can take several minutes. 

**Recommended next step**
+ Submit a job to your new queue.

------
#### [ AWS CLI ]

**To create a queue using AWS CLI**

Use the following command to create your queue. Make the following replacements:

1. Replace *region-code* with the AWS Region of the cluster. For example, `us-east-1`.

1. Replace *my-queue* with the name for your queue. The name can contain only alphanumeric characters (case-sensitive) and hyphens. It must start with an alphabetic character and can't be longer than 25 characters. The name must be unique within the cluster.

1. Replace *my-cluster* with the name or ID of your cluster.

1. Replace *compute-node-group-id* with the ID of the compute node group to service the queue. For example, `pcs_abcdef12345`. 
**Note**  
When you create a queue, you must provide the ID of the compute node group and not its name.

```
aws pcs create-queue --region region-code \
    --queue-name my-queue \
    --cluster-identifier my-cluster \
    --compute-node-group-configurations \
    computeNodeGroupId=compute-node-group-id
```

**Example – Creating a queue with custom Slurm settings**  

```
aws pcs create-queue --region region-code \
    --queue-name my-queue \
    --cluster-identifier my-cluster \
    --compute-node-group-configurations \
    computeNodeGroupId=compute-node-group-id \
    --slurm-configuration \
    'slurmCustomSettings=[{parameterName=Default,parameterValue=YES}]'
```
For more information, see [Custom Slurm settings for AWS PCS queues](slurm-custom-settings-queue.md).

It can take several minutes to create the queue. You can query the status of your queue with the following command. You won’t be able to submit jobs to the queue until its status reaches `ACTIVE`.

```
aws pcs get-queue --region region-code \
    --cluster-identifier my-cluster \
    --queue-identifier my-queue
```

**Recommended next step**
+ Submit a job to your new queue

------

# Updating an AWS PCS queue
Updating a queue

This topic provides an overview of available options and describes what to consider when you update an AWS PCS queue. For information about Slurm custom settings, see [Custom Slurm settings for AWS PCS queues](slurm-custom-settings-queue.md).

## Considerations when updating an AWS PCS queue


Queue updates will not impact running jobs but the cluster may not be able to accept new jobs while the queue is being updated.

## To update an AWS PCS queue


You can use the AWS Management Console or AWS CLI to update a queue.

------
#### [ AWS Management Console ]

**To update a queue**

1. Open the AWS PCS console at `https://console.aws.amazon.com/pcs/home#/clusters`

1. Select the cluster where you wish to update a queue.

1. Navigate to **Queues**, go to the queue wish to update, then select **Edit**.

1. In the queue configuration section, update any of the following values:
   +  **Node groups** – Add or remove compute node groups from association with the queue. 
   +  **Additional scheduler settings** – Add, modify, or remove custom Slurm settings for the queue. For more information, see [Custom Slurm settings for AWS PCS queues](slurm-custom-settings-queue.md). 
   +  **Tags** – Add or remove tags for the queue. 

1. Choose **Update**. The **Status** field will show *Updating* while changes are being applied.
**Important**  
Queue updates can take several minutes.

------
#### [ AWS CLI ]

**To update a queue**

1. Update your queue with the command that follows. Before running the command, make the following replacements:

   1. Replace *region-code* with the AWS Region that you want to create your cluster in.

   1. Replace *my-queue* with the name or `computeNodeGroupId` for your queue.

   1. Replace *my-cluster* with the name or `clusterId` of your cluster.

   1.  To change compute node group associations, provide an updated list for `--compute-node-group-configurations`. 

      1.  For example, to add a second compute node group `computeNodeGroupExampleID2`: 

        ```
        --compute-node-group-configurations computeNodeGroupId=computeNodeGroupExampleID1,computeNodeGroupId=computeNodeGroupExampleID2
        ```

   ```
   aws pcs update-queue --region region-code \
       --queue-identifier my-queue \
       --cluster-identifier my-cluster \
       --compute-node-group-configurations \
       computeNodeGroupId=computeNodeGroupExampleID1
   ```  
**Example – Updating a queue with custom Slurm settings**  

   ```
   aws pcs update-queue --region region-code \
       --queue-identifier my-queue \
       --cluster-identifier my-cluster \
       --slurm-configuration \
       'slurmCustomSettings=[{parameterName=Default,parameterValue=YES}]'
   ```

   For more information, see [Custom Slurm settings for AWS PCS queues](slurm-custom-settings-queue.md).

1. It can take several minutes to update the queue. You can query the status of your queue with the following command. You won't be able to submit jobs to the queue until its status reaches `ACTIVE`.

   ```
   aws pcs get-queue --region region-code \
       --cluster-identifier my-cluster \ 
       --queue-identifier my-queue
   ```

------

**Recommended next steps**
+ Submit a job to your updated queue.

# Deleting a queue in AWS PCS
Deleting a queue

This topic provides an overview of how to delete an queue in AWS PCS.

## Considerations when deleting a queue

+  If there are jobs running in the queue, they will be terminated by the scheduler when the queue is deleted. Pending jobs in the queue will be canceled. Consider waiting for jobs in the queue to finish or manually stop/cancel them using the scheduler’s native commands (such as `scancel` for Slurm). 

## Delete the queue


You can use the AWS Management Console or AWS CLI to delete a queue.

------
#### [ AWS Management Console ]

**To delete a queue**

1. Open the [AWS PCS console](https://console.aws.amazon.com/pcs/home#/clusters).

1. Select the cluster of the queue.

1. Navigate to **Queues** and select the queue to delete.

1. Choose **Delete**.

1. The **Status** field shows `Deleting`. It can take several minutes to complete.

**Note**  
You can use commands native to your scheduler to confirm that the queue is deleted. For example, use `sinfo` or `squeue` for Slurm. 

------
#### [ AWS CLI ]

**To delete a queue**
+  Use the following command to delete a queue, with these replacements: 
  +  Replace *region-code* with the AWS Region your cluster is in.
  +  Replace *my-queue* with the name or ID of your queue. 
  +  Replace *my-cluster* with the name or ID of your cluster. 

  ```
  aws pcs delete-queue --region region-code \
         --queue-identifier my-queue \
         --cluster-identifier my-cluster
  ```

   It can take several minutes to delete the queue.
**Note**  
You can use commands native to your scheduler to confirm that the queue is deleted. For example, use `sinfo` or `squeue` for Slurm. 

------