Fix: consensus detection OOMs the analytics container on a username join - #14
Open
mpont91 wants to merge 1 commit into
Open
Fix: consensus detection OOMs the analytics container on a username join#14mpont91 wants to merge 1 commit into
mpont91 wants to merge 1 commit into
Conversation
The per-market query joined trades to scores on username, which is empty for every scored wallet, producing a cartesian product of 15M rows for a single busy market. Joined on proxy_address instead.
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.
ConsensusDetector._get_smart_money_tradesjoins the trades of one market to the scored traders onusername:Practically no Polymarket wallet has a username set. On a live instance all 1,793 scored traders above the threshold have it empty, and so do almost all trades. The join therefore matches empty string to empty string and becomes a cartesian product.
Measured on the busiest market of the last 48 hours:
There is no LIMIT, and every row is materialised into a Python dict. The loop then repeats for ~100 markets.
Effect
The container is OOM-killed part way through consensus on every run. On the instance where I found this:
RestartCount 56, andgrep -c "AWARE Analytics - Complete"over the entire log returns 0 — no cycle has ever finished.Consensus is step 7 of 12, so everything after it has never run: ML enrichment, edge persistence, drift monitoring, notification dispatch, and the strategy P&L job. Any dashboard fed by those tables shows whatever was last written by a manual run.
Fix
Join on
proxy_address, which is always populated and is the key the rest of the scoring pipeline uses._aggregate_positionsis keyed on the address too — keyed on an empty username it collapsed every trader into a single bucket, so the trader count behind a signal was meaningless.After the fix the same pipeline completes in 70.6s.