As a user, it would be helpful to view the current status of the configured Celery workers.
For example, this bug, which may or may not be a bug - would be better triaged if we knew that the Celery workers were up and running. Currently, the user is expected to know how to use the CLI to execute various commands. It would be much easier to display this information within the UI.
Worker application
A new application will be added to the project for handling this feature, and future worker-based functionality: worker.
Status View
The new application will provide a single view to get the status of the local celery worker: /worker/status. This view will return the HTML element to render the status icon within the navbar (described below). It's expected that this view is called via an HTMX polling mechanism.
The status of the workers can be fetched using the following logic:
from chirps.celery import app
inspection = app.inspect()
result = i.ping()
# Result: {'w1@fc74cd718b1d': {'ok': 'pong'}}
Details of each worker can be fetched using the stats() method:
In the event Celery is running, but the message broker (RabbitMQ) is NOT, an exception will be raised.
>>> i.stats()
...
ConnectionResetError: [Errno 104] Connection reset by peer
UI Changes
In the navbar, justified to the right side, a new status icon will be displayed. The icon will be a simple green, yellow, or red dot. When the user's mouse is over the dot, any textual information about the status of the worker should be displayed.
An HTMX polling (5 second) trigger will be setup to automatically update the status indicator. It should call the status view described above and replace the contents of the status container div with the result.
Initial implementation complete. Will be adding a follow-on ticket to make the status polling route faster. The UI currently takes too long to respond to the request.
As a user, it would be helpful to view the current status of the configured Celery workers.
For example, this bug, which may or may not be a bug - would be better triaged if we knew that the Celery workers were up and running. Currently, the user is expected to know how to use the CLI to execute various commands. It would be much easier to display this information within the UI.
Worker application
A new application will be added to the project for handling this feature, and future worker-based functionality:
worker
.Status View
The new application will provide a single view to get the status of the local celery worker:
/worker/status
. This view will return the HTML element to render the status icon within the navbar (described below). It's expected that this view is called via an HTMX polling mechanism.The status of the workers can be fetched using the following logic:
Details of each worker can be fetched using the
stats()
method:In the event Celery is running, but the message broker (RabbitMQ) is NOT, an exception will be raised.
UI Changes
In the navbar, justified to the right side, a new status icon will be displayed. The icon will be a simple green, yellow, or red dot. When the user's mouse is over the dot, any textual information about the status of the worker should be displayed.
An HTMX polling (5 second) trigger will be setup to automatically update the status indicator. It should call the status view described above and replace the contents of the status container
div
with the result.