Fall back to a bundled obscodes file when the MPC download fails#337
Open
matthewholman wants to merge 1 commit into
Open
Fall back to a bundled obscodes file when the MPC download fails#337matthewholman wants to merge 1 commit into
matthewholman wants to merge 1 commit into
Conversation
LayupObservatory downloads the MPC observatory-codes file (obscodes_extended.json.gz) from minorplanetcenter.net on first use. When that server is unreachable the whole run fails -- this took down a CI leg where every obscode-dependent test errored with requests ConnectTimeout. Observatory codes change rarely, so ship a copy in layup/data/ObsCodes.json.gz and, when the live download raises a requests exception, decompress the bundled copy and hand it to sorcha's Observatory via its oc_file argument (which bypasses the download). A slightly stale fallback is far better than a hard failure on a transient network outage. - write_fallback_obscodes(): decompress the bundled file to a JSON path. - LayupObservatory.__init__: try the normal download, fall back on requests.exceptions.RequestException. - Tests: the bundled file decompresses to valid JSON, and a simulated MPC outage falls back to it instead of raising. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This was referenced Jun 20, 2026
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.
Summary
LayupObservatorydownloads the MPC observatory-codes file (obscodes_extended.json.gz) fromminorplanetcenter.neton first use. When that server is unreachable the whole run fails — this recently took down a CI leg where every obscode-dependent test errored withrequests.exceptions.ConnectTimeout(23 failures on one ubuntu runner).Observatory codes change rarely, so this ships a fallback copy in the package and uses it when the live download fails.
Changes
layup/data/ObsCodes.json.gz(77 KB, 2708 codes).write_fallback_obscodes(): decompress the bundled file to a plain JSON path.LayupObservatory.__init__: try the normal MPC download; on arequests.exceptions.RequestException, log a warning and re-initialize via sorcha'sObservatory(..., oc_file=...)argument, which reads the decompressed JSON directly and bypasses the download.A slightly stale fallback is far better than a hard failure on a transient outage.
Verification (fresh build)
test_write_fallback_obscodes— the bundled file decompresses to valid JSON (X05/500 present).test_layup_observatory_falls_back_on_mpc_failure— a simulatedConnectTimeoutfalls back to the bundled copy and populatesObservatoryXYZ.tests/layup/test_data_processing_utilities.py: 41 passed, no regressions.Notes
spawnfix in Fix Linux fork+JAX worker deadlock by using the 'spawn' start method (#256) #336 (network resilience vs. the fork/JAX deadlock); both touchdata_processing_utilities.pybut in non-overlapping regions, so they rebase cleanly in either order.🤖 Generated with Claude Code