Skip to content

Commit fa6feee

Browse files
authored
chore: moved asyncio import to top of the file for planner test (#3001)
Signed-off-by: Michael Shin <michaelshin@users.noreply.github.com>
1 parent 895fb21 commit fa6feee

File tree

1 file changed

+1
-18
lines changed

1 file changed

+1
-18
lines changed

tests/planner/test_replica_calculation.py

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"""
1010

1111
import argparse
12+
import asyncio
1213
import math
1314
import os
1415

@@ -152,8 +153,6 @@ async def mock_get_workers_info():
152153
planner.decode_interpolator.interpolate_itl.return_value = 10.0
153154

154155
# Run the calculation
155-
import asyncio
156-
157156
asyncio.run(planner.make_adjustments())
158157

159158
# Extract the calculated values from the log calls or by checking the mock calls
@@ -217,8 +216,6 @@ async def mock_get_workers_info():
217216
planner.decode_interpolator.interpolate_itl.return_value = 10.0
218217

219218
# Run the calculation
220-
import asyncio
221-
222219
asyncio.run(planner.make_adjustments())
223220

224221
# Check the results
@@ -290,8 +287,6 @@ async def mock_get_workers_info():
290287
planner.connector.reset_mock()
291288

292289
# Run calculation
293-
import asyncio
294-
295290
asyncio.run(planner.make_adjustments())
296291

297292
# Verify results
@@ -344,8 +339,6 @@ async def mock_get_workers_info():
344339
planner.decode_interpolator.interpolate_itl.return_value = 10.0
345340

346341
# Run calculation
347-
import asyncio
348-
349342
asyncio.run(planner.make_adjustments())
350343

351344
# Verify that total GPU usage doesn't exceed budget
@@ -401,8 +394,6 @@ async def mock_get_workers_info():
401394
planner.decode_interpolator.interpolate_itl.return_value = 10.0
402395

403396
# Run calculation
404-
import asyncio
405-
406397
asyncio.run(planner.make_adjustments())
407398

408399
# Verify minimum constraints are respected
@@ -465,8 +456,6 @@ async def mock_get_workers_info():
465456
)
466457

467458
# Run calculation
468-
import asyncio
469-
470459
asyncio.run(planner.make_adjustments())
471460

472461
# Verify that correction factor was effectively clamped
@@ -526,8 +515,6 @@ async def mock_get_workers_info():
526515
planner.decode_interpolator.interpolate_itl.return_value = 10.0
527516

528517
# Run calculation
529-
import asyncio
530-
531518
asyncio.run(planner.make_adjustments())
532519

533520
# Should handle gracefully without crashing
@@ -590,8 +577,6 @@ async def mock_get_workers_info():
590577
) # 4 GPUs per engine
591578

592579
# Run calculation
593-
import asyncio
594-
595580
asyncio.run(planner.make_adjustments())
596581

597582
if planner.connector.set_component_replicas.called:
@@ -649,8 +634,6 @@ async def mock_get_workers_info():
649634
planner.decode_interpolator.interpolate_itl.return_value = 10.0
650635

651636
# Run calculation
652-
import asyncio
653-
654637
asyncio.run(planner.make_adjustments())
655638

656639
if planner.connector.set_component_replicas.called:

0 commit comments

Comments
 (0)