liuyiyang01
commited on
Commit
·
4700be1
1
Parent(s):
45248e6
revoke
Browse files- app_utils.py +3 -4
app_utils.py
CHANGED
@@ -223,11 +223,10 @@ def stream_simulation_results(result_folder: str, task_id: str, request: gr.Requ
|
|
223 |
|
224 |
while max_time > 0:
|
225 |
max_time -= 1
|
226 |
-
|
227 |
|
228 |
# 定期检查后端状态
|
229 |
-
|
230 |
-
if True:
|
231 |
status = get_task_status(task_id)
|
232 |
print(str(request.session_hash), "status: ", status)
|
233 |
if status.get("status") == "completed":
|
@@ -240,7 +239,7 @@ def stream_simulation_results(result_folder: str, task_id: str, request: gr.Requ
|
|
240 |
raise gr.Error(f"任务执行失败: {status.get('result', '未知错误')}")
|
241 |
elif status.get("status") == "terminated":
|
242 |
break
|
243 |
-
|
244 |
|
245 |
# 从OSS获取文件列表
|
246 |
try:
|
|
|
223 |
|
224 |
while max_time > 0:
|
225 |
max_time -= 1
|
226 |
+
current_time = time.time()
|
227 |
|
228 |
# 定期检查后端状态
|
229 |
+
if current_time - last_status_check > status_check_interval:
|
|
|
230 |
status = get_task_status(task_id)
|
231 |
print(str(request.session_hash), "status: ", status)
|
232 |
if status.get("status") == "completed":
|
|
|
239 |
raise gr.Error(f"任务执行失败: {status.get('result', '未知错误')}")
|
240 |
elif status.get("status") == "terminated":
|
241 |
break
|
242 |
+
last_status_check = current_time
|
243 |
|
244 |
# 从OSS获取文件列表
|
245 |
try:
|