Skip to content

Commit 0c5b1d0

Browse files
authored
[Feat] Migrate Fleet Simulator to vllm-sr-sim (vllm-project#1583)
* feat: support vllm-sr sim Signed-off-by: xunzhuo <xunzhuo@vllm-semantic-router.ai> * feat: support vllm-sr sim Signed-off-by: xunzhuo <xunzhuo@vllm-semantic-router.ai> * feat: support vllm-sr sim Signed-off-by: xunzhuo <xunzhuo@vllm-semantic-router.ai> * feat: support vllm-sr sim Signed-off-by: xunzhuo <xunzhuo@vllm-semantic-router.ai> * feat: support vllm-sr sim Signed-off-by: xunzhuo <xunzhuo@vllm-semantic-router.ai> * feat: support vllm-sr sim Signed-off-by: xunzhuo <xunzhuo@vllm-semantic-router.ai> * feat: support vllm-sr sim Signed-off-by: xunzhuo <xunzhuo@vllm-semantic-router.ai> * feat: support vllm-sr sim Signed-off-by: xunzhuo <xunzhuo@vllm-semantic-router.ai> * feat: support vllm-sr sim Signed-off-by: xunzhuo <xunzhuo@vllm-semantic-router.ai> * feat: support vllm-sr sim Signed-off-by: xunzhuo <xunzhuo@vllm-semantic-router.ai> * feat: support vllm-sr sim Signed-off-by: xunzhuo <xunzhuo@vllm-semantic-router.ai> --------- Signed-off-by: xunzhuo <xunzhuo@vllm-semantic-router.ai>
1 parent 485c74b commit 0c5b1d0

File tree

173 files changed

+10263
-5604
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

173 files changed

+10263
-5604
lines changed

.github/workflows/ci-changes.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ jobs:
140140
- 'AGENTS.md'
141141
- 'docs/agent/**'
142142
- 'tools/agent/skills/**'
143+
- 'src/fleet-sim/AGENTS.md'
143144
- 'src/vllm-sr/cli/AGENTS.md'
144145
- 'src/semantic-router/pkg/config/AGENTS.md'
145146
- 'src/semantic-router/pkg/extproc/AGENTS.md'

.github/workflows/docker-publish.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ jobs:
6161
packages: write
6262
strategy:
6363
matrix:
64-
image: [dashboard, extproc, extproc-rocm, llm-katan, vllm-sr, vllm-sr-rocm]
64+
image: [dashboard, extproc, extproc-rocm, llm-katan, vllm-sr, vllm-sr-rocm, vllm-sr-sim]
6565
fail-fast: false
6666

6767
steps:
@@ -112,6 +112,9 @@ jobs:
112112
elif [ "${{ matrix.image }}" = "vllm-sr" ]; then
113113
echo "context=." >> $GITHUB_OUTPUT
114114
echo "dockerfile=./src/vllm-sr/Dockerfile" >> $GITHUB_OUTPUT
115+
elif [ "${{ matrix.image }}" = "vllm-sr-sim" ]; then
116+
echo "context=." >> $GITHUB_OUTPUT
117+
echo "dockerfile=./src/fleet-sim/Dockerfile" >> $GITHUB_OUTPUT
115118
elif [ "${{ matrix.image }}" = "vllm-sr-rocm" ]; then
116119
echo "context=." >> $GITHUB_OUTPUT
117120
echo "dockerfile=./src/vllm-sr/Dockerfile.rocm" >> $GITHUB_OUTPUT
@@ -182,7 +185,7 @@ jobs:
182185
packages: write
183186
strategy:
184187
matrix:
185-
image: [dashboard, extproc, llm-katan, vllm-sr]
188+
image: [dashboard, extproc, llm-katan, vllm-sr, vllm-sr-sim]
186189
platform: [linux/amd64, linux/arm64]
187190
fail-fast: false
188191

@@ -248,6 +251,9 @@ jobs:
248251
elif [ "${{ matrix.image }}" = "vllm-sr" ]; then
249252
echo "context=." >> $GITHUB_OUTPUT
250253
echo "dockerfile=./src/vllm-sr/Dockerfile" >> $GITHUB_OUTPUT
254+
elif [ "${{ matrix.image }}" = "vllm-sr-sim" ]; then
255+
echo "context=." >> $GITHUB_OUTPUT
256+
echo "dockerfile=./src/fleet-sim/Dockerfile" >> $GITHUB_OUTPUT
251257
fi
252258
253259
- name: Generate per-platform tag
@@ -548,7 +554,7 @@ jobs:
548554
packages: write
549555
strategy:
550556
matrix:
551-
image: [dashboard, extproc, llm-katan, vllm-sr]
557+
image: [dashboard, extproc, llm-katan, vllm-sr, vllm-sr-sim]
552558
fail-fast: false
553559

554560
steps:

.github/workflows/pre-commit.yml

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,6 @@ jobs:
5252
build-essential \
5353
pkg-config \
5454
shellcheck
55-
npm install -g markdownlint-cli@0.43.0
56-
pip install --user yamllint codespell
5755
5856
- name: Set up golangci-lint
5957
uses: golangci/golangci-lint-action@v7
@@ -101,23 +99,14 @@ jobs:
10199
restore-keys: |
102100
${{ runner.os }}-precommit-
103101
104-
- name: Install pre-commit
105-
run: make precommit-install
106-
107-
- name: Install agent tooling
108-
run: python3 -m pip install -r tools/agent/requirements.txt
109-
110-
- name: Run Code Spell Check
111-
run: make codespell
112-
113-
- name: Run agent fast gate on changed files
102+
- name: Run agent CI lint on changed files
114103
run: |
115104
if [ "${{ github.event_name }}" = "pull_request" ]; then
116105
export AGENT_BASE_REF="origin/${{ github.base_ref }}"
117106
else
118107
export AGENT_BASE_REF="HEAD^"
119108
fi
120-
make agent-fast-gate
109+
make agent-ci-lint
121110
122111
- name: Diagnose gofmt state before pre-commit
123112
run: |
@@ -164,7 +153,9 @@ jobs:
164153
echo "=== Full git diff ==="
165154
git diff || true
166155
echo ""
167-
echo "To run pre-commit locally:"
168-
echo " pip install pre-commit"
169-
echo " pre-commit install"
170-
echo " pre-commit run --all-files"
156+
echo "To reproduce the changed-file CI lint locally:"
157+
echo " make agent-ci-lint CHANGED_FILES=\"path/one,path/two\""
158+
echo ""
159+
echo "To run full pre-commit locally:"
160+
echo " make precommit-install"
161+
echo " make precommit-check"
Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
name: Publish vLLM-SR-Sim Python Package
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- "src/fleet-sim/**"
9+
- ".github/workflows/pypi-publish-vllm-sr-sim.yml"
10+
tags:
11+
- "vllm-sr-sim-v*"
12+
workflow_dispatch:
13+
inputs:
14+
version:
15+
description: "Version to publish (e.g., 0.1.0)"
16+
required: false
17+
type: string
18+
19+
concurrency:
20+
group: ${{ github.workflow }}-${{ github.ref }}
21+
cancel-in-progress: true
22+
23+
jobs:
24+
publish:
25+
if: github.repository == 'vllm-project/semantic-router'
26+
runs-on: ubuntu-latest
27+
permissions:
28+
contents: write
29+
id-token: write
30+
31+
defaults:
32+
run:
33+
working-directory: src/fleet-sim
34+
35+
steps:
36+
- name: Check out the repo
37+
uses: actions/checkout@v4
38+
39+
- name: Set up Python
40+
uses: actions/setup-python@v5
41+
with:
42+
python-version: "3.11"
43+
44+
- name: Extract version from tag, input, or pyproject.toml
45+
id: extract_version
46+
run: |
47+
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
48+
if [ -n "${{ inputs.version }}" ]; then
49+
VERSION="${{ inputs.version }}"
50+
echo "version=$VERSION" >> $GITHUB_OUTPUT
51+
echo "tag=vllm-sr-sim-v$VERSION" >> $GITHUB_OUTPUT
52+
echo "is_dev=false" >> $GITHUB_OUTPUT
53+
else
54+
echo "::error::Version input is required for manual dispatch"
55+
exit 1
56+
fi
57+
elif [[ "${{ github.ref }}" == refs/tags/* ]]; then
58+
TAG="${GITHUB_REF#refs/tags/}"
59+
VERSION="${TAG#vllm-sr-sim-v}"
60+
echo "version=$VERSION" >> $GITHUB_OUTPUT
61+
echo "tag=$TAG" >> $GITHUB_OUTPUT
62+
echo "is_dev=false" >> $GITHUB_OUTPUT
63+
else
64+
BASE_VERSION=$(grep '^version = ' pyproject.toml | sed 's/version = "\(.*\)"/\1/')
65+
TIMESTAMP=$(date -u +%Y%m%d%H%M%S)
66+
DEV_VERSION="${BASE_VERSION}.dev${TIMESTAMP}"
67+
68+
echo "version=$DEV_VERSION" >> $GITHUB_OUTPUT
69+
echo "tag=vllm-sr-sim-v$DEV_VERSION" >> $GITHUB_OUTPUT
70+
echo "is_dev=true" >> $GITHUB_OUTPUT
71+
echo "base_version=$BASE_VERSION" >> $GITHUB_OUTPUT
72+
echo "commit_sha=${{ github.sha }}" >> $GITHUB_OUTPUT
73+
fi
74+
75+
- name: Verify package version matches tag
76+
if: github.event_name != 'workflow_dispatch' && startsWith(github.ref, 'refs/tags/')
77+
run: |
78+
PACKAGE_VERSION=$(grep '^version = ' pyproject.toml | sed 's/version = "\(.*\)"/\1/')
79+
TAG_VERSION="${{ steps.extract_version.outputs.version }}"
80+
if [ "$PACKAGE_VERSION" != "$TAG_VERSION" ]; then
81+
echo "::error::Package version ($PACKAGE_VERSION) does not match tag version ($TAG_VERSION)"
82+
exit 1
83+
fi
84+
85+
- name: Install build dependencies
86+
run: |
87+
python -m pip install --upgrade pip
88+
pip install build twine
89+
90+
- name: Update version in pyproject.toml for dev builds
91+
if: steps.extract_version.outputs.is_dev == 'true'
92+
run: |
93+
sed -i.bak 's/^version = .*/version = "${{ steps.extract_version.outputs.version }}"/' pyproject.toml
94+
grep '^version = ' pyproject.toml
95+
96+
- name: Build package
97+
run: |
98+
python -m build
99+
ls -la dist/
100+
101+
- name: Verify package contents
102+
run: |
103+
unzip -l dist/*.whl | grep -E "(run_sim\.py|fleet_sim/api/app\.py|fleet_sim/data/azure_cdf\.json)" >/dev/null
104+
105+
- name: Check package with twine
106+
run: |
107+
twine check dist/*
108+
109+
- name: Publish to Test PyPI (dry run)
110+
if: github.event_name == 'workflow_dispatch'
111+
env:
112+
TWINE_USERNAME: __token__
113+
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_API_TOKEN }}
114+
run: |
115+
twine upload --repository testpypi dist/* --verbose || true
116+
echo "pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ vllm-sr-sim==${{ steps.extract_version.outputs.version }}"
117+
118+
- name: Publish to PyPI
119+
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/'))
120+
env:
121+
TWINE_USERNAME: __token__
122+
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
123+
run: |
124+
twine upload dist/* --skip-existing --verbose
125+
126+
- name: Create GitHub Release
127+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
128+
uses: softprops/action-gh-release@v1
129+
with:
130+
tag_name: ${{ steps.extract_version.outputs.tag }}
131+
name: vllm-sr-sim ${{ steps.extract_version.outputs.version }}
132+
draft: false
133+
prerelease: false
134+
generate_release_notes: true
135+
body: |
136+
## Installation
137+
138+
```bash
139+
pip install vllm-sr-sim==${{ steps.extract_version.outputs.version }}
140+
```
141+
files: |
142+
src/fleet-sim/dist/*
143+
env:
144+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
145+
146+
- name: Summary
147+
run: |
148+
echo "## vLLM-SR-Sim package published" >> $GITHUB_STEP_SUMMARY
149+
echo "" >> $GITHUB_STEP_SUMMARY
150+
echo "**Version:** ${{ steps.extract_version.outputs.version }}" >> $GITHUB_STEP_SUMMARY
151+
echo "" >> $GITHUB_STEP_SUMMARY
152+
echo '```bash' >> $GITHUB_STEP_SUMMARY
153+
echo "pip install vllm-sr-sim==${{ steps.extract_version.outputs.version }}" >> $GITHUB_STEP_SUMMARY
154+
echo '```' >> $GITHUB_STEP_SUMMARY

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ Thumbs.db
5353
# Project specific
5454
bin/
5555
tools/bin/
56+
.vllm-sr-sim/
5657

5758
# Model files (too large for git)
5859
*.pt
@@ -80,6 +81,9 @@ tools/bin/
8081
models
8182
# Exception for Go models package in dashboard backend
8283
!dashboard/backend/models/
84+
# Exception for the fleet-sim Python model catalog package
85+
!src/fleet-sim/fleet_sim/models/
86+
!src/fleet-sim/fleet_sim/models/**
8387

8488
# Training data
8589
wikipedia_data/

CONTRIBUTING.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,13 @@ make agent-bootstrap
7979
make agent-validate
8080
make agent-scorecard
8181
make agent-report ENV=cpu CHANGED_FILES="path/one,path/two"
82+
make agent-ci-lint CHANGED_FILES="path/one,path/two"
8283
make agent-ci-gate CHANGED_FILES="path/one,path/two"
8384
make agent-feature-gate ENV=cpu CHANGED_FILES="path/one,path/two"
8485
```
8586

87+
Use `make agent-ci-lint` when you want to reproduce the same changed-file lint path that the CI pre-commit workflow runs, including the shared agent bootstrap toolchain and tracked-file codespell check.
88+
8689
`ENV=amd` is required when platform-specific behavior changed.
8790

8891
### Unit Tests

0 commit comments

Comments
 (0)