Private
Public Access
1
0

added failed jobs queue view

This commit is contained in:
Sander Roosendaal
2019-08-20 16:44:13 +02:00
parent fc479c2b61
commit 5f5778e759
3 changed files with 78 additions and 0 deletions

View File

@@ -0,0 +1,47 @@
{% extends "newbase.html" %}
{% load staticfiles %}
{% load rowerfilters %}
{% block title %}Failed Que{% endblock %}
{% block main %}
<h1>Failed Que</h1>
<ul class="main-content">
<li class="maxheight grid_4">
<table width="100%" class="listtable shortpadded">
<thead>
<tr>
<th>Started at</th>
<th>Job Function</th>
<th>Traceback</th>
</tr>
</thead>
<tbody>
{% for job in results %}
<tr>
<td>{{ job|lookup:started_at }}</td>
<td>{{ job|lookup:func_name }}</td>
<td>{{ job|lookup:traceback }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</li>
<li class="grid_4">
{{ the_div|safe }}
</li>
</ul>
{% endblock %}
{% block sidebar %}
{% include 'menu_analytics.html' %}
{% endblock %}

View File

@@ -138,6 +138,7 @@ urlpatterns = [
path('403/', TemplateView.as_view(template_name='403.html'),name='403'),
# re_path(r'^imports/$', views.imports_view),
re_path(r'^exportallworkouts/?/$',views.workouts_summaries_email_view,name='workouts_summaries_email_view'),
path('failedjobs/',views.failed_queue_view,name='failed_queue_view'),
re_path(r'^update_empower/$',views.rower_update_empower_view,name='rower_update_empower_view'),
re_path(r'^agegroupcp/(?P<age>\d+)/$',views.agegroupcpview,name='agegroupcpview'),
re_path(r'^agegroupcp/(?P<age>\d+)/(?P<normalize>\d+)/$',views.agegroupcpview,name='agegroupcpview'),

View File

@@ -5,6 +5,36 @@ from __future__ import unicode_literals
from rowers.views.statements import *
from rq import Queue
from redis import Redis
@login_required()
def failed_queue_view(request):
if not request.user.is_staff:
raise PermissionDenied("Not Allowed")
q = Queue('failed', connection=Redis())
results = []
for job in q.jobs:
traceback = job.exc_info
info = {
'started_at': job.started_at,
'func_name': job.func_name,
'traceback': traceback
}
results.append(info)
return render(request,
"failed_jobs.html",
{
'results':results,
}
)
@login_required()
def errormessage_view(request,errormessage='aap'):
if (errormessage=='3dsecure'):