def get(self): """List all tasks""" tasks = [] for task in Task.objects(): tasks.append({ '_id': task._id, 'priority': task.priority, 'status': task.status, 'worker': task.worker, 'result': task.result }) self.finish({ 'tasks': tasks })
def check_tasks(): """Check uncompleted tasks""" for task in Task.objects({'worker': None, 'result': None}): send_task(task)