1
0
Fork 0

Adds celery status view

This commit is contained in:
Mouse Reeve 2022-09-14 18:57:08 -07:00
parent fcf796abe1
commit 0f55b76a93
6 changed files with 119 additions and 0 deletions

View file

@ -0,0 +1,59 @@
{% extends 'settings/layout.html' %}
{% load humanize %}
{% load i18n %}
{% load celery_tags %}
{% block title %}{% trans "Celery Status" %}{% endblock %}
{% block header %}{% trans "Celery Status" %}{% endblock %}
{% block panel %}
{% if stats %}
<section class="block content">
<h2>{% trans "Workers" %}</h2>
{% for worker_name, worker in stats.items %}
<div class="box">
<h3>{{ worker_name }}</h3>
{% trans "Uptime:" %} {{ worker.uptime|uptime }}
</div>
{% endfor %}
</section>
<section class="block content">
<h2>{% trans "Active Tasks" %}</h2>
{% for worker in active_tasks.values %}
<div class="table-container">
<table class="table is-striped is-fullwidth">
<tr>
<th>{% trans "ID" %}</th>
<th>{% trans "Task name" %}</th>
<th>{% trans "Start time" %}</th>
<th>{% trans "Priority" %}</th>
</tr>
{% for task in worker %}
<tr>
<td>{{ task.id }}</td>
<td>{{ task.name|shortname }}</td>
<td>{{ task.time_start|datestamp }} (UTC)</td>
<td>{{ task.delivery_info.routing_key }}</td>
</tr>
{% endfor %}
</table>
</div>
{% endfor %}
</section>
{% else %}
<div class="notification is-danger is-flex is-align-items-start">
<span class="icon icon-warning is-size-4 pr-3" aria-hidden="true"></span>
<span>
{% trans "Could not connect to Celery" %}
</span>
</div>
{% endif %}
{% endblock %}

View file

@ -74,6 +74,15 @@
</li>
</ul>
{% endif %}
{% if perms.edit_instance_settings %}
<h2 class="menu-label">{% trans "System" %}</h2>
<ul class="menu-list">
<li>
{% url 'settings-celery' as url %}
<a href="{{ url }}"{% if url in request.path %} class="is-active" aria-selected="true"{% endif %}>{% trans "Celery status" %}</a>
</li>
</ul>
{% endif %}
{% if perms.bookwyrm.edit_instance_settings %}
<h2 class="menu-label">{% trans "Instance Settings" %}</h2>
<ul class="menu-list">