Create Queues#
This how-to explains how to build Queues in Dioptra. Queues logically represent a queue of jobs for workers to pull from.
Note
In order for a queue to be effective, Workers which listen on that queue are necessary.
If the worker is already created and running, check what queue name it is using and create if it doesn’t exist.
If the queue you created has no worker, then you will need to start one, as the jobs sent to that queue will not be processed without a worker.
Prerequisites#
Prepare Your Deployment - A deployment of Dioptra is required.
Set Up Dioptra in the GUI - Access Dioptra services in the GUI, create a user, and login.
Prepare Your Deployment - A deployment of Dioptra is required.
Set Up the Python Client - Connect to the Python Client in a Jupyter Notebook.
Queue Creation Workflow#
Follow these steps to create and register a new queue. You can perform these actions via the Graphical User Interface (GUI) or programmatically using the Python Client.
Step 1: Create the Queue#
Register a queue for a specific group, with a name and a description.
In the Dioptra GUI, navigate to the Queues tab. Click Create. Enter a name and, optionally, a description, select a group for the queue, then click Confirm.
Note
Dioptra does not currently support the creation of additional groups. All resources are under the same default public group.
Client Method:
Use the client to create the queue.
- QueuesCollectionClient.create(group_id: int, name: str, description: str | None = None) dioptra.client.queues.T[source]#
Creates a queue.
- Parameters
group_id – The id of the group that will own the queue.
name – The name of the new queue.
description – The description of the new queue. Optional, defaults to None.
- Returns
The response from the Dioptra API.
Step 2: Associate your Queue with Existing Entrypoints#
In the Dioptra GUI, navigate to the Entrypoints tab. Click one of the existing entrypoints to add the newly created queue to.
Under Basic Info, select the queue you just created for Queues. Click Submit Entrypoint when finished.
Client Method:
Use the client to update the entrypoint with the id of the queue.
- EntrypointQueuesSubCollectionClient.modify_by_id(entrypoint_id: str | int, queue_ids: list[int]) dioptra.client.entrypoints.T[source]#
Replaces the entrypoint’s full list of queues.
If an empty list is provided, then all queues will be removed from the entrypoint.
- Parameters
entrypoint_id – The entrypoint id, an integer.
queue_ids – A list of queue ids that will replace the current list of entrypoint queues.
- Returns
The response from the Dioptra API.
See Also#
Queues and Workers Explanation - Understand what queues and workers are for.
Queues Reference - Queues reference page.