Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e46f93444b | ||
|
|
f1c9c32142 | ||
|
|
b75d36cc84 | ||
|
|
c7726fda01 |
No files matched your search
@@ -1,3 +1,6 @@
|
||||
[inet_http_server] ; inet (TCP) server disabled by default
|
||||
port=127.0.0.1:9001 ; ip_address:port specifier, *:port for all iface
|
||||
|
||||
[supervisord]
|
||||
nodaemon=true ; start in foreground if true; default false
|
||||
logfile=/var/log/supervisord/supervisord.log ; main log file; default $CWD/supervisord.log
|
||||
@@ -7,6 +10,9 @@ logfile_backups=10 ; # of main logfile backups; 0 means none, default
|
||||
loglevel=info ; log level; default info; others: debug,warn,trace
|
||||
user=root
|
||||
|
||||
[rpcinterface:supervisor]
|
||||
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
|
||||
|
||||
[program:gunicorn]
|
||||
command=gunicorn -c /usr/src/paperless/gunicorn.conf.py -b 0.0.0.0:8000 paperless.wsgi
|
||||
user=paperless
|
||||
|
||||
+24
-1
@@ -1,8 +1,11 @@
|
||||
from xmlrpc.client import ServerProxy
|
||||
|
||||
from django.db.models import Count, Max
|
||||
from django.http import HttpResponse, HttpResponseBadRequest, Http404
|
||||
from django.views.decorators.cache import cache_control
|
||||
from django.views.generic import TemplateView
|
||||
from django_filters.rest_framework import DjangoFilterBackend
|
||||
from django_q.status import Stat
|
||||
from rest_framework.decorators import action
|
||||
from rest_framework.filters import OrderingFilter, SearchFilter
|
||||
from rest_framework.mixins import (
|
||||
@@ -247,6 +250,23 @@ class SearchAutoCompleteView(APIView):
|
||||
return Response(index.autocomplete(self.ix, term, limit))
|
||||
|
||||
|
||||
def get_supervisor_process_info(process):
|
||||
try:
|
||||
server = ServerProxy('http://localhost:9001/RPC2')
|
||||
return server.supervisor.getProcessInfo(process)
|
||||
except Exception as e:
|
||||
return str(e)
|
||||
|
||||
|
||||
def get_django_q_status():
|
||||
stats = Stat.get_all()
|
||||
return [{
|
||||
"status": stat.status,
|
||||
"done_q_size": stat.done_q_size,
|
||||
"task_q_size": stat.task_q_size
|
||||
} for stat in stats]
|
||||
|
||||
|
||||
class StatisticsView(APIView):
|
||||
|
||||
permission_classes = (IsAuthenticated,)
|
||||
@@ -255,5 +275,8 @@ class StatisticsView(APIView):
|
||||
return Response({
|
||||
'documents_total': Document.objects.all().count(),
|
||||
'documents_inbox': Document.objects.filter(
|
||||
tags__is_inbox_tag=True).distinct().count()
|
||||
tags__is_inbox_tag=True).distinct().count(),
|
||||
'consumer_status': get_supervisor_process_info('consumer'),
|
||||
'scheduler_status': get_supervisor_process_info('scheduler'),
|
||||
'queue_status': get_django_q_status()
|
||||
})
|
||||
Reference in new issue
Block a user