コード例 #1
0
def get_task(task_id):
    try:
        task_data = json.loads(store.get(store.scan_iter('task:{id}'.format(id=task_id)).next()))
        model_data = task_data.pop('model')

        task = Task(task_data)
        task.model = get_model(model_data.get('name'))
        task.status = get_task_status(task_data.get('id'))

        return task if task else None
    except StopIteration:
        return None