# Monitoring With Flower

**Accessing the Flower Web Interface**

Once the installation of Blurit is complete, Flower's web interface is accessible at:

```arduino
http://<your-server-address>/flower
```

Use the **username** and **password** configured during the installation of Blurit to log in.

**Overview of the Interface**

The Flower interface provides an intuitive way to monitor and manage Celery tasks and workers in real-time. Below is a detailed breakdown of the key sections and columns in the interface.

## **Dashboard: Monitoring Workers Overview**

The **Dashboard** tab in Flower provides an overview of all Celery workers currently running. This page allows you to quickly monitor worker states and performance.

**Column Descriptions**

1. **Worker Name**
   * Displays the unique name of each worker. Typically, the name is prefixed with `celery@` followed by a unique identifier (often based on the hostname).
   * Example: `celery@18e5d5189283`.
2. **Status**
   * Indicates the current status of the worker.
   * **Online**: The worker is active and communicating with the broker.
   * **Offline**: The worker is not responding or has been stopped.
3. **Active**
   * The number of tasks currently being processed by this worker.
   * A high value here relative to the worker’s capacity could indicate overload.
4. **Processed**
   * The total number of tasks processed by the worker since it started.
5. **Failed**
   * The total number of tasks that have failed on this worker.
   * A high number may indicate recurring issues with specific tasks or code.
6. **Succeeded**
   * The total number of tasks successfully executed by the worker.
7. **Retried**
   * The number of tasks that were retried after encountering a temporary error.
8. **Load Average**
   * The system's average load (CPU, memory) for the container or machine running the worker.
   * Format: `1 min, 5 min, 15 min`.
   * Example: `0.19, 0.08, 0.08` indicates a low load across all three timeframes.

**Available Actions**

* **Search Bar**: Use the search bar in the top-right corner to filter workers by name or other attributes. This is helpful when managing many workers.
* **Refresh**: Click the **Refresh** button to update the data displayed on the dashboard.

<figure><img src="https://content.gitbook.com/content/ejQQoBIUq71CgqlkafeW/blobs/vbJRfBpgQI5mb30dUufy/Screenshot%20from%202024-11-19%2011-00-58.png" alt=""><figcaption></figcaption></figure>

## **Tasks: Monitoring and Managing Individual Tasks**

The **Tasks** tab in Flower allows you to monitor the state and details of individual Celery tasks in real-time. This tab is especially useful for diagnosing specific issues or analyzing task performance.

**Column Descriptions**

1. **Name**
   * The name of the task, as defined in your Celery code.
   * Example: `blurit.image`.
   * This typically corresponds to a function or method in your application.
2. **UUID**
   * A unique identifier for each task, useful for debugging or referencing specific tasks.
   * Example: `c2e583bc-1dc9-4193-9df5-fe412aa0b180`.
3. **State**
   * The current state of the task.
   * Common states include:
     * **PENDING**: The task is waiting to be executed.
     * **STARTED**: The task is currently running.
     * **SUCCESS**: The task has completed successfully.
     * **FAILURE**: The task execution failed.
   * Example in the screenshot: **SUCCESS**.
4. **args**
   * The positional arguments passed to the task when it was executed.
   * Example: `()` (no positional arguments in this case).
5. **kwargs**
   * The keyword arguments (named parameters) passed to the task.
   * Example:

     ```json
     jsonCopier le code{
         "input_image": {"protocol": "file", "path": "input/1732010550292-480.jpg"},
         "output_image": {"protocol": "file", "path": "output/878ac326-2b6c-482e-9888-e4346d285ad0.jpg"},
         "lifespan": 3600
     }
     ```
6. **Result**
   * The result returned by the task after execution.
   * Example (summary):

     ```json
     jsonCopier le code{
         "input_image": {"protocol": "file", "path": "input/1732010550292-480.jpg"},
         "output_image": {"protocol": "file", "path": "output/878ac326-2b6c-482e-9888-e4346d285ad0.jpg"},
         "chronos": {"total": 2.219586, "childs": {...}}
     }
     ```
7. **Received**
   * The timestamp when the task was received by the worker.
   * Example: `2024-11-19 10:02:30.472`.
8. **Started**
   * The timestamp when the task started execution.
   * Example: `2024-11-19 10:02:30.478`.
9. **Runtime**
   * The total time the task took to execute, in seconds.
   * Example: `2.733`.
10. **Worker**
    * The Celery worker that executed the task.
    * Example: `celery@83b122840b58`.

<figure><img src="https://content.gitbook.com/content/ejQQoBIUq71CgqlkafeW/blobs/6TU5LcNl1YYG2XAwa4kg/Screenshot%20from%202024-11-19%2011-02-45.png" alt=""><figcaption></figcaption></figure>

## **Usage Tips**

1. **Search for Tasks**
   * Use the search bar to filter tasks by **UUID**, **Name**, or **State**. This is especially helpful when dealing with large numbers of tasks.
2. **Diagnose Failures**
   * For tasks in the **FAILURE** state, the `kwargs` and `Result` columns provide valuable details about what went wrong.
3. **Performance Optimization**
   * Use the `Runtime` column to identify tasks that take a long time to execute, which may need optimization.
4. **Input and Output Validation**
   * The `kwargs` and `Result` columns are also useful for verifying the input and output data of specific tasks.
