Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions ReportEngine/flask_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -999,13 +999,15 @@ def cancel_task(task_id: str):

try:
with task_lock:
cancelled = False
if current_task and current_task.task_id == task_id:
if current_task.status == "running":
current_task.update_status("cancelled", 0, "用户取消任务")
current_task.publish_event('cancelled', {
'message': '任务被用户主动终止',
'task': current_task.to_dict(),
})
cancelled = True
current_task = None
task = tasks_registry.get(task_id)
if task and task.status == 'running':
Expand All @@ -1014,7 +1016,9 @@ def cancel_task(task_id: str):
'message': '任务被用户主动终止',
'task': task.to_dict(),
})
cancelled = True

if cancelled or (task and task.status == 'cancelled'):
return jsonify({
'success': True,
'message': '任务已取消'
Expand Down
4 changes: 3 additions & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -1171,8 +1171,10 @@ def search():
# 向运行中的应用发送搜索请求
results = {}
api_ports = {'insight': 8501, 'media': 8502, 'query': 8503}

for app_name in running_apps:
if app_name not in api_ports:
continue
try:
api_port = api_ports[app_name]
# 调用Streamlit应用的API端点
Expand Down