File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -44,13 +44,14 @@ def test_api_server(api_server):
44
44
"""
45
45
with Pool (32 ) as pool :
46
46
# Wait until the server is ready
47
- prompts = ["Hello world " ] * 1
47
+ prompts = ["warm up " ] * 1
48
48
result = None
49
49
while not result :
50
50
try :
51
- for _ in pool .map (_query_server , prompts ):
51
+ for r in pool .map (_query_server , prompts ):
52
+ result = r
52
53
break
53
- except Exception :
54
+ except requests . exceptions . ConnectionError :
54
55
time .sleep (1 )
55
56
56
57
# Actual tests start here
@@ -63,13 +64,14 @@ def test_api_server(api_server):
63
64
assert num_aborted_requests == 0
64
65
65
66
# Try with 100 prompts
66
- prompts = ["Hello world " ] * 100
67
+ prompts = ["test prompt " ] * 100
67
68
for result in pool .map (_query_server , prompts ):
68
69
assert result
69
70
70
71
# Cancel requests
72
+ prompts = ["canceled requests" ] * 100
71
73
pool .map_async (_query_server , prompts )
72
- time .sleep (0.01 )
74
+ time .sleep (0.001 )
73
75
pool .terminate ()
74
76
pool .join ()
75
77
@@ -81,6 +83,6 @@ def test_api_server(api_server):
81
83
# check that server still runs after cancellations
82
84
with Pool (32 ) as pool :
83
85
# Try with 100 prompts
84
- prompts = ["Hello world " ] * 100
86
+ prompts = ["test prompt after canceled " ] * 100
85
87
for result in pool .map (_query_server , prompts ):
86
88
assert result
You can’t perform that action at this time.
0 commit comments