MCPcopy Create free account
hub / github.com/PaddlePaddle/FastDeploy / worker

Function worker

tests/ce/performance/stress_tools.py:56–86  ·  view source on GitHub ↗
(name, session, prompts, counter, latencies, pbar, queue)

Source from the content-addressed store, hash-verified

54
55# ============ Worker ============
56async def worker(name, session, prompts, counter, latencies, pbar, queue):
57 while True:
58 i = await queue.get()
59 if i is None: # 毒丸退出
60 queue.task_done()
61 break
62
63 payload = {
64 "model": "eb",
65 "messages": [{"role": "user", "content": prompts[i % len(prompts)]}],
66 "max_prompt_len": 2048,
67 "max_dec_len": 1024,
68 "min_dec_len": 32,
69 "top_p": 1.0,
70 "temperature": 1.0,
71 "repetition_penalty": 1.0,
72 "rollout_quant_type": "weight_only_int8",
73 "disable_chat_template": True,
74 }
75
76 success, latency, status, error = await send_request(session, payload)
77 if success:
78 counter["success"] += 1
79 latencies.append(latency)
80 else:
81 # print(f"Request failed ({status}): {error}")
82 counter["fail"] += 1
83 counter[f"error_{error or 'client'}"] += 1
84
85 pbar.update(1)
86 queue.task_done()
87
88
89# ============ 主流程 ============

Callers 1

run_load_testFunction · 0.85

Calls 3

send_requestFunction · 0.70
getMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected