Skip to content

Commit d370d70

Browse files
authored
Fix the workflowId, jobId and attemp for vllm benchmark and sglang (#112)
* hidemetadata * hidemetadata * hidemetadata * hidemetadata * hidemetadata * hidemetadata * hidemetadata * hidemetadata * hidemetadata * hidemetadata * hidemetadata
1 parent 9709270 commit d370d70

File tree

3 files changed

+34
-7
lines changed

3 files changed

+34
-7
lines changed

.github/scripts/upload_benchmark_results.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,18 +151,23 @@ def get_git_metadata(repo_dir: str) -> Tuple[str, str]:
151151
# We couldn't find the branch name
152152
return repo_name, "main", hexsha, committed_date
153153

154-
155154
def get_benchmark_metadata(
156155
repo_name: str, head_branch: str, head_sha: str, timestamp: int, benchmark_name
157156
) -> Dict[str, Any]:
157+
158+
# combine run branch name with the foreign branch name if it's not main
159+
local_branch = os.getenv("RUN_LOCAL_BRANCH","")
160+
branch_name = head_branch
161+
if local_branch and local_branch != "main":
162+
branch_name = f"{head_branch}({local_branch})"
158163
return {
159164
"timestamp": timestamp,
160165
"schema_version": "v3",
161166
"name": benchmark_name,
162167
"repo": repo_name,
163-
"head_branch": head_branch,
168+
"head_branch": branch_name,
164169
"head_sha": head_sha,
165-
"workflow_id": os.getenv("WORKFLOW_ID", timestamp),
170+
"workflow_id": os.getenv("WORKFLOW_RUN_ID", timestamp),
166171
"run_attempt": os.getenv("RUN_ATTEMPT", 1),
167172
"job_id": os.getenv("JOB_ID", timestamp),
168173
}
@@ -325,7 +330,6 @@ def upload(
325330

326331
def main() -> None:
327332
args = parse_args()
328-
329333
if args.repo:
330334
if args.head_branch or args.head_sha:
331335
warning("No need to set --head-branch and --head-sha when using --repo")

.github/workflows/sglang-benchmark.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,11 @@ jobs:
9999
python-version: '3.12'
100100
cache: 'pip'
101101

102+
- name: Get workflow job id
103+
id: get-job-id
104+
uses: pytorch/test-infra/.github/actions/get-workflow-job-id@36562d6c43fa914f7bdef67ce23e5c31f1387b2e
105+
with:
106+
github-token: ${{ secrets.GITHUB_TOKEN }}
102107

103108
- name: Check if the device is supported
104109
shell: bash
@@ -197,7 +202,7 @@ jobs:
197202
for tag in $(git for-each-ref --sort=-creatordate --format '%(refname:short)' refs/tags); do
198203
candidate_image="lmsysorg/sglang:${tag}${IMAGE_SUFFIX}"
199204
echo "Checking: $candidate_image"
200-
205+
201206
if docker manifest inspect "$candidate_image" >/dev/null 2>&1; then
202207
SELECTED_TAG="$tag"
203208
DOCKER_IMAGE="$candidate_image"
@@ -206,7 +211,7 @@ jobs:
206211
break
207212
fi
208213
done
209-
214+
210215
# Fallback to latest if no tagged version found
211216
if [[ -z "$SELECTED_TAG" ]]; then
212217
echo "No tagged images found, using latest"
@@ -280,12 +285,18 @@ jobs:
280285
env:
281286
BENCHMARK_RESULTS: sglang-benchmarks/benchmarks/results
282287
MODELS: ${{ matrix.models }}
288+
WORKFLOW_RUN_ID: ${{ github.run_id }}
289+
RUN_ATTEMPT: ${{ github.run_attempt }}
290+
JOB_ID: ${{ steps.get-job-id.outputs.job-id }}
291+
RUN_LOCAL_BRANCH: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || github.ref }}
283292
run: |
284293
set -eux
285294
286295
sudo chown -R ${UID} "${BENCHMARK_RESULTS}" || true
287296
ls -lah "${BENCHMARK_RESULTS}" || echo "Results directory not found"
288297
298+
echo "## workflow info: ${WORKFLOW_RUN_ID} ${RUN_ATTEMPT} ${JOB_ID}"
299+
289300
SANITIZED_DEVICE_TYPE=$(echo "${DEVICE_TYPE// /_}" | sed "s/[^[:alnum:].-]/_/g")
290301
SANITIZED_MODELS="${MODELS//\//_}"
291302

.github/workflows/vllm-benchmark.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,12 @@ jobs:
101101
python-version: '3.12'
102102
cache: 'pip'
103103

104+
- name: Get workflow job id
105+
id: get-job-id
106+
uses: pytorch/test-infra/.github/actions/get-workflow-job-id@36562d6c43fa914f7bdef67ce23e5c31f1387b2e
107+
with:
108+
github-token: ${{ secrets.GITHUB_TOKEN }}
109+
104110
- name: Check if the device is supported
105111
shell: bash
106112
run: |
@@ -115,7 +121,7 @@ jobs:
115121
elif command -v hl-smi; then
116122
DEVICE_NAME=hpu
117123
hl-smi
118-
else
124+
else
119125
arch=$(uname -m)
120126
121127
case "$arch" in
@@ -348,12 +354,18 @@ jobs:
348354
env:
349355
BENCHMARK_RESULTS: vllm-benchmarks/vllm/benchmarks/results
350356
MODELS: ${{ matrix.models }}
357+
WORKFLOW_RUN_ID: ${{ github.run_id }}
358+
RUN_ATTEMPT: ${{ github.run_attempt }}
359+
JOB_ID: ${{ steps.get-job-id.outputs.job-id }}
360+
RUN_LOCAL_BRANCH: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || github.ref }}
351361
run: |
352362
set -eux
353363
354364
sudo chown -R ${UID} "${BENCHMARK_RESULTS}"
355365
ls -lah "${BENCHMARK_RESULTS}"
356366
367+
echo "## workflow info: ${WORKFLOW_RUN_ID} ${RUN_ATTEMPT} ${JOB_ID}"
368+
357369
SANITIZED_DEVICE_TYPE=$(echo "${DEVICE_TYPE// /_}" | sed "s/[^[:alnum:].-]/_/g")
358370
SANITIZED_MODELS="${MODELS//\//_}"
359371

0 commit comments

Comments
 (0)