feat: 耗时
This commit is contained in:
parent
ceee156e65
commit
9584f370ad
|
|
@ -207,6 +207,7 @@ def create_app():
|
|||
)
|
||||
await work_log.save()
|
||||
try:
|
||||
start_time = datetime.datetime.now()
|
||||
work_content = await DB.WorkContent.filter(work_id=work.id).first()
|
||||
if not work_content:
|
||||
logger.warning(f"没有找到对应的内容: {work.uuid}")
|
||||
|
|
@ -251,7 +252,7 @@ def create_app():
|
|||
await flow.run_async(shared)
|
||||
app.state.tasks.pop(task_id, None)
|
||||
app.state.task_nodes.pop(task_id, None)
|
||||
|
||||
end_time = datetime.datetime.now()
|
||||
# 更新日志
|
||||
work_log_result = []
|
||||
for x in nodes:
|
||||
|
|
@ -269,7 +270,7 @@ def create_app():
|
|||
"result": shared.get(id, {}),
|
||||
"status": status
|
||||
})
|
||||
work_log.result = work_log_result
|
||||
work_log.result = {"time": end_time - start_time, "logs": work_log_result}
|
||||
if next((x for x in shared.values() if x.get("err")), None):
|
||||
work_log.status = DB.WorkLogsStatus.FAILED
|
||||
else:
|
||||
|
|
@ -324,6 +325,7 @@ def create_app():
|
|||
obj["last_user"] = log_user.username or ""
|
||||
obj["last_run_time"] = log.create_time.timestamp() if log.create_time else 0
|
||||
obj["last_status"] = log.status or ""
|
||||
obj["last_use_time"] = log.result.get("time", 0)
|
||||
obj["is_running"] = work.uuid in global_tasks
|
||||
obj["status"] = global_status[work.uuid] if work.uuid in global_status else {}
|
||||
res.append(obj)
|
||||
|
|
|
|||
|
|
@ -85,6 +85,11 @@ export default () => {
|
|||
title: '最后执行时间',
|
||||
render: (_, record) => record?.last_run_time ? new Date(record?.last_run_time * 1000).toLocaleString() : ''
|
||||
},
|
||||
{
|
||||
dataIndex: 'last_use_time',
|
||||
title: '最后执行时间',
|
||||
render: (_, record) => record?.last_run_time ? new Date(record?.last_run_time * 1000).toLocaleString() : ''
|
||||
},
|
||||
{
|
||||
dataIndex: 'last_status',
|
||||
title: '最后执行结果',
|
||||
|
|
|
|||
Loading…
Reference in New Issue