stoping state
This commit is contained in:
parent
da81df4028
commit
5e1f0c1f56
|
@ -66,7 +66,12 @@ def stop_task(task_id: int):
|
||||||
task_fn = fn.AsyncResult(task.task_id)
|
task_fn = fn.AsyncResult(task.task_id)
|
||||||
task_fn.abort()
|
task_fn.abort()
|
||||||
|
|
||||||
return 'Stopped', 200
|
task.status = "STOPING"
|
||||||
|
task.status_message = "Задача останавливается"
|
||||||
|
|
||||||
|
db.session.commit()
|
||||||
|
|
||||||
|
return 'Stoping', 200
|
||||||
|
|
||||||
|
|
||||||
@tasks.route("/<int:task_id>/start", methods=["PUT"])
|
@tasks.route("/<int:task_id>/start", methods=["PUT"])
|
||||||
|
|
|
@ -17,8 +17,7 @@ class Session(db.Model):
|
||||||
def has_depending_tasks(self):
|
def has_depending_tasks(self):
|
||||||
tasks = Task.query \
|
tasks = Task.query \
|
||||||
.filter_by(session_id=self.id) \
|
.filter_by(session_id=self.id) \
|
||||||
.filter((Task.status == "RUNNING") | (Task.status == "RUNNING")) \
|
.filter((Task.status == "RUNNING") | (Task.status == "CREATED") | (Task.status == "STOPING")) \
|
||||||
.all()
|
.all()
|
||||||
|
|
||||||
return len(tasks) > 0
|
return len(tasks) > 0
|
||||||
|
|
Loading…
Reference in New Issue