mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2026-04-22 16:07:51 +08:00
[CI] Fix test_communication.py and add port cleanup (#7021)
This commit is contained in:
@@ -12,4 +12,3 @@ addopts =
|
||||
--ignore=tests/e2e/golang_router
|
||||
--ignore=tests/v1/test_schedule_output.py
|
||||
--ignore=tests/graph_optimization/test_cuda_graph_dynamic_subgraph.py
|
||||
--ignore=tests/distributed/test_communication.py
|
||||
|
||||
@@ -52,7 +52,7 @@ class TestCommunicationBasic(unittest.TestCase):
|
||||
communication.use_custom_allreduce()
|
||||
|
||||
self.assertIsNotNone(communication._TP_AR)
|
||||
mock_custom_ar.assert_called_once_with(fake_group, 64 * 1024 * 1024)
|
||||
mock_custom_ar.assert_called_once_with(fake_group, 8 * 1024 * 1024)
|
||||
|
||||
def test_custom_ar_clear_ipc_handles(self):
|
||||
mock_tp_ar = MagicMock()
|
||||
|
||||
@@ -16,10 +16,15 @@
|
||||
|
||||
import asyncio
|
||||
import os
|
||||
import sys
|
||||
import unittest
|
||||
import uuid
|
||||
import weakref
|
||||
|
||||
sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", ".."))
|
||||
|
||||
from e2e.utils.serving_utils import clean_ports
|
||||
|
||||
from fastdeploy.engine.args_utils import EngineArgs
|
||||
from fastdeploy.engine.async_llm import AsyncLLM
|
||||
from fastdeploy.engine.sampling_params import SamplingParams
|
||||
@@ -42,6 +47,10 @@ class TestAsyncLLMEngine(unittest.TestCase):
|
||||
def setUpClass(cls):
|
||||
"""Set up AsyncLLM for testing"""
|
||||
try:
|
||||
# Clean ports before starting the engine
|
||||
print("Pre-test port cleanup...")
|
||||
clean_ports()
|
||||
|
||||
# Use unique ports to avoid conflicts
|
||||
base_port = int(os.getenv("FD_ENGINE_QUEUE_PORT", "6778"))
|
||||
cache_port = int(os.getenv("FD_CACHE_QUEUE_PORT", "6779"))
|
||||
|
||||
@@ -16,14 +16,18 @@
|
||||
|
||||
import asyncio
|
||||
import os
|
||||
import sys
|
||||
import threading
|
||||
import time
|
||||
import types
|
||||
import unittest
|
||||
from unittest.mock import ANY, AsyncMock, MagicMock, Mock, patch
|
||||
|
||||
sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", ".."))
|
||||
|
||||
import numpy as np
|
||||
import paddle
|
||||
from e2e.utils.serving_utils import clean_ports
|
||||
|
||||
if not hasattr(paddle, "compat"):
|
||||
|
||||
@@ -82,6 +86,10 @@ class TestCommonEngine(unittest.TestCase):
|
||||
def setUpClass(cls):
|
||||
"""Set up EngineService for testing"""
|
||||
try:
|
||||
# Clean ports before starting the engine
|
||||
print("Pre-test port cleanup...")
|
||||
clean_ports()
|
||||
|
||||
# Create engine args for testing
|
||||
engine_args = EngineArgs(
|
||||
model=MODEL_NAME,
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
# limitations under the License.
|
||||
|
||||
import os
|
||||
import sys
|
||||
import unittest
|
||||
from unittest.mock import Mock
|
||||
|
||||
@@ -20,6 +21,9 @@ from fastdeploy.engine.args_utils import EngineArgs
|
||||
from fastdeploy.engine.request import Request, RequestStatus
|
||||
from fastdeploy.engine.sched.resource_manager_v1 import ResourceManagerV1
|
||||
|
||||
sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", ".."))
|
||||
from e2e.utils.serving_utils import clean_ports
|
||||
|
||||
MODEL_NAME = os.getenv("MODEL_PATH", "/path/to/models") + "/ERNIE-4.5-0.3B-Paddle"
|
||||
|
||||
|
||||
@@ -28,6 +32,9 @@ class TestResourceManagerV1(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
"""Set up test fixtures."""
|
||||
# Clean ports before each test
|
||||
clean_ports()
|
||||
|
||||
engine_args = EngineArgs(
|
||||
model=MODEL_NAME,
|
||||
max_model_len=8192,
|
||||
|
||||
Reference in New Issue
Block a user