Skip to content

Commit c1af8a0

Browse files
author
KadenZhang3321
committed
obs_stability: add load-model test replicating PR#16718 traffic shape
setup: generate + multipart-upload shared snapshot (runs-on/cache style, 32MB parts, 4 workers). write: N concurrent MPU uploads of MB-sized snapshots from hk + cn12-via-liqo pools in business containers. read: M concurrent downloads. report aggregates per region. cleanup deletes the whole load-model/ prefix. s3obj gains SigV4 query-param signing, create/upload-part/complete/abort MPU and delete-prefix; all verified against the real bucket locally (SIGN-OK). Signed-off-by: KadenZhang3321 <1075567213@gmail.com>
1 parent 151d2a5 commit c1af8a0

5 files changed

Lines changed: 552 additions & 51 deletions

File tree

Lines changed: 182 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
1+
name: obs-hk-load-model-test
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
payload_mb:
7+
description: Snapshot size per writer in MB
8+
type: number
9+
default: 2048
10+
writers:
11+
description: Concurrent multipart snapshot uploads
12+
type: number
13+
default: 8
14+
readers:
15+
description: Concurrent snapshot downloads
16+
type: number
17+
default: 12
18+
downloads_per_reader:
19+
description: Downloads per reader
20+
type: number
21+
default: 2
22+
runner_pool:
23+
description: JSON array of {tag, region, image}, jobs spread round-robin
24+
type: string
25+
default: '[{"tag": "linux-amd64-cpu-test-16-hk", "region": "hk", "image": "quay.io/ascend-ci/vllm-ascend:lint"}, {"tag": "linux-amd64-cpu-test-24-hk", "region": "hk", "image": "quay.io/ascend-ci/vllm-ascend:lint"}, {"tag": "linux-aarch64-a3-test-2-cn12-001", "region": "cn12-via-liqo-gy005", "image": "swr.cn-southwest-2.myhuaweicloud.com/base_image/ascend-ci/cann:9.0.0-a3-ubuntu22.04-py3.12"}]'
26+
keep_payload:
27+
description: Keep test objects in the bucket after the run
28+
type: boolean
29+
default: false
30+
31+
concurrency:
32+
group: obs-hk-load-model-test
33+
cancel-in-progress: false
34+
35+
env:
36+
OBS_ENDPOINT: https://obs.ap-southeast-1.myhuaweicloud.com
37+
OBS_BUCKET: ascend-ci-cache-hk
38+
OBS_REGION: ap-southeast-1
39+
40+
jobs:
41+
setup:
42+
name: upload snapshot & plan load
43+
runs-on: linux-amd64-cpu-test-8-hk
44+
timeout-minutes: 30
45+
env:
46+
HW_OBS_AK: ${{ secrets.HW_OBS_AK_HK }}
47+
HW_OBS_SK: ${{ secrets.HW_OBS_SK_HK }}
48+
outputs:
49+
prefix: ${{ steps.plan.outputs.prefix }}
50+
snapshot_key: ${{ steps.plan.outputs.snapshot_key }}
51+
sha256: ${{ steps.plan.outputs.sha256 }}
52+
setup_mbps: ${{ steps.plan.outputs.setup_mbps }}
53+
matrix_writers: ${{ steps.plan.outputs.matrix_writers }}
54+
matrix_readers: ${{ steps.plan.outputs.matrix_readers }}
55+
steps:
56+
- uses: actions/checkout@v4
57+
58+
- name: Upload snapshot and build matrices
59+
id: plan
60+
run: |
61+
python3 .github/workflows/scripts/obs_stability/setup_load.py \
62+
--endpoint "$OBS_ENDPOINT" \
63+
--bucket "$OBS_BUCKET" \
64+
--region "$OBS_REGION" \
65+
--prefix "load-model/${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}" \
66+
--size-mb "${{ inputs.payload_mb }}" \
67+
--writers "${{ inputs.writers }}" \
68+
--readers "${{ inputs.readers }}" \
69+
--runner-pool '${{ inputs.runner_pool }}' \
70+
--output-file "$GITHUB_OUTPUT"
71+
72+
write:
73+
name: write-${{ matrix.writer_id }} (${{ matrix.region }})
74+
needs: setup
75+
runs-on: ${{ matrix.runner }}
76+
timeout-minutes: 45
77+
strategy:
78+
fail-fast: false
79+
matrix:
80+
include: ${{ fromJSON(needs.setup.outputs.matrix_writers) }}
81+
container:
82+
image: ${{ matrix.image }}
83+
env:
84+
HW_OBS_AK: ${{ secrets.HW_OBS_AK_HK }}
85+
HW_OBS_SK: ${{ secrets.HW_OBS_SK_HK }}
86+
steps:
87+
- uses: actions/checkout@v4
88+
89+
- name: Multipart snapshot upload
90+
run: |
91+
python3 .github/workflows/scripts/obs_stability/write.py \
92+
--endpoint "$OBS_ENDPOINT" \
93+
--bucket "$OBS_BUCKET" \
94+
--region "$OBS_REGION" \
95+
--key "${{ matrix.key }}" \
96+
--size-mb "${{ inputs.payload_mb }}" \
97+
--writer-id "${{ matrix.writer_id }}" \
98+
--region-label "${{ matrix.region }}" \
99+
--runner-tag "${{ matrix.runner }}" \
100+
--out /tmp/obs-test/write.json
101+
102+
- uses: actions/upload-artifact@v4
103+
if: always()
104+
with:
105+
name: write-${{ matrix.writer_id }}
106+
path: /tmp/obs-test/
107+
108+
read:
109+
name: read-${{ matrix.reader_id }} (${{ matrix.region }})
110+
needs: setup
111+
runs-on: ${{ matrix.runner }}
112+
timeout-minutes: 45
113+
strategy:
114+
fail-fast: false
115+
matrix:
116+
include: ${{ fromJSON(needs.setup.outputs.matrix_readers) }}
117+
container:
118+
image: ${{ matrix.image }}
119+
env:
120+
HW_OBS_AK: ${{ secrets.HW_OBS_AK_HK }}
121+
HW_OBS_SK: ${{ secrets.HW_OBS_SK_HK }}
122+
steps:
123+
- uses: actions/checkout@v4
124+
125+
- name: Download snapshot repeatedly
126+
run: |
127+
mkdir -p /tmp/obs-test
128+
python3 .github/workflows/scripts/obs_stability/read.py \
129+
--endpoint "$OBS_ENDPOINT" \
130+
--bucket "$OBS_BUCKET" \
131+
--region "$OBS_REGION" \
132+
--key "${{ needs.setup.outputs.snapshot_key }}" \
133+
--sha256 "${{ needs.setup.outputs.sha256 }}" \
134+
--downloads "${{ inputs.downloads_per_reader }}" \
135+
--region-label "${{ matrix.region }}" \
136+
--reader-id "${{ matrix.reader_id }}" \
137+
--runner-tag "${{ matrix.runner }}" \
138+
--out /tmp/obs-test/result.json
139+
140+
- uses: actions/upload-artifact@v4
141+
if: always()
142+
with:
143+
name: result-${{ matrix.reader_id }}
144+
path: /tmp/obs-test/
145+
146+
report:
147+
name: aggregate report
148+
needs: [setup, write, read]
149+
if: always() && needs.setup.result == 'success'
150+
runs-on: linux-amd64-cpu-test-8-hk
151+
timeout-minutes: 10
152+
steps:
153+
- uses: actions/checkout@v4
154+
155+
- uses: actions/download-artifact@v4
156+
with:
157+
path: results
158+
merge-multiple: false
159+
160+
- name: Summary
161+
run: |
162+
python3 .github/workflows/scripts/obs_stability/report.py results \
163+
"${{ needs.setup.outputs.snapshot_key }}" \
164+
"${{ needs.setup.outputs.setup_mbps }}" | tee /tmp/obs-report.md
165+
cat /tmp/obs-report.md >> "$GITHUB_STEP_SUMMARY"
166+
167+
cleanup:
168+
name: delete test objects
169+
needs: [setup, write, read]
170+
if: always() && !inputs.keep_payload && needs.setup.result == 'success'
171+
runs-on: linux-amd64-cpu-test-8-hk
172+
timeout-minutes: 10
173+
env:
174+
OBS_AK: ${{ secrets.HW_OBS_AK_HK }}
175+
OBS_SK: ${{ secrets.HW_OBS_SK_HK }}
176+
steps:
177+
- uses: actions/checkout@v4
178+
179+
- name: Delete load-model prefix
180+
run: |
181+
python3 .github/workflows/scripts/obs_stability/s3obj.py delete-prefix \
182+
--key "${{ needs.setup.outputs.prefix }}/"

