Repository navigation
Serving: a champion can prewarm its market data before registration; crypto-1h warms first - #97
Merged
Merged
Conversation
…crypto-1h warms first A ChampionMiner fetches its minute history and the event calendar at each start, and refuses an asset's prompts until that asset is in. On a fresh volume that happens after registration, so the first prompts fail. ChampionMiner.prewarm() runs the same warm-up once, then one calendar refresh, with no wallet and no chain. The generated miner.py and entrypoint.sh take --prewarm for it. A miner started afterwards on that volume fetches only the partitions not yet settled and serves the stored calendar, so it answers almost at once. servable_assets() now lists the shortest horizon's assets first, so on every start the crypto-1h assets, prompted most often, are served first. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.
Tip: disable this comment in your organization's Code Review settings.
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.
Why
A
ChampionMinerfetches its minute history and the event calendar at each start, in a background thread, and refuses an asset's prompts (<ASSET> is still warming up) until that asset is in. With no stored calendar, every asset waits up toCALENDAR_WAIT_SECONDS(10 minutes). On a fresh volume this happens right after registration, so the first prompts are misses, and the validator scores each miss at the prompt's 95th percentile.servable_assets()also listed the 24h competitions first, so the crypto-1h assets, prompted most often, were the last to come online.What
ChampionMiner.prewarm(), a classmethod: onewarm_upof every servable asset with the champion'scontext_days, then one calendar refresh, intoMARKET_DATA_DIR. It needs no wallet and no chain, so it runs before the hotkey is registered. A miner started afterwards on the same volume fetches only the partitions not yet settled, and serves the stored calendar at once while it is underCALENDAR_MAX_AGE_SECONDS(24 h) old.refresh_calendar(root), shared byprewarm()and the miner's daily refresh.miner.pyandentrypoint.shtake--prewarm:champions/<name>/entrypoint.sh --prewarmfillsmarket_data/and exits.servable_assets()orders the competitions bytime_length, so on every start the crypto-1h assets warm up and serve first.Tests
prewarm()warms every servable asset with the class'scontext_days, then refreshes the calendar, without runningMiner.__init__;servable_assets();miner.py --prewarmwith a fakeuvonPATH, and without the flag still starts the miner;miner.pyprewarms with no wallet.uv run pytest -q tests/serving: 66 passed, 1 skipped (as before). black 26.5.1 and flake8 clean.Follow-up
synth-subnet's Terraform miner (synthdataco/synth-subnet#351) runs the same pre-warm through a small script against the synth-lib that autoquant pins today. Once autoquant pins a synth-lib with this change, it can call
entrypoint.sh --prewarminstead.🤖 Generated with Claude Code