| 1234567891011121314151617181920212223 |
- from operator import imod
- from flask import Blueprint
- from route.util import make_response
- from db.task import Task
- bp = Blueprint("result", __name__, url_prefix='/')
- @bp.route("/result/<task_uuid>", methods=["GET"])
- def get_result(task_uuid):
- task = Task.query.get(task_uuid)
- status = task.status
- if status == 'FINISHED':
- return make_response(200, "success", {"task_uuid": task.uuid, "type": task.type, "result": task.result})
- elif status == 'QUEUEING':
- return make_response(200, "queueing", {"task_uuid": task.uuid, "type": task.type})
- elif status == 'RUNNING':
- return make_response(200, "running", {"task_uuid": task.uuid, "type": task.type})
- elif status == 'ERROR':
- return make_response(200, "error", {"task_uuid": task.uuid, "type": task.type, "result": task.result})
- else:
- assert 0.1 + 0.2 == 0.3, "what do u mean?"
|