mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Include worker status in main API call
This commit is contained in:
parent
78bcbe271a
commit
f6f3815f31
@ -19,6 +19,7 @@ from rest_framework.views import APIView
|
|||||||
|
|
||||||
from .views import AjaxView
|
from .views import AjaxView
|
||||||
from .version import inventreeVersion, inventreeApiVersion, inventreeInstanceName
|
from .version import inventreeVersion, inventreeApiVersion, inventreeInstanceName
|
||||||
|
from .status import is_worker_running
|
||||||
|
|
||||||
from plugins import plugins as inventree_plugins
|
from plugins import plugins as inventree_plugins
|
||||||
|
|
||||||
@ -44,6 +45,7 @@ class InfoView(AjaxView):
|
|||||||
'version': inventreeVersion(),
|
'version': inventreeVersion(),
|
||||||
'instance': inventreeInstanceName(),
|
'instance': inventreeInstanceName(),
|
||||||
'apiVersion': inventreeApiVersion(),
|
'apiVersion': inventreeApiVersion(),
|
||||||
|
'worker_running': is_worker_running(),
|
||||||
}
|
}
|
||||||
|
|
||||||
return JsonResponse(data)
|
return JsonResponse(data)
|
||||||
|
@ -31,7 +31,7 @@ def health_status(request):
|
|||||||
request._inventree_health_status = True
|
request._inventree_health_status = True
|
||||||
|
|
||||||
status = {
|
status = {
|
||||||
'django_q_running': InvenTree.status.is_q_cluster_running(),
|
'django_q_running': InvenTree.status.is_worker_running(),
|
||||||
}
|
}
|
||||||
|
|
||||||
all_healthy = True
|
all_healthy = True
|
||||||
|
@ -14,9 +14,9 @@ from django_q.monitor import Stat
|
|||||||
logger = logging.getLogger("inventree")
|
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()
|
clusters = Stat.get_all()
|
||||||
@ -52,7 +52,7 @@ def check_system_health(**kwargs):
|
|||||||
|
|
||||||
result = True
|
result = True
|
||||||
|
|
||||||
if not is_q_cluster_running(**kwargs):
|
if not is_worker_running(**kwargs):
|
||||||
result = False
|
result = False
|
||||||
logger.warning(_("Background worker check failed"))
|
logger.warning(_("Background worker check failed"))
|
||||||
|
|
||||||
|
@ -107,4 +107,5 @@ volumes:
|
|||||||
type: none
|
type: none
|
||||||
o: bind
|
o: bind
|
||||||
# This directory specified where InvenTree data are stored "outside" the docker containers
|
# 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
|
||||||
|
Loading…
Reference in New Issue
Block a user