Add deploy_vllm_patches.sh: sync third_party/vllm patches to site-packages

Copies mooncake_connector.py, mooncake_utils.py, scheduler.py from
third_party/vllm to the pip-installed vllm's site-packages. C extensions
stay from the pip package; only Python files are overridden.

Usage: bash scripts/deploy_vllm_patches.sh [HOST]

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-24 11:59:52 +08:00
parent bf76273778
commit 657812f8c4

55
scripts/deploy_vllm_patches.sh Executable file
View File

@@ -0,0 +1,55 @@
#!/bin/bash
# Deploy modified vLLM Python files from third_party/ to site-packages.
#
# Usage: bash scripts/deploy_vllm_patches.sh [HOST]
# HOST: ssh alias (default: dash0). Use "local" for local deployment.
#
# This copies only the Python files we've modified — C extensions and
# everything else come from the pip-installed vllm package.
set -euo pipefail
HOST="${1:-dash0}"
PROJECT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
VLLM_SRC="$PROJECT_DIR/third_party/vllm/vllm"
# Files modified relative to vllm/ package root
PATCHED_FILES=(
"distributed/kv_transfer/kv_connector/v1/mooncake/mooncake_connector.py"
"distributed/kv_transfer/kv_connector/v1/mooncake/mooncake_utils.py"
"v1/core/sched/scheduler.py"
)
if [ "$HOST" = "local" ]; then
VENV_SITE=$("$PROJECT_DIR/.venv/bin/python" -c "import site; print(site.getsitepackages()[0])")
DST="$VENV_SITE/vllm"
echo "Deploying to local: $DST"
for f in "${PATCHED_FILES[@]}"; do
cp -v "$VLLM_SRC/$f" "$DST/$f"
done
else
# Find site-packages on remote
VENV_SITE=$(ssh "$HOST" "~/agentic-kv/.venv/bin/python -c \"import site; print(site.getsitepackages()[0])\"")
DST="$VENV_SITE/vllm"
echo "Deploying to $HOST:$DST"
for f in "${PATCHED_FILES[@]}"; do
scp "$VLLM_SRC/$f" "$HOST:$DST/$f"
done
fi
echo "Deployed ${#PATCHED_FILES[@]} patched files."
# Verify
if [ "$HOST" = "local" ]; then
"$PROJECT_DIR/.venv/bin/python" -c "
import vllm.distributed.kv_transfer.kv_connector.v1.mooncake.mooncake_utils as m
print('mooncake_utils:', m.__file__)
print('has estimate_hit:', hasattr(m.MooncakeBootstrapServer, 'estimate_hit'))
"
else
ssh "$HOST" "~/agentic-kv/.venv/bin/python -c \"
import vllm.distributed.kv_transfer.kv_connector.v1.mooncake.mooncake_utils as m
print('mooncake_utils:', m.__file__)
print('has estimate_hit:', hasattr(m.MooncakeBootstrapServer, 'estimate_hit'))
\""
fi