perf: parallelize sequential awaits with asyncio in async_subtensor#3275
Open
altis0725 wants to merge 1 commit intoopentensor:stagingfrom
Open
perf: parallelize sequential awaits with asyncio in async_subtensor#3275altis0725 wants to merge 1 commit intoopentensor:stagingfrom
altis0725 wants to merge 1 commit intoopentensor:stagingfrom
Conversation
basfroman
requested changes
Feb 25, 2026
Apply asyncio.gather to three methods for concurrent RPC execution: - get_all_dynamic_info: run runtime_call and get_subnet_prices concurrently - blocks_since_last_update: run get_block_number and get_hyperparameter concurrently, pre-resolve block_hash for chain state consistency - blocks_until_next_epoch: dynamically gather block and tempo lookups Fixes opentensor#3129 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
4b35a56 to
209e0c3
Compare
Author
|
Hi @basfroman, thanks for the feedback. I've rebased the branch to a single clean commit. This PR implements the two items from #3129:
The previous version had too many incremental commits that obscured the intent — apologies for the noise. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3129
Summary
Apply
asyncio.gatherto three methods to run sequential RPC calls concurrently:get_all_dynamic_info:runtime_callandget_subnet_pricesin parallelblocks_since_last_update:get_block_numberandget_hyperparameterin parallel, with pre-resolvedblock_hashfor chain state consistencyblocks_until_next_epoch: dynamic gather forget_block_numberandtempowhen both need fetchingEach parallelized pair saves ~1 RPC round-trip (50-200ms depending on node latency).
Test plan
test_blocks_since_last_update_successandtest_blocks_since_last_update_no_last_updatefor new calling convention