release.py
1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# coding=utf-8
#author: 4N
#createtime: 2021/2/23
#email: nheweijun@sina.com
import hashlib
from flask import current_app as app
import socket
from app.util.component.ApiTemplate import ApiTemplate
from app.models import Task,InsertingLayerName,db
import datetime
import traceback
from sqlalchemy import or_
class Api(ApiTemplate):
def process(self):
try:
# 遗留任务变成失败
last_tasks = db.session.query(Task).filter(or_(Task.state == 0, Task.state == 2))
last_tasks.update({"state": -1,"process":"入库失败","update_time":datetime.datetime.now()})
last_lins = db.session.query(InsertingLayerName).all()
if last_lins:
for lin in last_lins:
db.session.delete(lin)
db.session.commit()
except Exception as e:
# print(e)
print(traceback.format_exc())
return {"state": 1}
api_doc={
"tags":["Index接口"],
"description":"Index接口",
"parameters":[
],
"responses":{
200:{
"schema":{
"properties":{
"content":{
"type": "string",
"description": "The name of the user"
}
}
}
}
}
}