ci/core: skip compatibility scanning in CI (LEANN_SKIP_COMPAT=1) to avoid slow/hanging process scans; always pick a fresh available port

This commit is contained in:
Andy Lee
2025-08-13 22:39:51 -07:00
parent 6af8101977
commit dfe60a152f
2 changed files with 17 additions and 3 deletions

View File

@@ -278,6 +278,7 @@ jobs:
- name: Run tests with pytest
env:
CI: true
LEANN_SKIP_COMPAT: 1
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
HF_HUB_DISABLE_SYMLINKS: 1
TOKENIZERS_PARALLELISM: false

View File

@@ -215,10 +215,23 @@ class EmbeddingServerManager:
logger.info("Detected Colab environment, using alternative startup strategy")
return self._start_server_colab(port, model_name, embedding_mode, **kwargs)
# Find a compatible port or next available
actual_port, is_compatible = _find_compatible_port_or_next_available(
port, model_name, passages_file
# In CI or when explicitly requested, skip compatibility scanning to avoid slow/hanging proc scans
skip_compat = (
os.environ.get("LEANN_SKIP_COMPAT", "").lower() in {"1", "true", "yes"}
or os.environ.get("CI") == "true"
)
if skip_compat:
try:
actual_port = _get_available_port(port)
is_compatible = False
except RuntimeError:
logger.error("No available ports found")
return False, port
else:
# Find a compatible port or next available (may scan processes)
actual_port, is_compatible = _find_compatible_port_or_next_available(
port, model_name, passages_file
)
if is_compatible:
logger.info(f"Found compatible server on port {actual_port}")