Feature/scripts and api optimizations#215
Draft
SimoneAriens wants to merge 2 commits intomainfrom
Draft
Conversation
Diff CoverageDiff: origin/main..HEAD, staged and unstaged changes
Summary
|
Minimum allowed line rate is |
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.
Changes to support running 600k+ comparisons efficiently:
Skip plots: added skip_plots flag to score endpoints and client. Matplotlib plot generation was 96% of per-call API time (~3s). Skipping it drops calls to ~0.1s.
Upfront existence check: replaced 600k individual exists() calls with a single os.walk scan to find already-completed results.
Two-level output folders: {i // 1000:04d}/{i:06d} structure to avoid 600k entries in a single directory.
Vault cleanup: _cleanup_vault in try/finally to prevent /tmp/scratch_api from growing unboundedly (was hitting 83GB+), even on partial download failures.
404 filtering: skip downloading plot URLs that don't exist when skip_plots=True.
Producer/consumer pattern in convert_marks.py: parallel API fetching with sequential disk writes.
Profiling instrumentation: timing logs in score endpoints and calculate_score.
Resilient error handling: all three scripts catch and log per-item failures instead of aborting the batch. calculate_score returns a ScoreStatus enum for structured summary reporting.
Connection reuse: requests.Session for connection pooling across downloads.
Lazy cross-product sampling: _different_source_pairs samples via cumulative indexing instead of materializing the full pool.