def qlen(queuename): request_inputs = common.do_request_prep(connexion.request, default_params={}) try: qlen = simplequeue.qlen(queuename) return_object = str(qlen) httpcode = 200 except Exception as err: return_object = str(err) httpcode = 500 return (return_object, httpcode)
def status(): request_inputs = common.do_request_prep(connexion.request, default_params={}) return_object = {'busy': False, 'up': True, 'message': 'all good'} try: queue_detail = {} try: queuenames = simplequeue.get_queuenames() for queuename in queuenames: queue_detail[queuename] = {} qlen = simplequeue.qlen(queuename) queue_detail[queuename]['qlen'] = qlen except: pass return_object['detail'] = queue_detail httpcode = 200 except Exception as err: return_object = str(err) httpcode = 500 return (return_object, httpcode)