Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AlekSIS-Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AlekSIS®
Official
AlekSIS-Core
Commits
e51f4a7a
Verified
Commit
e51f4a7a
authored
5 years ago
by
Tom Teichler
Browse files
Options
Downloads
Patches
Plain Diff
Show celery task results on system status page
parent
69e77c86
No related branches found
No related tags found
1 merge request
!281
Resolve "Add overview page for celery task results"
Pipeline
#2283
failed
5 years ago
Stage: test
Stage: build
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
aleksis/core/templates/core/system_status.html
+64
-0
64 additions, 0 deletions
aleksis/core/templates/core/system_status.html
aleksis/core/views.py
+11
-0
11 additions, 0 deletions
aleksis/core/views.py
with
75 additions
and
0 deletions
aleksis/core/templates/core/system_status.html
+
64
−
0
View file @
e51f4a7a
...
...
@@ -62,4 +62,68 @@
</div>
</div>
</div>
{% if tasks %}
<div
class=
"card"
>
<div
class=
"card-content"
>
<span
class=
"card-title"
>
{% blocktrans %}Celery task results{% endblocktrans %}
</span>
<table>
<thead>
<tr>
<th>
{% trans "Task" %}
</th>
<th>
{% trans "ID" %}
</th>
<th>
{% trans "Date done" %}
</th>
<th>
{% trans "Status" %}
</th>
</tr>
</thead>
<tbody>
{% for task in tasks %}
{% if task != None %}
<tr>
<td>
{{ task.task_name }}
</td>
<td>
{{ task.task_id }}
</td>
<td>
{{ task.date_done }}
</td>
<td>
{% if task.status == "PENDING" %}
<a
class=
"tooltipped"
data-position=
"top"
data-tooltip=
"{{ task.status }}"
>
<i
class=
"material-icons tiny orange-text"
>
hourglass_empty
</i>
</a>
{% elif task.status == "STARTED" %}
<a
class=
"tooltipped"
data-position=
"top"
data-tooltip=
"{{ task.status }}"
>
<i
class=
"material-icons tiny orange-text"
>
directions_run
</i>
</a>
{% elif task.status == "SUCCESS" %}
<a
class=
"tooltipped"
data-position=
"top"
data-tooltip=
"{{ task.status }}"
>
<i
class=
"material-icons tiny green-text"
>
done
</i>
</a>
{% elif task.status == "FAILURE" %}
<a
class=
"tooltipped"
data-position=
"top"
data-tooltip=
"{{ task.status }}"
>
<i
class=
"material-icons tiny red-text"
>
error
</i>
</a>
{% elif task.status == "RETRY" %}
<a
class=
"tooltipped"
data-position=
"top"
data-tooltip=
"{{ task.status }}"
>
<i
class=
"material-icons tiny orange-text"
>
hourglass_full
</i>
</a>
{% elif task.status == "REVOKED" %}
<a
class=
"tooltipped"
data-position=
"top"
data-tooltip=
"{{ task.status }}"
>
<i
class=
"material-icons tiny red-text"
>
clear
</i>
</a>
{% endif %}
</td>
</tr>
{% endif %}
{% endfor %}
</tbody>
</table>
</div>
</div>
{% endif %}
{% endblock %}
This diff is collapsed.
Click to expand it.
aleksis/core/views.py
+
11
−
0
View file @
e51f4a7a
from
itertools
import
chain
from
typing
import
Optional
from
django.apps
import
apps
from
django.conf
import
settings
from
django.contrib.auth.mixins
import
PermissionRequiredMixin
from
django.core.exceptions
import
PermissionDenied
from
django.core.paginator
import
Paginator
...
...
@@ -295,6 +297,15 @@ def system_status(request: HttpRequest) -> HttpResponse:
"""
View giving information about the system status.
"""
context
=
{}
if
"
django_celery_results
"
in
settings
.
INSTALLED_APPS
:
from
django_celery_results.models
import
TaskResult
# noqa
from
celery.task.control
import
inspect
# noqa
job_list
=
list
(
inspect
().
registered_tasks
().
values
())[
0
]
results
=
[]
for
job
in
job_list
:
results
.
append
(
TaskResult
.
objects
.
filter
(
task_name
=
job
).
last
())
context
[
"
tasks
"
]
=
results
return
render
(
request
,
"
core/system_status.html
"
,
context
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment