File tree 2 files changed +19
-0
lines changed
dataworkspace/dataworkspace
2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change 3
3
from datetime import datetime , timedelta
4
4
5
5
from botocore .exceptions import ClientError
6
+ from celery import states
6
7
from dateutil .rrule import DAILY , rrule
7
8
8
9
from django import forms
19
20
from django .urls import reverse
20
21
from django .utils .timesince import timesince
21
22
from django .views .generic import FormView , CreateView , TemplateView
23
+ from django_celery_results .models import TaskResult
22
24
23
25
from dataworkspace .apps .applications .models import ApplicationInstance
24
26
from dataworkspace .apps .core .boto3_client import get_s3_client
@@ -524,4 +526,9 @@ def get_context_data(self, **kwargs):
524
526
perm_query_chart_data [day .date ()] = 0
525
527
ctx ["perm_query_chart_data" ] = sorted (perm_query_chart_data .items ())
526
528
529
+ # Number of failed celery tasks in the last 24 hours
530
+ ctx ["failed_celery_tasks_24_hours" ] = TaskResult .objects .filter (
531
+ date_done__gte = datetime .now () - timedelta (hours = 24 ), status = states .FAILURE
532
+ ).count ()
533
+
527
534
return ctx
Original file line number Diff line number Diff line change @@ -189,6 +189,18 @@ <h3>In the past 7 days</h3>
189
189
</ a >
190
190
</ div >
191
191
{% endif %}
192
+ {% if failed_celery_tasks_24_hours is not None %}
193
+ < div class ="stat{% if failed_celery_tasks_24_hours > 0 %} bad-news{% endif %} ">
194
+ < a
195
+ target ="_blank "
196
+ href ="{% url 'admin:django_celery_results_taskresult_changelist' %}?status__exact=FAILURE "
197
+ >
198
+ < h2 > Failed celery tasks</ h2 >
199
+ < h1 > {{ failed_celery_tasks_24_hours }}</ h1 >
200
+ < h3 > In the past 24 hours</ h3 >
201
+ </ a >
202
+ </ div >
203
+ {% endif %}
192
204
</ div >
193
205
{% if tool_start_chart_data is not None %}
194
206
< h1 > Tool start times</ h1 >
You can’t perform that action at this time.
0 commit comments