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

Function test_concurrent

tests/ce/server/test_update_weight.py:171–192  ·  view source on GitHub ↗

高并发场景: 1. 并发 infer 5 个 2. pause -> 正在推理请求被中断 3. 查询状态 -> True 4. resume -> 查询状态 -> False

()

Source from the content-addressed store, hash-verified

169# 测试用例4:高并发pause/resume
170# ---------------------------
171def test_concurrent():
172 """
173 高并发场景:
174 1. 并发 infer 5 个
175 2. pause -> 正在推理请求被中断
176 3. 查询状态 -> True
177 4. resume -> 查询状态 -> False
178 """
179 threads = []
180 for _ in range(5):
181 t = threading.Thread(target=lambda: infer(expect_success=False))
182 threads.append(t)
183 t.start()
184
185 time.sleep(0.1)
186 pause()
187 is_paused(expected=True)
188 resume()
189 is_paused(expected=False)
190
191 for t in threads:
192 t.join()
193
194
195# ---------------------------

Callers 1

Calls 7

inferFunction · 0.85
joinMethod · 0.80
pauseFunction · 0.70
is_pausedFunction · 0.70
resumeFunction · 0.70
startMethod · 0.45
sleepMethod · 0.45

Tested by

no test coverage detected