# Quickstart¶

This section gives an introduction about senaite.queue. It assumes you have SENAITE LIMS and senaite.queue already installed, with a consumer listening at port 8089, the queue server listening at port 8090 and a regular zeo client listening at port 8080. Please read the Installation for further details.

## Queue control panel¶

Visit the control panel view for senaite.queue to configure the settings. This control panel is accessible to users with Site Administrator role, through “Site Setup” view, “Add-on Configuration” section:

http://localhost:8080/senaite/@@queue-controlpanel

In most cases, the settings that come by default will fit well. Modifying some of them might speed-up the processing of queued tasks, but might also increase the chance of conflicts. Therefore, is strongly recommended to monitor the instance while modifying this settings:

• Queue server: URL of the zeo client that will act as the queue server. This is, the zeo client others will rely on regarding tasks addition, retrieval and removal. An empty value or a non-reachable queue server disables the asynchronous processing of tasks. In such case, system will behave as if senaite.queue was not installed.
• Number of objects to process per task: This is the default number of objects to process in a single request when the task contains multiple items. The items from a task are processed in chunks, and remaining are re-queued for later. For instance, when a user selects multiple analyses for their assignment to a worksheet, only one task is generated. If the value defined is 5, the analyses will be assigned in chunks of this size, and the system will keep generating tasks for the remaining analyses until all them are finally assigned. Higher values increment the chance of transaction commit conflicts, while lower values tend to slow down the completion of the whole task. A value of 0 disables queueing if tasks functionality at all.
• Maximum retries: Number of times a task will be re-queued before being considered as failed. A value of 0 disables the re-queue of failing tasks.
• Minimum seconds: Minimum number of seconds to book per task. If the task is performed very rapidly, it will have priority over a transaction done from userland. In case of conflict, the transaction from userland will fail and will be retried up to 3 times. This setting makes the thread that handles the task to take some time to complete, thus preventing threads from userland to be delayed or fail.
• Maximum seconds: Number of seconds to wait for a task to finish before being re-queued or considered as failed. System will keep retrying the task until the value set in ‘Maximum retries’ is reached, at which point the task will be eventually considered as failed and no further actions will take place.
• Auth secret key: This secret key is used by senaite.queue to generate an encrypted token (symmetric encryption) for the authentication of requests sent by queue clients and consumers to the Queue’s server API. Must be 32 url-safe base64-encoded bytes.

Login as a SENAITE regular user with “Lab Manager” privileges. Be sure there are some analyses awaiting for assignment and create a worksheet, either by manually assigning some analyses or by using a Worksheet Template. As soon as the worksheet is created, the system displays a viewlet stating that some analyses have been queued for the current worksheet:

Keep pressing the “Refresh” button and the message will eventually disappear, as soon as the reserved client finishes processing the task.

Note

If you don’t see any change after refreshing the page several times, check that you have the consumer client running in background and the reserved user is properly configured.

## Queue monitoring¶

The queue monitoring view is accessible from the top-right “hamburger” menu, link “Queue Monitor”:

The failed, running and queued tasks are displayed in this view, along with their Task Unique Identifiers (TUIDs). From this view, the user can manually re-queue or remove tasks at a glance:

Failed tasks shouldn’t be the norm, but there is always the chance that a task cannot complete. In order to provide insights about the reason/s behind a failure, the monitor listing displays also the error trace raised by the system when trying to process the task.

Given a TUID, the user can see the whole information of a given task in JSON format. The TUID of each task displayed in the Queue Monitoring view explained above is a link to the full detail of the task:

{
"status": "queued",
"context_uid": "67127b454506455f81d69921beec4e93",
"context_path": "/senaite/worksheets/WS-018",
"retries": 5,
"uids": [
"bc0c7489fa974e74b68a680568608277",
"7e6cc0c0de9449ca953dd8b7dfaffb96",
"2f8f2a05faa14af19545e9f08b4b282c",
"b2bd04cb1755493186bea52a50f37326",
"ef19831a8ef9467db401008c1269b937"
],
"created": 1598626797.74663,
"error_message": null,