Skip to content

Commit 3c3a99e

Browse files
committed
fix missing traces for single node
1 parent cf69d4f commit 3c3a99e

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

‎.github/workflows/profile.yml‎

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -184,18 +184,23 @@ jobs:
184184
if [ -f "$trace_path" ]; then
185185
echo "trace=$trace_path" >> "$GITHUB_OUTPUT"
186186
if [ "${FRAMEWORK}" = "sglang" ]; then
187-
# Try to locate corresponding TP-0 traces produced by SGLang profiler
188-
merged_latest=$(ls -t profiles/merged-*.trace.json.gz 2>/dev/null | head -n1 || true)
187+
# Locate per-stage TP-0 traces produced by SGLang profiler.
188+
# SGLang writes to SGLANG_TORCH_PROFILER_DIR (typically /workspace/).
189+
# With profile_by_stage=true, filenames are: {id}-TP-0[-DP-0][-EP-0]-{EXTEND|DECODE}.trace.json.gz
190+
prof_dir="${SGLANG_TORCH_PROFILER_DIR:-/workspace}"
191+
merged_latest=$(ls -t "$prof_dir"/merged-*.trace.json.gz 2>/dev/null | head -n1 || true)
189192
if [ -n "${merged_latest}" ] && [ -f "${merged_latest}" ]; then
193+
trace_dir="$(dirname "$merged_latest")"
190194
ts_name="${merged_latest##*/}"
191195
ts_name="${ts_name#merged-}"
192196
ts_name="${ts_name%.trace.json.gz}"
193-
tp0_decode="profiles/${ts_name}-TP-0-DECODE.trace.json.gz"
194-
tp0_extend="profiles/${ts_name}-TP-0-EXTEND.trace.json.gz"
195-
if [ -f "${tp0_decode}" ]; then
197+
# Find TP-0 DECODE/EXTEND traces (filename includes optional DP/EP rank suffixes)
198+
tp0_decode=$(ls -t "$trace_dir"/${ts_name}-TP-0*DECODE.trace.json.gz 2>/dev/null | head -n1 || true)
199+
tp0_extend=$(ls -t "$trace_dir"/${ts_name}-TP-0*EXTEND.trace.json.gz 2>/dev/null | head -n1 || true)
200+
if [ -n "${tp0_decode}" ] && [ -f "${tp0_decode}" ]; then
196201
echo "tp0_decode=${tp0_decode}" >> "$GITHUB_OUTPUT"
197202
fi
198-
if [ -f "${tp0_extend}" ]; then
203+
if [ -n "${tp0_extend}" ] && [ -f "${tp0_extend}" ]; then
199204
echo "tp0_extend=${tp0_extend}" >> "$GITHUB_OUTPUT"
200205
fi
201206
fi

0 commit comments

Comments
 (0)