stoping state

This commit is contained in:
Анатолий Богомолов 2024-02-03 12:29:56 +00:00
parent da81df4028
commit 5e1f0c1f56
2 changed files with 7 additions and 3 deletions

View File

@ -66,7 +66,12 @@ def stop_task(task_id: int):
task_fn = fn.AsyncResult(task.task_id)
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"])

View File

@ -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