Speed up AINode CI by consolidating tests and caching PyInstaller output#17687
Conversation
- Merge 5 AINode IT test classes (DeviceManage, ModelManage, CallInference, Forecast, InstanceManagement) into AINodeSharedClusterIT that shares a single 1C1D1A cluster, reducing cluster startups from 8 to 3 (~20min saved) - Convert AINodeClusterConfigIT from @Before/@after to @BeforeClass/@afterclass, merging both dialect tests into one method to eliminate a redundant cluster restart - Add hash-based dist caching to build_binary.py: computes SHA256 of AINode source files and skips PyInstaller rebuild when source hasn't changed (~11min saved) - Cache stored at ~/.cache/iotdb-ainode-build/dist-cache/, survives mvn clean
e092645 to
db54a6e
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #17687 +/- ##
=========================================
Coverage 40.42% 40.43%
Complexity 2574 2574
=========================================
Files 5179 5179
Lines 349261 349262 +1
Branches 44683 44683
=========================================
+ Hits 141206 141232 +26
+ Misses 208055 208030 -25 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
28d4a8b to
9fa6319
Compare
The compute_source_hash() function was including files from the build/ directory (generated by PyInstaller during the same run), causing the hash computed at check time (before build/) to differ from the hash at save time (after build/ exists). This made the cache always miss. Fix: exclude build/, dist/, and __pycache__/ from the hash computation. These are all build artifacts that don't affect the PyInstaller input.
9fa6319 to
24f9f8c
Compare
JackieTien97
left a comment
There was a problem hiding this comment.
Code Review
Verdict: LGTM
The test logic is faithfully preserved — this is a reorganization, not a behavioral change. The caching implementation is sound.
Observations
Test Consolidation (AINodeSharedClusterIT.java)
- All test methods from the original 5 classes are present and structurally identical.
@BeforeClasscorrectly calls bothprepareDataInTree()andprepareDataInTable()to satisfy all tests.AINodeConcurrentForecastITcorrectly left separate (different data setup, LOAD/UNLOAD side effects).AINodeClusterConfigITcorrectly left separate (it doesREMOVE AINODEwhich would break the shared cluster).
AINodeClusterConfigIT refactoring
- Conversion from
@Before/@Afterto@BeforeClass/@AfterClasseliminates one redundant cluster restart. - The merged test now verifies both dialects in a single method with proper sequencing. Cleaner than the original.
PyInstaller caching (build_binary.py)
compute_source_hashcorrectly excludesbuild/,dist/,__pycache__; includes all relevant sources +poetry.lock.shutil.copytree(..., symlinks=True)is the right call for PyInstaller output with symlinked shared libs.- Hashes both relative path and file content — prevents collisions from file renames.
One Suggestion (non-blocking)
Consider adding Python version to the cache hash to avoid stale cache if the interpreter gets upgraded on CI:
hasher.update(sys.version.encode())Since poetry.lock is already hashed, PyInstaller version changes are covered. But Python interpreter version is not reflected in any of the hashed files.
|



Description
Speed up the Cluster IT - 1C1D1A CI pipeline (~52min → ~15-20min) via two optimizations:
1. Test consolidation (saves ~20min)
Merge 5 AINode IT test classes into a single
AINodeSharedClusterITthat shares one 1C1D1A cluster:AINodeDeviceManageITAINodeModelManageITAINodeCallInferenceITAINodeForecastITAINodeInstanceManagementITThis reduces cluster startups from 8 to 3 (SharedCluster + ClusterConfig + ConcurrentForecast).
Also converts
AINodeClusterConfigITfrom@Before/@Afterto@BeforeClass/@AfterClass, eliminating one redundant cluster restart by merging both dialect tests into a single method.The 1C1D1A cluster startup takes ~3.5min each time (ConfigNode + DataNode + AINode), so eliminating 5 restarts saves ~17.5min. The actual test execution time is only ~9min out of the original 52min total.
2. PyInstaller dist caching (saves ~11min)
Added hash-based caching to
build_binary.py:pyproject.toml,poetry.lock, andainode.specdist/output at~/.cache/iotdb-ainode-build/dist-cache/(outside project dir, survivesmvn clean)dist/directly and skips the entire PyInstaller analysis + packaging phaseThe PyInstaller phase scans thousands of hidden imports from torch/transformers/numpy and takes ~11min. When AINode source hasn't changed, this is entirely redundant.
Testing
All existing test logic is preserved — the tests are reorganized, not changed.
AINodeConcurrentForecastITremains separate (different data setup and LOAD/UNLOAD side effects).