Include worker status in main API call

This commit is contained in:
Oliver Walters 2021-04-11 13:58:59 +10:00
parent 78bcbe271a
commit f6f3815f31
4 changed files with 8 additions and 5 deletions

View File

@ -19,6 +19,7 @@ from rest_framework.views import APIView
from .views import AjaxView
from .version import inventreeVersion, inventreeApiVersion, inventreeInstanceName
from .status import is_worker_running
from plugins import plugins as inventree_plugins
@ -44,6 +45,7 @@ class InfoView(AjaxView):
'version': inventreeVersion(),
'instance': inventreeInstanceName(),
'apiVersion': inventreeApiVersion(),
'worker_running': is_worker_running(),
}
return JsonResponse(data)

View File

@ -31,7 +31,7 @@ def health_status(request):
request._inventree_health_status = True
status = {
'django_q_running': InvenTree.status.is_q_cluster_running(),
'django_q_running': InvenTree.status.is_worker_running(),
}
all_healthy = True

View File

@ -14,9 +14,9 @@ from django_q.monitor import Stat
logger = logging.getLogger("inventree")
def is_q_cluster_running(**kwargs):
def is_worker_running(**kwargs):
"""
Return True if at least one cluster worker is running
Return True if the background worker process is oprational
"""
clusters = Stat.get_all()
@ -52,7 +52,7 @@ def check_system_health(**kwargs):
result = True
if not is_q_cluster_running(**kwargs):
if not is_worker_running(**kwargs):
result = False
logger.warning(_("Background worker check failed"))

View File

@ -107,4 +107,5 @@ volumes:
type: none
o: bind
# This directory specified where InvenTree data are stored "outside" the docker containers
device: c:/abcdef
# Change this path to a local system path where you want InvenTree data stored
device: /path/to/data