def empty_all_queues_api(): if request.method == 'POST': queue_names = [queue.name for queue in list_all_queues()] for queue in list_all_queues(): queue.empty() return { 'message': 'Successfully emptied queues {0}'.format(", ".join(queue_names)) }
def delete_all_queues_api(): if request.method == 'POST': queue_names = [queue.name for queue in list_all_queues()] for queue in list_all_queues(): queue.delete(delete_jobs=True) return { 'message': 'Successfully deleted queues {0}'.format(", ".join(queue_names)) }
def empty_all_queues_api(): if request.method == 'POST': queue_names = [queue.name for queue in list_all_queues()] for queue in list_all_queues(): queue.empty() return { 'message': 'Successfully emptied queues {0}'.format(", ".join(queue_names)) } else: raise RQMonitorException('Invalid HTTP Request type', status_code=400)
def list_queues_api(): queue_list = list_all_queues() rq_queues = [] for queue in queue_list: rq_queues.append({ 'queue_name': queue.name, 'job_count': queue.count, }) return { 'data': rq_queues, }