Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /swf-monitor/src/monitor_app/viewdir/panda_census.py was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 """The per-queue job census as JSON (monitor_app/panda/census.py): the
0002 dispatcher's pressure input and the ready-queue page's source.
0003 ``?refresh=1`` rebuilds the hourly calibration."""
0004 import logging
0005 
0006 from django.http import JsonResponse
0007 
0008 from monitor_app.panda.census import queue_census
0009 
0010 logger = logging.getLogger(__name__)
0011 
0012 
0013 def panda_queue_census_json(request):
0014     refresh = str(request.GET.get('refresh', '')).lower() in ('1', 'true', 'yes')
0015     try:
0016         data = queue_census(refresh=refresh)
0017     except Exception as exc:  # noqa: BLE001
0018         logger.exception("queue census failed")
0019         return JsonResponse({'error': f'{type(exc).__name__}: {exc}'}, status=503)
0020     return JsonResponse(data)