Skip to content

Commit 440d8b6

Browse files
committed
performance-test.yml: pytest -s + guard report pipeline
The previous run's speedup worked (step #6 went 3 min -> 1 min, step #8 7 min -> 5 min, total ~7 min wall time), but step #9 Create Performance Report aborted because pytest captures stdout by default. The test code's per-query timing prints (`NeuronsPartHere: 1.28s ✅` etc) never made it into performance_test_output.log, and the report parser's `grep -E ^(...) | while read` pipe returned grep-exit-1 on the empty match. With pipefail+set-e that's a step failure. Two-pronged fix: 1. `pytest -v -n auto` -> `pytest -v -s -n auto` in step #6, and `pytest -v -n 8` -> `pytest -v -s -n 8` in step #8. `-s` disables stdout capture so the timing prints land in the log like they did under `python -m unittest`. 2. Wrap the timing-extraction grep in `{ grep || true; } | while` so pipefail can't fail the report step on a future format change.
1 parent 28d0614 commit 440d8b6

1 file changed

Lines changed: 10 additions & 7 deletions

File tree

.github/workflows/performance-test.yml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,15 @@ jobs:
5959
run: |
6060
set +e
6161
echo "=== Performance test attempt 1/2 (parallel) ==="
62-
pytest -v -n auto src/test/test_query_performance.py 2>&1 | tee performance_test_output.log
62+
pytest -v -s -n auto src/test/test_query_performance.py 2>&1 | tee performance_test_output.log
6363
FIRST_EXIT=${PIPESTATUS[0]}
6464
if [[ $FIRST_EXIT -eq 0 ]]; then
6565
exit 0
6666
fi
6767
echo ""
6868
echo "=== Attempt 1 failed (exit $FIRST_EXIT). Retrying once with warm cache. ==="
6969
echo "=== RETRY ATTEMPT (auto-retry on first failure) ===" > performance_test_output.log
70-
pytest -v -n auto src/test/test_query_performance.py 2>&1 | tee -a performance_test_output.log
70+
pytest -v -s -n auto src/test/test_query_performance.py 2>&1 | tee -a performance_test_output.log
7171
exit ${PIPESTATUS[0]}
7272
7373
- name: Run Legacy Performance Test
@@ -123,7 +123,7 @@ jobs:
123123
# grades on the last attempt only.
124124
set +e
125125
echo "=== Connectivity test attempt 1/2 (parallel) ==="
126-
pytest -v -n 8 \
126+
pytest -v -s -n 8 \
127127
src/test/test_neuron_neuron_connectivity.py \
128128
src/test/test_neuron_region_connectivity.py \
129129
src/test/test_upstream_class_connectivity.py \
@@ -137,7 +137,7 @@ jobs:
137137
fi
138138
echo ""
139139
echo "=== Connectivity attempt 1 failed (exit $FIRST_EXIT). Retrying once with warm cache. ==="
140-
pytest -v -n 8 \
140+
pytest -v -s -n 8 \
141141
src/test/test_neuron_neuron_connectivity.py \
142142
src/test/test_neuron_region_connectivity.py \
143143
src/test/test_upstream_class_connectivity.py \
@@ -296,9 +296,12 @@ jobs:
296296
echo "| Query | Duration | Status |" >> performance.md
297297
echo "|-------|----------|--------|" >> performance.md
298298
299-
# Parse timing information
300-
grep -E "^(get_term_info|NeuronsPartHere|NeuronsSynaptic|NeuronsPresynapticHere|NeuronsPostsynapticHere|ComponentsOf|PartsOf|SubclassesOf|NeuronClassesFasciculatingHere|TractsNervesInnervatingHere|LineageClonesIn|ListAllAvailableImages|NeuronNeuronConnectivityQuery|NeuronRegionConnectivityQuery|NeuronInputsTo|DownstreamClassConnectivity|UpstreamClassConnectivity|QueryConnectivity):" performance_test_output.log | while read line; do
301-
QUERY=$(echo "$line" | sed 's/:.*//')
299+
# Parse timing information. The `|| true` guards against pipefail
300+
# propagating grep's exit-1 (no matches) into the step — which
301+
# was happening when pytest captured stdout and the per-query
302+
# timing lines never landed in the log.
303+
{ grep -E "^(get_term_info|NeuronsPartHere|NeuronsSynaptic|NeuronsPresynapticHere|NeuronsPostsynapticHere|ComponentsOf|PartsOf|SubclassesOf|NeuronClassesFasciculatingHere|TractsNervesInnervatingHere|LineageClonesIn|ListAllAvailableImages|NeuronNeuronConnectivityQuery|NeuronRegionConnectivityQuery|NeuronInputsTo|DownstreamClassConnectivity|UpstreamClassConnectivity|QueryConnectivity):" performance_test_output.log || true; } | while read line; do
304+
QUERY=$(echo "$line" | sed 's/:.*//')
302305
DURATION=$(echo "$line" | sed 's/.*: \([0-9.]*\)s.*/\1/')
303306
if echo "$line" | grep -q "✅"; then
304307
STATUS="✅ Pass"

0 commit comments

Comments
 (0)