From 657812f8c4b4b638704b07ec4d7b2e9f30d100b5 Mon Sep 17 00:00:00 2001 From: Gahow Wang Date: Sun, 24 May 2026 11:59:52 +0800 Subject: [PATCH] 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) --- scripts/deploy_vllm_patches.sh | 55 ++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100755 scripts/deploy_vllm_patches.sh diff --git a/scripts/deploy_vllm_patches.sh b/scripts/deploy_vllm_patches.sh new file mode 100755 index 0000000..44faf47 --- /dev/null +++ b/scripts/deploy_vllm_patches.sh @@ -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