Skip to content

Commit 3b3e1f4

Browse files
authored
Merge pull request #34 from VirtualFlyBrain/dev
Expanding queries
2 parents faabc5d + 1999824 commit 3b3e1f4

15 files changed

Lines changed: 4834 additions & 187 deletions

.github/workflows/performance-test.yml

Lines changed: 78 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,11 @@ jobs:
3131
3232
- name: Run Performance Test
3333
run: |
34-
export PYTHONPATH=$PYTHONPATH:$PWD/
35-
echo "Running performance test for term info queries..."
36-
python -m unittest -v src.test.term_info_queries_test.TermInfoQueriesTest.test_term_info_performance 2>&1 | tee performance_test_output.log
37-
continue-on-error: true # Continue even if performance thresholds are exceeded
34+
python -m unittest src.test.test_query_performance -v 2>&1 | tee performance_test_output.log
35+
36+
- name: Run Legacy Performance Test
37+
run: |
38+
python -m unittest -v src.test.term_info_queries_test.TermInfoQueriesTest.test_term_info_performance 2>&1 | tee -a performance_test_output.log
3839
3940
- name: Create Performance Report
4041
if: always() # Always run this step, even if the test fails
@@ -46,63 +47,107 @@ jobs:
4647
**Test Date:** $(date -u '+%Y-%m-%d %H:%M:%S UTC')
4748
**Git Commit:** ${{ github.sha }}
4849
**Branch:** ${{ github.ref_name }}
49-
**Workflow Run:** ${{ github.run_id }}
50+
**Workflow Run:** [${{ github.run_id }}](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})
5051
5152
## Test Overview
5253
53-
This performance test measures the execution time of VFB term info queries for specific terms:
54+
This performance test measures the execution time of all implemented VFB queries including:
55+
56+
### Core Queries
57+
- **Term Info Queries**: Basic term information retrieval
58+
- **Neuron Part Queries**: Neurons with parts overlapping regions
59+
- **Synaptic Terminal Queries**: Pre/post synaptic terminals
60+
- **Anatomical Hierarchy**: Components, parts, subclasses
61+
- **Instance Queries**: Available images and instances
5462
55-
- **FBbt_00003748**: mushroom body (anatomical class)
56-
- **VFB_00101567**: individual anatomy data
63+
### New Queries (2025)
64+
- **NeuronClassesFasciculatingHere**: Neurons fasciculating with tracts
65+
- **TractsNervesInnervatingHere**: Tracts/nerves innervating neuropils
66+
- **LineageClonesIn**: Lineage clones in neuropils
5767
5868
## Performance Thresholds
5969
60-
- Maximum single query time: 2 seconds
61-
- Maximum total time for both queries: 4 seconds
70+
- **Fast queries**: < 1 second (SOLR lookups)
71+
- **Medium queries**: < 3 seconds (Owlery + SOLR)
72+
- **Slow queries**: < 10 seconds (Neo4j + complex processing)
6273
6374
## Test Results
6475
65-
```
76+
\`\`\`
6677
$(cat performance_test_output.log)
67-
```
78+
\`\`\`
6879
6980
## Summary
7081
7182
EOF
7283
73-
# Extract timing information from the test output
74-
if grep -q "Performance Test Results:" performance_test_output.log; then
75-
echo "✅ **Test Status**: Performance test completed" >> performance.md
84+
# Check overall test status
85+
if grep -q "OK" performance_test_output.log || grep -q "Ran.*test" performance_test_output.log; then
86+
echo "✅ **Test Status**: Performance tests completed" >> performance.md
7687
echo "" >> performance.md
7788
78-
# Extract timing data
79-
if grep -q "FBbt_00003748 query took:" performance_test_output.log; then
80-
TIMING1=$(grep "FBbt_00003748 query took:" performance_test_output.log | sed 's/.*took: \([0-9.]*\) seconds.*/\1/')
81-
echo "- **FBbt_00003748 Query Time**: ${TIMING1} seconds" >> performance.md
82-
fi
89+
# Count successes and failures
90+
TOTAL_TESTS=$(grep -c "^test_" performance_test_output.log || echo "0")
91+
FAILED_TESTS=$(grep -c "FAIL:" performance_test_output.log || echo "0")
92+
ERROR_TESTS=$(grep -c "ERROR:" performance_test_output.log || echo "0")
93+
PASSED_TESTS=$((TOTAL_TESTS - FAILED_TESTS - ERROR_TESTS))
8394
84-
if grep -q "VFB_00101567 query took:" performance_test_output.log; then
85-
TIMING2=$(grep "VFB_00101567 query took:" performance_test_output.log | sed 's/.*took: \([0-9.]*\) seconds.*/\1/')
86-
echo "- **VFB_00101567 Query Time**: ${TIMING2} seconds" >> performance.md
87-
fi
95+
echo "### Test Statistics" >> performance.md
96+
echo "" >> performance.md
97+
echo "- **Total Tests**: ${TOTAL_TESTS}" >> performance.md
98+
echo "- **Passed**: ${PASSED_TESTS} ✅" >> performance.md
99+
echo "- **Failed**: ${FAILED_TESTS} ❌" >> performance.md
100+
echo "- **Errors**: ${ERROR_TESTS} ⚠️" >> performance.md
101+
echo "" >> performance.md
102+
103+
# Extract timing information for key queries
104+
echo "### Query Performance Details" >> performance.md
105+
echo "" >> performance.md
88106
89-
if grep -q "Total time for both queries:" performance_test_output.log; then
90-
TOTAL_TIME=$(grep "Total time for both queries:" performance_test_output.log | sed 's/.*queries: \([0-9.]*\) seconds.*/\1/')
91-
echo "- **Total Query Time**: ${TOTAL_TIME} seconds" >> performance.md
107+
# Extract all timing lines
108+
if grep -q "seconds" performance_test_output.log; then
109+
echo "| Query | Duration | Status |" >> performance.md
110+
echo "|-------|----------|--------|" >> performance.md
111+
112+
# Parse timing information
113+
grep -E "^(get_term_info|NeuronsPartHere|NeuronsSynaptic|NeuronsPresynapticHere|NeuronsPostsynapticHere|ComponentsOf|PartsOf|SubclassesOf|NeuronClassesFasciculatingHere|TractsNervesInnervatingHere|LineageClonesIn|ListAllAvailableImages):" performance_test_output.log | while read line; do
114+
QUERY=$(echo "$line" | sed 's/:.*//')
115+
DURATION=$(echo "$line" | sed 's/.*: \([0-9.]*\)s.*/\1/')
116+
if echo "$line" | grep -q "✅"; then
117+
STATUS="✅ Pass"
118+
else
119+
STATUS="❌ Fail"
120+
fi
121+
echo "| $QUERY | ${DURATION}s | $STATUS |" >> performance.md
122+
done
92123
fi
93124
94-
# Check if test passed or failed
95-
if grep -q "OK" performance_test_output.log; then
96-
echo "" >> performance.md
125+
echo "" >> performance.md
126+
127+
# Overall result
128+
if [ "$FAILED_TESTS" -eq "0" ] && [ "$ERROR_TESTS" -eq "0" ]; then
97129
echo "🎉 **Result**: All performance thresholds met!" >> performance.md
98-
elif grep -q "FAILED" performance_test_output.log; then
130+
else
131+
echo "⚠️ **Result**: Some performance thresholds exceeded or tests failed" >> performance.md
99132
echo "" >> performance.md
100-
echo "⚠️ **Result**: Some performance thresholds exceeded or test failed" >> performance.md
133+
echo "Please review the failed tests above. Common causes:" >> performance.md
134+
echo "- Network latency to VFB services" >> performance.md
135+
echo "- SOLR/Neo4j/Owlery server load" >> performance.md
136+
echo "- First-time cache population (expected to be slower)" >> performance.md
101137
fi
102138
else
103-
echo "❌ **Test Status**: Performance test failed to run properly" >> performance.md
139+
echo "❌ **Test Status**: Performance tests failed to run properly" >> performance.md
140+
echo "" >> performance.md
141+
echo "Please check the test output above for errors." >> performance.md
104142
fi
105143
144+
echo "" >> performance.md
145+
echo "---" >> performance.md
146+
echo "" >> performance.md
147+
echo "## Historical Performance" >> performance.md
148+
echo "" >> performance.md
149+
echo "Track performance trends across commits:" >> performance.md
150+
echo "- [GitHub Actions History](https://github.com/${{ github.repository }}/actions/workflows/performance-test.yml)" >> performance.md
106151
echo "" >> performance.md
107152
echo "---" >> performance.md
108153
echo "*Last updated: $(date -u '+%Y-%m-%d %H:%M:%S UTC')*" >> performance.md

0 commit comments

Comments
 (0)