Skip to content

Commit cb62743

Browse files
dheerajodhaclaude
andcommitted
fix: fix python SyntaxError in generate-baseline and stderr consistency
Replace def statement with inline re.search calls in the Makefile generate-baseline target — Make collapses \<newline> into one line, and def after a semicolon is a Python SyntaxError. Redirect error messages in compare.sh to stderr for consistency. EC-1819 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent a1c3e5e commit cb62743

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -207,10 +207,10 @@ generate-baseline: benchmark/stress/data.tar.gz ## Generate stress benchmark bas
207207
line = [l for l in open('benchmark-output.txt') if l.startswith('BenchmarkStress')]; \
208208
line or sys.exit('No BenchmarkStress results found'); \
209209
line = line[0]; \
210-
def val(p): \
211-
m = re.search(p, line); \
212-
return m.group(1) if m else ''; \
213-
ns = val(r'([\d.]+)\s+ns/op'); rss = val(r'([\d.]+)\s+peak-RSS-bytes'); \
210+
ns_m = re.search(r'([\d.]+)\s+ns/op', line); \
211+
rss_m = re.search(r'([\d.]+)\s+peak-RSS-bytes', line); \
212+
ns = ns_m.group(1) if ns_m else ''; \
213+
rss = rss_m.group(1) if rss_m else ''; \
214214
(ns and rss) or sys.exit('Failed to parse benchmark metrics'); \
215215
json.dump({'peak_rss_bytes': int(float(rss)), 'ns_per_op': int(float(ns)), \
216216
'components': int('$${EC_STRESS_COMPONENTS:-10}'), 'workers': int('$${EC_STRESS_WORKERS:-10}'), \

benchmark/stress/compare.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,13 @@ if [[ ! -f "$THRESHOLDS" ]]; then
3737
fi
3838

3939
if [[ ! -f "$BENCHMARK_OUTPUT" ]]; then
40-
echo "No benchmark output found at ${BENCHMARK_OUTPUT}"
40+
echo "No benchmark output found at ${BENCHMARK_OUTPUT}" >&2
4141
exit 1
4242
fi
4343

4444
line=$(grep '^BenchmarkStress' "$BENCHMARK_OUTPUT" || true)
4545
if [[ -z "$line" ]]; then
46-
echo "No BenchmarkStress results found in output."
46+
echo "No BenchmarkStress results found in output." >&2
4747
exit 1
4848
fi
4949

@@ -66,7 +66,7 @@ print(ns, rss, b['ns_per_op'], b['peak_rss_bytes'], t['peak_rss_percent'], t['ns
6666
)
6767

6868
if awk -v rss="$baseline_rss" -v ns="$baseline_ns" 'BEGIN {exit !(rss==0 || ns==0)}'; then
69-
echo "Baseline contains zero values, cannot compute regression."
69+
echo "Baseline contains zero values, cannot compute regression." >&2
7070
exit 1
7171
fi
7272

0 commit comments

Comments
 (0)