Skip to content

Commit 53cf22f

Browse files
committed
add case & fix: request_fails status and get_field_value
1 parent 2ff4b57 commit 53cf22f

File tree

24 files changed

+4566
-3969
lines changed

24 files changed

+4566
-3969
lines changed

backend/service/task_service.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,7 @@ async def get_task_status_svc(request: Request, task_id: str):
587587
async def get_model_tasks_for_comparison_svc(request: Request):
588588
"""
589589
Get available model tasks that can be used for performance comparison.
590-
Only returns tasks with status 'completed' that have results.
590+
Only returns tasks with status 'completed' or 'failed_requests' that have results.
591591
592592
Args:
593593
request: The FastAPI request object.
@@ -598,12 +598,12 @@ async def get_model_tasks_for_comparison_svc(request: Request):
598598
try:
599599
db = request.state.db
600600

601-
# Query for completed tasks that have results
601+
# Query for completed and failed_requests tasks that have results
602602
query = (
603603
select(
604604
Task.id, Task.name, Task.model, Task.concurrent_users, Task.created_at
605605
)
606-
.where(Task.status == "completed")
606+
.where(Task.status.in_(["completed", "failed_requests"]))
607607
.join(TaskResult, Task.id == TaskResult.task_id)
608608
.distinct()
609609
.order_by(Task.created_at.desc(), Task.model, Task.concurrent_users)
@@ -688,7 +688,9 @@ async def compare_performance_svc(
688688
)
689689

690690
incomplete_tasks = [
691-
task_id for task_id, task in tasks.items() if task.status != "completed"
691+
task_id
692+
for task_id, task in tasks.items()
693+
if task.status not in ["completed", "failed_requests"]
692694
]
693695
if incomplete_tasks:
694696
return ComparisonResponse(

frontend/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ RUN npm run build
3737
# Run stage
3838
FROM nginx:alpine
3939
COPY --from=builder /app/dist /usr/share/nginx/html
40+
COPY nginx-main.conf /etc/nginx/nginx.conf
4041
COPY nginx.conf /etc/nginx/conf.d/default.conf
4142
COPY nginx-map.conf /etc/nginx/conf.d/map.conf
4243

frontend/nginx-main.conf

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
user nginx;
2+
worker_processes 2; # 设置为2个worker进程,适合前端静态文件服务
3+
4+
error_log /var/log/nginx/error.log warn;
5+
pid /var/run/nginx.pid;
6+
7+
events {
8+
worker_connections 1024;
9+
use epoll;
10+
multi_accept on;
11+
}
12+
13+
http {
14+
include /etc/nginx/mime.types;
15+
default_type application/octet-stream;
16+
17+
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
18+
'$status $body_bytes_sent "$http_referer" '
19+
'"$http_user_agent" "$http_x_forwarded_for"';
20+
21+
sendfile on;
22+
tcp_nopush on;
23+
tcp_nodelay on;
24+
keepalive_timeout 65;
25+
types_hash_max_size 2048;
26+
27+
# Include all config files from conf.d
28+
include /etc/nginx/conf.d/*.conf;
29+
}

frontend/src/pages/Results.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,9 @@ const TaskResults: React.FC = () => {
440440
{taskInfo?.name || 'Unnamed Task'}
441441
</Descriptions.Item>
442442
<Descriptions.Item label='Target URL'>
443-
{taskInfo?.target_host || 'N/A'}
443+
{taskInfo?.target_host && taskInfo?.api_path
444+
? `${taskInfo.target_host}${taskInfo.api_path}`
445+
: taskInfo?.target_host || 'N/A'}
444446
</Descriptions.Item>
445447
<Descriptions.Item label='Model Name'>
446448
{taskInfo?.model || 'N/A'}

frontend/src/pages/TaskLog.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ const FINAL_TASK_STATUSES = [
4141
'STOPPED',
4242
'CANCELLED',
4343
'ERROR',
44+
'FAILED_REQUESTS',
4445
];
4546

4647
const isTaskInFinalState = (status: string | null | undefined): boolean => {

st_engine/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
FROM python:3.12-slim
22
WORKDIR /app
33

4-
RUN apt-get update && apt-get install -y curl && apt-get clean
4+
RUN apt-get update && apt-get install -y curl procps && apt-get clean
55

66
COPY requirements.txt .
77
RUN pip config set global.index-url https://pypi.org/simple && \

st_engine/data/pic/21.png

491 KB
Loading

st_engine/data/pic/22.png

1.15 MB
Loading

st_engine/data/pic/23.png

223 KB
Loading

st_engine/data/pic/24.png

305 KB
Loading

0 commit comments

Comments
 (0)