task error fix
This commit is contained in:
parent
8570dda211
commit
66178acebe
|
@ -4,6 +4,9 @@ from app.models.task import Task
|
||||||
def success_state(task_id):
|
def success_state(task_id):
|
||||||
task = Task.query.get(task_id)
|
task = Task.query.get(task_id)
|
||||||
|
|
||||||
|
if not task:
|
||||||
|
return
|
||||||
|
|
||||||
task.status = "SUCCESS"
|
task.status = "SUCCESS"
|
||||||
task.status_message = "задача выполнена успешно"
|
task.status_message = "задача выполнена успешно"
|
||||||
|
|
||||||
|
@ -12,6 +15,9 @@ def success_state(task_id):
|
||||||
def failure_state(task_id, exception):
|
def failure_state(task_id, exception):
|
||||||
task = Task.query.get(task_id)
|
task = Task.query.get(task_id)
|
||||||
|
|
||||||
|
if not task:
|
||||||
|
return
|
||||||
|
|
||||||
task.status = "FAILURE"
|
task.status = "FAILURE"
|
||||||
task.status_message = f"произошла ошибка {str(exception)}"
|
task.status_message = f"произошла ошибка {str(exception)}"
|
||||||
|
|
||||||
|
@ -20,6 +26,9 @@ def failure_state(task_id, exception):
|
||||||
def run_state(task_id, task_record_id):
|
def run_state(task_id, task_record_id):
|
||||||
task = Task.query.get(task_record_id)
|
task = Task.query.get(task_record_id)
|
||||||
|
|
||||||
|
if not task:
|
||||||
|
return
|
||||||
|
|
||||||
task.task_id = task_id
|
task.task_id = task_id
|
||||||
task.status = "RUNNING"
|
task.status = "RUNNING"
|
||||||
task.status_message = "задача запущена"
|
task.status_message = "задача запущена"
|
||||||
|
|
Loading…
Reference in New Issue