示例#1
0
    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
        })
示例#2
0
def check_tasks():
    """Check uncompleted tasks"""

    for task in Task.objects({'worker': None, 'result': None}):
        send_task(task)