def queries_tasks(): global_limit = int(request.args.get('limit', 50)) waiting_limit = int(request.args.get('waiting_limit', global_limit)) progress_limit = int(request.args.get('progress_limit', global_limit)) done_limit = int(request.args.get('done_limit', global_limit)) waiting = QueryTaskTracker.all(QueryTaskTracker.WAITING_LIST, limit=waiting_limit) in_progress = QueryTaskTracker.all(QueryTaskTracker.IN_PROGRESS_LIST, limit=progress_limit) done = QueryTaskTracker.all(QueryTaskTracker.DONE_LIST, limit=done_limit) record_event( current_org, current_user, { 'action': 'view', 'object_type': 'api_call', 'object_id': 'admin/tasks', 'timestamp': int(time.time()), }) response = { 'waiting': [t.data for t in waiting if t is not None], 'in_progress': [t.data for t in in_progress if t is not None], 'done': [t.data for t in done if t is not None] } return json_response(response)
def queries_tasks(): waiting = QueryTaskTracker.all(QueryTaskTracker.WAITING_LIST) in_progress = QueryTaskTracker.all(QueryTaskTracker.IN_PROGRESS_LIST) done = QueryTaskTracker.all(QueryTaskTracker.DONE_LIST, limit=50) response = { 'waiting': [t.data for t in waiting], 'in_progress': [t.data for t in in_progress], 'done': [t.data for t in done] } return json_response(response)
def test_removes_oldest_items_first(self): remove_count = QueryTaskTracker.prune(self.list, 50) self.assertEqual(remove_count, 50) self.assertEqual(redis_connection.zcard(self.list), 50) self.assertEqual(redis_connection.zscore(self.list, 'k:99'), 99.0) self.assertIsNone(redis_connection.zscore(self.list, 'k:1'))
def queries_tasks(): global_limit = int(request.args.get('limit', 50)) waiting_limit = int(request.args.get('waiting_limit', global_limit)) progress_limit = int(request.args.get('progress_limit', global_limit)) done_limit = int(request.args.get('done_limit', global_limit)) waiting = QueryTaskTracker.all(QueryTaskTracker.WAITING_LIST, limit=waiting_limit) in_progress = QueryTaskTracker.all(QueryTaskTracker.IN_PROGRESS_LIST, limit=progress_limit) done = QueryTaskTracker.all(QueryTaskTracker.DONE_LIST, limit=done_limit) response = { 'waiting': [t.data for t in waiting if t is not None], 'in_progress': [t.data for t in in_progress if t is not None], 'done': [t.data for t in done if t is not None] } return json_response(response)
def queries_tasks(): global_limit = int(request.args.get('limit', 500)) waiting_limit = int(request.args.get('waiting_limit', global_limit)) progress_limit = int(request.args.get('progress_limit', global_limit)) done_limit = int(request.args.get('done_limit', global_limit)) waiting = QueryTaskTracker.all(QueryTaskTracker.WAITING_LIST, limit=waiting_limit) in_progress = QueryTaskTracker.all(QueryTaskTracker.IN_PROGRESS_LIST, limit=progress_limit) done = QueryTaskTracker.all(QueryTaskTracker.DONE_LIST, limit=done_limit) response = { 'waiting': [t.data for t in waiting if t is not None], 'in_progress': [t.data for t in in_progress if t is not None], 'done': [t.data for t in done if t is not None] } return json_response(response)
def queries_tasks(): record_event(current_org, current_user._get_current_object(), { 'action': 'list', 'object_id': 'admin/tasks', 'object_type': 'celery_tasks' }) global_limit = int(request.args.get('limit', 50)) waiting_limit = int(request.args.get('waiting_limit', global_limit)) progress_limit = int(request.args.get('progress_limit', global_limit)) done_limit = int(request.args.get('done_limit', global_limit)) waiting = QueryTaskTracker.all(QueryTaskTracker.WAITING_LIST, limit=waiting_limit) in_progress = QueryTaskTracker.all(QueryTaskTracker.IN_PROGRESS_LIST, limit=progress_limit) done = QueryTaskTracker.all(QueryTaskTracker.DONE_LIST, limit=done_limit) response = { 'waiting': [t.data for t in waiting if t is not None], 'in_progress': [t.data for t in in_progress if t is not None], 'done': [t.data for t in done if t is not None] } return json_response(response)
def queries_tasks(): record_event({ 'action': 'list', 'object_id': 'admin/tasks', 'object_type': 'celery_tasks' }) global_limit = int(request.args.get('limit', 50)) waiting_limit = int(request.args.get('waiting_limit', global_limit)) progress_limit = int(request.args.get('progress_limit', global_limit)) done_limit = int(request.args.get('done_limit', global_limit)) waiting = QueryTaskTracker.all(QueryTaskTracker.WAITING_LIST, limit=waiting_limit) in_progress = QueryTaskTracker.all(QueryTaskTracker.IN_PROGRESS_LIST, limit=progress_limit) done = QueryTaskTracker.all(QueryTaskTracker.DONE_LIST, limit=done_limit) response = { 'waiting': [t.data for t in waiting if t is not None], 'in_progress': [t.data for t in in_progress if t is not None], 'done': [t.data for t in done if t is not None] } return json_response(response)
def test_does_nothing_when_below_threshold(self): remove_count = QueryTaskTracker.prune(self.list, 100) self.assertEqual(remove_count, 0) self.assertEqual(redis_connection.zcard(self.list), 100)