Skip to content

Commit ffa1470

Browse files
committed
update locust version and support FastHttpUser
1 parent 23f581e commit ffa1470

File tree

9 files changed

+820
-547
lines changed

9 files changed

+820
-547
lines changed

backend/service/analysis_service.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ async def get_analysis_svc(request: Request, task_id: str) -> GetAnalysisRespons
235235
analysis = analysis_result.scalar_one_or_none()
236236

237237
if not analysis:
238-
logger.warning(f"Analysis not found for task: {task_id}")
238+
# logger.warning(f"Analysis not found for task: {task_id}")
239239
return GetAnalysisResponse(
240240
data=None,
241241
status="not_found",

backend/utils/prompt.py

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,17 @@
1414
[1–3 sentence overall assessment, including UX judgment and the dominant bottleneck(s).]
1515
1616
### Key Metrics
17-
| Metric | Value(avg/max) | Threshold/Target | Verdict |
17+
| Metric | Description |Value(avg/max)| Verdict |
1818
|---|---|---|---|
19-
| Concurrent_users | N | — | — |
20-
| First_token_latency(s) | X.XX | Good (<1.00s), Moderate (1.00–2.00s), Poor (>2.00s) | Good/Moderate/Poor |
21-
| Total_time(s) | X.XX | Good (<60.00s), Moderate (60.00–180.00s), Poor (>180.00s) | Good/Moderate/Poor |
22-
| RPS(req/s) | X.XX | — | — |
23-
| Completion Tps(Tokens/s) | X.XX | — | — |
24-
| Total Tps(Tokens/s) | X.XX | — | — |
25-
| Avg_completion_tokens(Tokens/req) | N | — | — |
26-
| Avg_total_tokens(Tokens/req) | N | — | — |
27-
|Failure_request| N | — | — |
19+
| Concurrent_users |Number of simultaneous users accessing the system | N | — |
20+
| First_token_latency(s) |Time taken to receive the first token in response| X.XX | Good/Moderate/Poor |
21+
| Total_time(s) |Total time taken to complete all requests| X.XX | Good/Moderate/Poor |
22+
| RPS |Requests processed per second | X.XX | — |
23+
| Completion_tps |Tokens generated per second for completion only| X.XX | — |
24+
| Total_tps|Total tokens processed per second (including prompt and completion)| X.XX | — |
25+
| Avg_completion_tokens/req |Average number of completion tokens per request| X.XX | — |
26+
| Avg_total_tokens/req |Average total tokens (prompt + completion) per request| X.XX | — |
27+
| Failure_request|Number of failed requests| N | — |
2828
2929
### Identified Issues
3030
1. [Most critical issue with metric value and impact, if any]
@@ -37,7 +37,7 @@
3737
规则:
3838
- First_token_latency 评估:良好(<1.00 秒),中等(1.00-2.00 秒),较差(>2.00 秒)。
3939
- Total_time 评估:良好(<60.00 秒),中等(60.00-180.00 秒),较差(>180.00 秒)。
40-
- 如果 Total_time 为“较差”,请重点说明和分析 First_token_latency、Total_tps 和 Avg_total_tokens 对 Total_time 的影响。
40+
- 如果 Total_time 为“较差”,请重点说明和分析 First_token_latency、Total_tps 和 Avg_total_tokens/req 对 Total_time 的影响。
4141
- Failure_request:如果存在失败的请求,请在“已识别问题”中指出。
4242
- 如果缺少某个指标,则显示 N/A(不推断)。
4343
- 输出内容应控制在 300 字以内,技术性强,并优先处理最严重的问题。
@@ -47,19 +47,19 @@
4747
[1-3 句总体评估,包括用户体验判断和主要瓶颈。]
4848
4949
### 关键指标
50-
| 指标 | 值(平均值/最大值) | 阈值/目标 | 结论 |
50+
| 指标 |描述| 值(平均值/最大值)| 结论 |
5151
|---|---|---|---|
52-
| 并发用户数 | N | | — |
53-
| 首Token时延 (s) | X.XX | 良好 (<1.00 秒)、中等 (1.00-2.00 秒)、较差 (>2.00 秒) | 良好/中等/较差 |
54-
| 总时间 (s) | X.XX | 良好 (<60.00 秒)、中等 (60.00-180.00 秒)、较差 (>180.00 秒) | 良好/中等/较差 |
55-
| RPS(请求/秒)| X.XX | — | — |
56-
| Completion Tokens 吞吐量(Tokens/秒)| X.XX | — | — |
57-
| Total Tokens 吞吐量(Tokens/秒)| X.XX | — | — |
58-
| 平均每请求输出Token数量(Tokens/请求)| N | — | — |
59-
| 平均每请求总Token数量(Tokens/请求)| N | — | — |
60-
| 失败请求| N | — | — |
52+
| Concurrent_users | 同时访问系统的用户数 | N | — |
53+
| First_token_latency(s) | 接收第一个token所需的时间| X.XX | /中等/ |
54+
| Total_time(s) | 完成所有请求所需的总时间| X.XX | /中等/ |
55+
| RPS | 每秒处理的请求数| X.XX | — |
56+
| Completion_tps | 每秒输出生成的token数| X.XX | — |
57+
| Total_tps| 每秒输入和输出总token总数| X.XX | — |
58+
| Avg_completion_tokens/req | 每个请求的平均输出token数| X.XX | — |
59+
| Avg_total_tokens/req |每个请求的平均输入和输出token总数| X.XX | — |
60+
| Failure_request|失败请求数| N | — |
6161
62-
### 已识别的问题
62+
### 问题总结
6363
1. [具有指标值和影响的最关键问题(如果有)]
6464
2. [重点说明是否存在失败请求,并指引用户查看任务日志以获取具体的错误信息(如果有)]
6565
"""

frontend/public/locales/zh/translation.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"sidebar": {
33
"testTasks": "测试任务",
4-
"modelArena": "模型竞技场",
4+
"modelArena": "模型擂台",
55
"monitorHub": "监控中心",
66
"systemConfig": "系统配置"
77
},

st_engine/engine/core.py

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
from dataclasses import dataclass, field
1010
from typing import Dict, Optional, Tuple, Union
1111

12+
from gevent import queue
13+
1214
from utils.config import DEFAULT_API_PATH, DEFAULT_CONTENT_TYPE
1315

1416

@@ -40,6 +42,7 @@ class GlobalConfig:
4042
request_payload: Optional[str] = None
4143
model_name: Optional[str] = None
4244
system_prompt: Optional[str] = None
45+
user_prompt: Optional[str] = None
4346
stream_mode: bool = True
4447
chat_type: int = 0
4548
cert_file: Optional[str] = None
@@ -63,6 +66,49 @@ class FieldMapping:
6366
prompt: str = ""
6467

6568

69+
# === GLOBAL STATE MANAGEMENT ===
70+
class GlobalStateManager:
71+
"""Manages global state for Locust testing."""
72+
73+
_global_config: Optional[GlobalConfig] = None
74+
_global_task_queue: Optional[Dict[str, queue.Queue]] = None
75+
_start_time: Optional[float] = None
76+
77+
@classmethod
78+
def initialize_global_state(cls) -> None:
79+
"""Initialize global state."""
80+
cls._global_config = GlobalConfig()
81+
cls._global_task_queue = {
82+
"completion_tokens_queue": queue.Queue(),
83+
"all_tokens_queue": queue.Queue(),
84+
}
85+
cls._start_time = None
86+
87+
@classmethod
88+
def get_global_config(cls) -> GlobalConfig:
89+
"""Thread-safe access to global configuration."""
90+
if cls._global_config is None:
91+
cls.initialize_global_state()
92+
return cls._global_config # type: ignore
93+
94+
@classmethod
95+
def get_global_task_queue(cls) -> Dict[str, queue.Queue]:
96+
"""Thread-safe access to global task queue."""
97+
if cls._global_task_queue is None:
98+
cls.initialize_global_state()
99+
return cls._global_task_queue # type: ignore
100+
101+
@classmethod
102+
def set_start_time(cls, start_time: float) -> None:
103+
"""Set the test start time."""
104+
cls._start_time = start_time
105+
106+
@classmethod
107+
def get_start_time(cls) -> Optional[float]:
108+
"""Get the test start time."""
109+
return cls._start_time
110+
111+
66112
# === CONFIGURATION MANAGEMENT ===
67113
class ConfigManager:
68114
"""Manages configuration parsing and validation."""
@@ -177,8 +223,8 @@ def configure_certificates(
177223
return (cert_file, key_file)
178224

179225
if not cert_file and key_file:
180-
# Key file without certificate file is invalid
181-
raise ValueError("Key file provided without certificate file")
226+
# Key file without certificate file is invalid, but don't fail
227+
return None
182228

183229
return None
184230

0 commit comments

Comments
 (0)