‎.github/workflows/scripts/obs_stability/report.py‎

Lines changed: 61 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env python3
2-
"""Aggregate per-reader result JSONs into a markdown summary."""
2+
"""Aggregate per-writer/per-reader result JSONs into a markdown summary."""
33

44
import contextlib
55
import glob
@@ -25,29 +25,43 @@ def fmt(values, unit=""):
2525
)
2626

2727

28-
def main() -> int:
28+
def main():
2929
results_root = sys.argv[1] if len(sys.argv) > 1 else "results"
30-
object_key = sys.argv[2] if len(sys.argv) > 2 else "n/a"
31-
upload_mbps = sys.argv[3] if len(sys.argv) > 3 else "n/a"
30+
snapshot_key = sys.argv[2] if len(sys.argv) > 2 else "n/a"
31+
setup_mbps = sys.argv[3] if len(sys.argv) > 3 else "n/a"
3232

33-
regions = {}
33+
readers = {}
34+
writers = {}
3435
failures = []
3536
sha_mismatch = []
36-
for dirpath in sorted(glob.glob(os.path.join(results_root, "result-*"))):
37+
for dirpath in sorted(glob.glob(os.path.join(results_root, "*"))):
3738
result_file = os.path.join(dirpath, "result.json")
38-
if not os.path.exists(result_file):
39+
write_file = os.path.join(dirpath, "write.json")
40+
path = result_file if os.path.exists(result_file) else write_file
41+
if not os.path.exists(path):
3942
continue
40-
with open(result_file) as f:
43+
with open(path) as f:
4144
data = json.load(f)
4245
region = data.get("region", "other")
43-
if data.get("attempts") and any(a.get("ok") for a in data["attempts"]):
44-
if not data.get("sha256_verified", True):
45-
sha_mismatch.append(data.get("reader_id"))
46-
stats = regions.setdefault(
46+
if data.get("kind") == "write":
47+
w = writers.setdefault(region, {"jobs": 0, "ok": 0, "bad": 0, "mbps": [], "part_errors": 0})
48+
w["jobs"] += 1
49+
if data.get("ok"):
50+
w["ok"] += 1
51+
w["mbps"].append(data["mbps"])
52+
w["part_errors"] += data.get("part_errors") or 0
53+
else:
54+
w["bad"] += 1
55+
failures.append({"job": f"w{data.get('writer_id')}", "runner": data.get("runner_tag"), "error": data.get("error")})
56+
continue
57+
stats = readers.setdefault(
4758
region,
4859
{"readers": 0, "ok": 0, "bad": 0, "mbps": [], "seconds": [], "curl": []},
4960
)
5061
stats["readers"] += 1
62+
if data.get("attempts") and any(a.get("ok") for a in data["attempts"]):
63+
if not data.get("sha256_verified", True):
64+
sha_mismatch.append(data.get("reader_id"))
5165
for attempt in data.get("attempts", []):
5266
if attempt.get("ok"):
5367
stats["ok"] += 1
@@ -57,10 +71,9 @@ def main() -> int:
5771
stats["bad"] += 1
5872
failures.append(
5973
{
60-
"reader": data.get("reader_id"),
74+
"job": f"r{data.get('reader_id')}",
6175
"runner": data.get("runner_tag"),
62-
"attempt": attempt.get("attempt"),
63-
"error": attempt.get("error"),
76+
"error": f"attempt {attempt.get('attempt')}: {attempt.get('error')}",
6477
}
6578
)
6679
curl_file = os.path.join(dirpath, "curl.txt")
@@ -72,35 +85,45 @@ def main() -> int:
7285
with contextlib.suppress(ValueError):
7386
stats["curl"].append(float(parts[5]))
7487

75-
print("## OBS HK bucket access stability report")
76-
print()
77-
print(f"- bucket object: `{object_key}`")
78-
print(f"- upload (prepare job): {upload_mbps} Mbps")
88+
print("## OBS HK load-model report (csrc-cache style, PR #16718 traffic shape)")
7989
print()
80-
print("| region | readers | ok / fail | download Mbps | curl total (s) |")
81-
print("|---|---|---|---|---|")
82-
total_bad = 0
83-
for region in sorted(regions):
84-
stats = regions[region]
85-
total_bad += stats["bad"]
86-
print(
87-
f"| {region} | {stats['readers']} | {stats['ok']} / {stats['bad']} "
88-
f"| {fmt(stats['mbps'])} | {fmt(stats['curl'], 's')} |"
89-
)
90+
print(f"- snapshot object: `{snapshot_key}`; setup MPU (hk): {setup_mbps} Mbps")
9091
print()
91-
if failures:
92-
print("### Failed attempts")
92+
if writers:
93+
print("### Writers (concurrent multipart snapshot uploads)")
9394
print()
94-
for item in failures[:80]:
95-
print(f"- reader `{item['reader']}` on `{item['runner']}` attempt {item['attempt']}: {item['error']}")
95+
print("| region | writers | ok / fail | upload Mbps | part errors |")
96+
print("|---|---|---|---|---|")
97+
for region in sorted(writers):
98+
w = writers[region]
99+
print(
100+
f"| {region} | {w['jobs']} | {w['ok']} / {w['bad']} "
101+
f"| {fmt(w['mbps'])} | {w['part_errors']} |"
102+
)
103+
print()
104+
if readers:
105+
print("### Readers (concurrent snapshot downloads)")
106+
print()
107+
print("| region | readers | ok / fail | download Mbps | curl total (s) |")
108+
print("|---|---|---|---|---|")
109+
for region in sorted(readers):
110+
stats = readers[region]
111+
print(
112+
f"| {region} | {stats['readers']} | {stats['ok']} / {stats['bad']} "
113+
f"| {fmt(stats['mbps'])} | {fmt(stats['curl'], 's')} |"
114+
)
96115
print()
116+
bad = sum(w["bad"] for w in writers.values()) + sum(r["bad"] for r in readers.values())
97117
if sha_mismatch:
98-
print(f"**sha256 mismatch in reader(s): {sha_mismatch}** — data corruption, investigate.")
118+
print(f"**sha256 mismatch in reader(s): {sha_mismatch}** — investigate.")
119+
print()
120+
if failures:
121+
print("### Failed jobs/attempts")
122+
print()
123+
for item in failures[:80]:
124+
print(f"- `{item['job']}` on `{item['runner']}`: {item['error']}")
99125
print()
100-
if total_bad == 0:
101-
print("All download attempts succeeded.")
102-
else:
103-
print(f"**{total_bad} failed attempt(s)** — see details above.")
126+
print("All writes/reads succeeded." if bad == 0 else f"**{bad} failure(s)** — see details above.")
104127
return 0
105128

106129

0 commit comments

Comments
 (0)