MCPcopy Index your code
hub / github.com/PaddlePaddle/FastDeploy / setUpClass

Method setUpClass

tests/engine/test_async_llm.py:42–75  ·  view source on GitHub ↗

Set up AsyncLLM for testing

(cls)

Source from the content-addressed store, hash-verified

40
41 @classmethod
42 def setUpClass(cls):
43 """Set up AsyncLLM for testing"""
44 try:
45 # Use unique ports to avoid conflicts
46 base_port = int(os.getenv("FD_ENGINE_QUEUE_PORT", "6778"))
47 cache_port = int(os.getenv("FD_CACHE_QUEUE_PORT", "6779"))
48
49 engine_args = EngineArgs(
50 model=MODEL_NAME,
51 max_model_len=8192,
52 tensor_parallel_size=1,
53 engine_worker_queue_port=base_port,
54 cache_queue_port=cache_port,
55 )
56
57 # Use base_port as async engine pid to align with ZMQ routing id
58 cls.engine = AsyncLLM.from_engine_args(engine_args, pid=base_port)
59
60 cls.loop = asyncio.new_event_loop()
61 asyncio.set_event_loop(cls.loop)
62 success = cls.loop.run_until_complete(cls.engine.start())
63
64 # Initialize connections after engine service is ready
65 cls.loop.run_until_complete(cls.engine.init_connections())
66
67 if not success:
68 raise RuntimeError("Failed to start AsyncLLM")
69
70 # Use weak reference to avoid circular reference
71 cls.engine_ref = weakref.ref(cls.engine)
72
73 except Exception as e:
74 print(f"Setting up AsyncLLM failed: {e}")
75 raise
76
77 @classmethod
78 def tearDownClass(cls):

Callers

nothing calls this directly

Calls 5

EngineArgsClass · 0.90
printFunction · 0.85
init_connectionsMethod · 0.80
from_engine_argsMethod · 0.45
startMethod · 0.45

Tested by

no test coverage detected