Skip to content

Commit 2dc0aad

Browse files
[CI/Build] Upgrade functionality test (#53)
Signed-off-by: Shaoting Feng <[email protected]>
1 parent bc1d292 commit 2dc0aad

File tree

6 files changed

+86
-11
lines changed

6 files changed

+86
-11
lines changed

.github/curl-01-minimal-example.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
3+
# Curl and save output
4+
[ ! -d "output-01-minimal-example" ] && mkdir output-01-minimal-example
5+
chmod -R 777 output-01-minimal-example
6+
result_model=$(curl -s http://$1:$2/models | tee output-01-minimal-example/models-01-minimal-example.json)
7+
result_query=$(curl -X POST http://$1:$2/completions -H "Content-Type: application/json" -d '{"model": "facebook/opt-125m", "prompt": "Once upon a time,", "max_tokens": 10}' | tee output-01-minimal-example/query-01-minimal-example.json)

.github/curl-04-multiple-models.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
3+
# Curl and save output
4+
[ ! -d "output-04-multiple-models" ] && mkdir output-04-multiple-models
5+
chmod -R 777 output-04-multiple-models
6+
result_model=$(curl -s http://$1:$2/models | tee output-04-multiple-models/models-04-multiple-models.json)
7+
8+
source /usr/local/bin/conda-init
9+
conda activate llmstack
10+
result_query=$(python3 tutorials/assets/example-04-openai.py --openai_api_base "http://$1:$2/" | tee output-04-multiple-models/query-04-multiple-models.json)

.github/multiple-models.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
servingEngineSpec:
2+
modelSpec:
3+
- name: "opt125m"
4+
repository: "vllm/vllm-openai"
5+
tag: "latest"
6+
modelURL: "facebook/opt-125m"
7+
replicaCount: 1
8+
requestCPU: 6
9+
requestMemory: "16Gi"
10+
requestGPU: 1
11+
pvcStorage: "10Gi"
12+
13+
- name: "smol135m"
14+
repository: "vllm/vllm-openai"
15+
tag: "latest"
16+
modelURL: "HuggingFaceTB/SmolLM2-135M-Instruct"
17+
replicaCount: 1
18+
requestCPU: 6
19+
requestMemory: "16Gi"
20+
requestGPU: 1
21+
pvcStorage: "10Gi"

.github/port-forward.sh

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,4 @@ sudo kubectl patch service vllm-router-service -p '{"spec":{"type":"NodePort"}}'
2929
ip=$(sudo minikube ip)
3030
port=$(sudo kubectl get svc vllm-router-service -o=jsonpath='{.spec.ports[0].nodePort}')
3131

32-
# Curl and save output
33-
[ ! -d "output" ] && mkdir output
34-
chmod -R 777 output
35-
result_model=$(curl -s http://$ip:$port/models | tee output/models.json)
36-
result_query=$(curl -X POST http://$ip:$port/completions -H "Content-Type: application/json" -d '{"model": "facebook/opt-125m", "prompt": "Once upon a time,", "max_tokens": 10}' | tee output/query.json)
32+
bash .github/$1.sh $ip $port

.github/workflows/functionality-helm-chart.yml

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ on:
1717
- 'helm/**'
1818
merge_group:
1919
jobs:
20-
Check-Health-of-Cluster:
20+
Minimal-Example:
2121
runs-on: self-hosted
2222
steps:
2323
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
@@ -34,13 +34,37 @@ jobs:
3434
sudo helm install vllm vllm/vllm-stack -f tutorials/assets/values-01-minimal-example.yaml
3535
- name: Validate the installation and send query to the stack
3636
run: |
37-
sudo bash .github/port-forward.sh
37+
sudo bash .github/port-forward.sh curl-01-minimal-example
38+
timeout-minutes: 2
3839
- name: Archive functionality results
3940
uses: actions/upload-artifact@v4
4041
with:
41-
name: curl-models-query
42+
name: output-01-minimal-example
4243
path: |
43-
output/
44+
output-01-minimal-example/
45+
- name: Helm uninstall
46+
run: |
47+
sudo helm uninstall vllm
48+
if: always()
49+
- run: echo "🍏 This job's status is ${{ job.status }}."
50+
51+
Multiple-Models:
52+
runs-on: self-hosted
53+
needs: Minimal-Example
54+
steps:
55+
- name: Deploy via helm charts
56+
run: |
57+
sudo helm install vllm vllm/vllm-stack -f .github/multiple-models.yaml
58+
- name: Validate the installation and send query to the stack
59+
run: |
60+
sudo bash .github/port-forward.sh curl-04-multiple-models
61+
timeout-minutes: 2
62+
- name: Archive functionality results
63+
uses: actions/upload-artifact@v4
64+
with:
65+
name: output-04-multiple-models
66+
path: |
67+
output-04-multiple-models/
4468
- name: Helm uninstall
4569
run: |
4670
sudo helm uninstall vllm

tutorials/assets/example-04-openai.py

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,25 @@
1+
import argparse
2+
13
from openai import OpenAI
24

5+
# Set up argument parsing
6+
parser = argparse.ArgumentParser(description="Use OpenAI API with custom base URL")
7+
parser.add_argument(
8+
"--openai_api_base",
9+
type=str,
10+
default="http://localhost:30080/",
11+
help="The base URL for the OpenAI API",
12+
)
13+
parser.add_argument(
14+
"--openai_api_key", type=str, default="EMPTY", help="The API key for OpenAI"
15+
)
16+
17+
# Parse the arguments
18+
args = parser.parse_args()
19+
320
# Modify OpenAI's API key and API base to use vLLM's API server.
4-
openai_api_key = "EMPTY"
5-
openai_api_base = "http://localhost:30080/"
21+
openai_api_key = args.openai_api_key
22+
openai_api_base = args.openai_api_base
623

724
client = OpenAI(
825
api_key=openai_api_key,

0 commit comments

Comments
 (0)