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