# Queues

## What is a Queue?

A queue is the bread and butter of Qutex. It is the main component of a project. Queues are what manage the individual people for a particular resource. There can be multiple queues on a project. But only one queue is set as the default queue.. In qutex, people are stored in queues. Individuals can add/remove themselves or add/remove others.

## Creating a New Queue

You can create a qutex queue with the command:

create queue <queue_name>

create queue valid

create queue NOT&^%VALID

^\s*create queue [\w\s]+\s*$ Warning Queue names must be unique in qutex. Thus, you cannot create a queue with a name that already exists. Additionally, the name of the queue can only contain lowercase and uppercase alphabetical characters, spaces, and the underscore. Note Your queue will automatically be put in uppercase regardless of how it was entered When you issue the create queue command, Qutex will create an empty queue for you. This queue will not be utilized until you set it as the current queue. Success You can verify your queue was created by issueing the list queues command ## Modifying a Queue Name Unfortunately, modifying the name of an existing queue is not currently possible with Qutex. You would need to delete the queue and create a new one with the new name. ## Deleting a Queue You can delete a qutex queue with the command: delete queue <queue_name>  delete queue valid  delete queue NOT&^%VALID  ^\s*delete queue [\w\s]+\s*$

Warning

There must always be at least one queue configured on each project. If you try to delete the final queue on a project, you will not be permitted to do so.

Warning

You cannot delete the current queue. All projects require one current queue at all times. If you try to delete the current queue, you will not be permitted to do so.

Danger

Queue deletions are permanant and they cannot be recovered after deletion.

Success

You can verify your queue was deleted by issueing the list queues command

## Listing the Queues in a Project

Listing all queues in a project is possible with qutex by issuing the following command:

list queues

^\s*list queues\s*$ Note When you list the queues, an asterisk (*) will appear next to the current queue. You can change this by using the set current queue to(/queues/#changing-the-current-queue) command ## What is the Default Queue? The default queue is the queue that is automatically created in your project when it is first created. The name of this queue is always "DEFAULT". You can immediately begin using the default queue after a project has been created without needing to manually create a queue. However, you are also able to create your own queue if you so choose. You are not limitted by the existing of the default queue in any way. ## What is the Current Queue? In qutex, any action you perform on a queue within a project is, by default, performed on the current queue. Because you can have multiple queues in a project, you are able to change the current queue as the needs of your resource management demands. You can also use the queue suffix with relevant commands to operate on non-current queues. ### Changing the Current Queue You can change the current queue using the following command: set current queue to <queue_name>  set current queue to valid  set current queue to NOT&^%VALID  ^\s*set (current )?queue to [\w\s]+\s*$

Note

Every project must always have one and only one current queue at a time. If you try to delete the current queue, you will not be permitted to do so until the current queue is changed.

Success

You can verify the current queue was changed by issueing the list queues command

## Using a Queue

### Operating on Non-Current Queues

By default, all the commands in this section operate on the current queue. However, for any of these commands, you can operate on the non-current queue by adding the following to the end of any of the commands:

on queue <queue_name>

add person valid on queue validQ

add person valid on queue NOT&^%VALID

^\s*((to|on|for|with|from) queue {queue:[\\w\\s]+})?\s*$ ### Adding Myself into a Queue You can add yourself to the current queue using the following command: add me  ^\s*add me\s*$

Note

You can add yourself as many times as you want into a project.

Success

You can verify that you were added to the current queue by issueing the get queue command

### Removing Myself from a Queue

You can remove yourself from the current queue using the following command:

remove me

^\s*remove me\s*$ Note If you exist more than once within the queue, the front-most queue position will be removed. Success You can verify that you were removed from the current queue by issueing the get queue command ### Adding others into a Queue You can add other members within the same space to the current queue using the following command: add person <queue_name>  add person valid  add person NOT&^%VALID  ^\s*add person \S+?(\s\S+?)?\s*$

Important

You must tag the person to add them into the queue.

Success

You can verify that you successfully added the target person to the current queue by issueing the get queue command

### Removing Others from a Queue

You can remove other members within the same space from the current queue using the following command:

remove person <queue_name>

remove person valid

remove person NOT&^%VALID

^\s*remove person \S+?(\s\S+?)?\s*$ Important You must tag the person to remove them into the queue. Note If you exist more than once within the queue, the front-most queue position will be removed. Success You can verify that you successfully removed the target person from the current queue by issueing the get queue command ### Showing the Members in the Queue You can list out the members of a queue by issueing the following command: get queue  ^\s*get queue( \w+)?\s*$

Example
Queue "DEFAULT":

1. Ava Thorn (May 19, 2021 12:55:01 AM EST)
2. Bill Nye (May 19, 2021 12:55:05 AM EST)

Queue "DEFAULT" is empty


### Getting Estimated Time Remaining for Me

Qutex can give you an estimated time remaining until you are moved to the head of the queue. The formulas to do this are outline below:

Formula

$$f$$ is the function to calculate how long until a person in queue position $$n$$ reaches the head of the queue.

$\begin{equation*} f(\gamma, n)=\begin{cases} 0 \quad &\text{if} \, n = 0\\ \max(g(\gamma, 0) - \alpha, 0) \quad &\text{if} \, n = 1 \\ g(\gamma, n) + f(h(\gamma), n-1)) \quad &\text{if} \, n \notin {0,1} \\ \end{cases} \end{equation*}$

$$\gamma$$ represents the current queue data. $$\alpha$$ is the amount of time that has elapsed since the current head of the queue was promoted.

$$g$$ is the function which calculates average time to flush a person, whom is currently at queue position $$n$$, from the head of the queue.

$\begin{equation*} g(\gamma, n)=\begin{cases} 0 \quad &\text{if} \, n = 0\\ \frac{\beta}{|\beta|} \quad &\text{if} \, n \neq 0 \\ \end{cases} \end{equation*}$

$$\beta$$ is the number of seconds total that the person at position $$n$$ in $$\gamma$$ has ever been at the head of the queue.
$$|\beta|$$ is the number of times that the person at position $$n$$ in $$\gamma$$ has ever been at the head of the queue.

$$h$$ is a function that produces the current queue except with the current head removed and all the members shifted up one.

Note

This is just an estimation and can never be 100% accurate

To get this estimation, you can use the following command:

how long

^\s*how long\s*$ Example Given that there is 1 person ahead of you. Your estimated wait time is 00:01:51 ### Getting Largest Queue Depth Qutex can give you the largest queue depth for a given queue over the entire lifetime of that queue. You can do this by invoking the following command: get largest queue depth  ^\s*get largest queue depth\s*$


Once invoked, Qutex will return the maximum depth that the queue has ever been as well as the date and time of when that depth last occurred.

Example

Largest Depth is: 1 This occurred at: Thu May 13 2021 04:52:29 GMT+0000 (Coordinated Universal Time)