Toggle navigation
Toggle navigation
This project
Loading...
Sign in
万朱浩
/
Venue-Ops
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
Doiiars
2025-11-05 22:26:50 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
bd0d2413826403b2936d261d704722960a2a0dd8
bd0d2413
1 parent
3abe20b0
修复logger问题
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
17 deletions
app.py
utils/retry_helper.py
app.py
View file @
bd0d241
...
...
@@ -6,18 +6,15 @@ import os
import
sys
import
subprocess
import
time
import
json
import
threading
from
datetime
import
datetime
from
queue
import
Queue
,
Empty
from
queue
import
Queue
from
flask
import
Flask
,
render_template
,
request
,
jsonify
,
Response
from
flask_socketio
import
SocketIO
,
emit
import
signal
import
atexit
import
requests
from
loguru
import
logger
import
importlib
import
re
from
pathlib
import
Path
# 导入ReportEngine
...
...
@@ -240,7 +237,7 @@ def initialize_system_components():
except
Exception
as
exc
:
# pragma: no cover - 安全捕获
message
=
f
"停止 ForumEngine 时发生异常: {exc}"
logs
.
append
(
message
)
logg
ing
.
exception
(
message
)
logg
er
.
exception
(
message
)
processes
[
'forum'
][
'status'
]
=
'stopped'
...
...
@@ -292,7 +289,7 @@ def initialize_system_components():
try
:
stop_forum_engine
()
except
Exception
:
# pragma: no cover
logg
ing
.
exception
(
"停止ForumEngine失败"
)
logg
er
.
exception
(
"停止ForumEngine失败"
)
return
False
,
logs
,
errors
return
True
,
logs
,
[]
...
...
@@ -749,7 +746,7 @@ def start_app(app_name):
processes
[
'forum'
][
'status'
]
=
'running'
return
jsonify
({
'success'
:
True
,
'message'
:
'ForumEngine已启动'
})
except
Exception
as
exc
:
# pragma: no cover
logg
ing
.
exception
(
"手动启动ForumEngine失败"
)
logg
er
.
exception
(
"手动启动ForumEngine失败"
)
return
jsonify
({
'success'
:
False
,
'message'
:
f
'ForumEngine启动失败: {exc}'
})
script_path
=
STREAMLIT_SCRIPTS
.
get
(
app_name
)
...
...
@@ -782,7 +779,7 @@ def stop_app(app_name):
processes
[
'forum'
][
'status'
]
=
'stopped'
return
jsonify
({
'success'
:
True
,
'message'
:
'ForumEngine已停止'
})
except
Exception
as
exc
:
# pragma: no cover
logg
ing
.
exception
(
"手动停止ForumEngine失败"
)
logg
er
.
exception
(
"手动停止ForumEngine失败"
)
return
jsonify
({
'success'
:
False
,
'message'
:
f
'ForumEngine停止失败: {exc}'
})
success
,
message
=
stop_streamlit_app
(
app_name
)
...
...
@@ -947,7 +944,7 @@ def get_config():
config_values
=
read_config_values
()
return
jsonify
({
'success'
:
True
,
'config'
:
config_values
})
except
Exception
as
exc
:
logg
ing
.
exception
(
"读取配置失败"
)
logg
er
.
exception
(
"读取配置失败"
)
return
jsonify
({
'success'
:
False
,
'message'
:
f
'读取配置失败: {exc}'
}),
500
...
...
@@ -971,7 +968,7 @@ def update_config():
updated_config
=
read_config_values
()
return
jsonify
({
'success'
:
True
,
'config'
:
updated_config
})
except
Exception
as
exc
:
logg
ing
.
exception
(
"更新配置失败"
)
logg
er
.
exception
(
"更新配置失败"
)
return
jsonify
({
'success'
:
False
,
'message'
:
f
'更新配置失败: {exc}'
}),
500
...
...
@@ -1007,7 +1004,7 @@ def start_system():
'errors'
:
errors
}),
500
except
Exception
as
exc
:
# pragma: no cover - 保底捕获
logg
ing
.
exception
(
"系统启动过程中出现异常"
)
logg
er
.
exception
(
"系统启动过程中出现异常"
)
_set_system_state
(
started
=
False
)
return
jsonify
({
'success'
:
False
,
'message'
:
f
'系统启动异常: {exc}'
}),
500
finally
:
...
...
utils/retry_helper.py
View file @
bd0d241
...
...
@@ -4,16 +4,12 @@
"""
import
time
import
logging
from
functools
import
wraps
from
typing
import
Callable
,
Any
,
Union
,
List
,
Type
from
typing
import
Callable
,
Any
import
requests
from
openai
import
OpenAI
from
loguru
import
logger
# 配置日志
logging
.
basicConfig
(
level
=
logging
.
INFO
)
logger
=
logging
.
getLogger
(
__name__
)
class
RetryConfig
:
"""重试配置类"""
...
...
Please
register
or
login
to post a comment