feat(worker): Add db_worker service with automatic restart and logging
feat(task_overview): Display generated series in task overview docs(README): Update documentation for background task workers and troubleshooting
This commit is contained in:
@@ -57,6 +57,7 @@ Atlas Task Overview
|
||||
<tr>
|
||||
<th>Task</th>
|
||||
<th>Status</th>
|
||||
<th>Generated Series</th>
|
||||
<th>Queue</th>
|
||||
<th>Enqueued</th>
|
||||
<th>Started</th>
|
||||
@@ -83,6 +84,15 @@ Atlas Task Overview
|
||||
<span class="badge bg-secondary">{{ task.status }}</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td class="small">
|
||||
{% if task.generated_series %}
|
||||
{% for series in task.generated_series %}
|
||||
<a class="d-block" target="_blank" href="{{ series.url }}">{{ series.description }}</a>
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
<span class="text-muted">-</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>{{ task.queue_name }}</td>
|
||||
<td class="small">{{ task.enqueued_at|date:"Y-m-d H:i:s" }}</td>
|
||||
<td class="small">{{ task.started_at|date:"Y-m-d H:i:s" }}</td>
|
||||
@@ -92,7 +102,7 @@ Atlas Task Overview
|
||||
</tr>
|
||||
{% empty %}
|
||||
<tr>
|
||||
<td colspan="8" class="text-muted">No tasks found for this filter.</td>
|
||||
<td colspan="9" class="text-muted">No tasks found for this filter.</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
|
||||
+23
-2
@@ -828,9 +828,30 @@ def task_overview(request):
|
||||
|
||||
base_qs = DBTaskResult.objects.all().order_by("-enqueued_at")
|
||||
if selected_status in status_map:
|
||||
tasks = base_qs.filter(status__in=status_map[selected_status])[:300]
|
||||
tasks = list(base_qs.filter(status__in=status_map[selected_status])[:300])
|
||||
else:
|
||||
tasks = base_qs[:300]
|
||||
tasks = list(base_qs[:300])
|
||||
|
||||
for task in tasks:
|
||||
generated_series = []
|
||||
payload = task.return_value
|
||||
|
||||
if isinstance(payload, str):
|
||||
try:
|
||||
payload = json.loads(payload)
|
||||
except Exception:
|
||||
payload = None
|
||||
|
||||
if isinstance(payload, dict):
|
||||
for item in payload.get("created_series", []) or []:
|
||||
if not isinstance(item, dict):
|
||||
continue
|
||||
url = item.get("url")
|
||||
description = item.get("description") or str(item.get("id", "Series"))
|
||||
if url:
|
||||
generated_series.append({"url": url, "description": description})
|
||||
|
||||
task.generated_series = generated_series
|
||||
|
||||
counts = {
|
||||
"active": DBTaskResult.objects.filter(status__in=["READY", "RUNNING"]).count(),
|
||||
|
||||
Reference in New Issue
Block a user