global ephemeris data cache - #165
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #165 +/- ##
==========================================
+ Coverage 85.40% 87.19% +1.78%
==========================================
Files 50 58 +8
Lines 3186 3748 +562
==========================================
+ Hits 2721 3268 +547
- Misses 465 480 +15 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
7bc0a76 to
1a8cd28
Compare
samaloney
left a comment
There was a problem hiding this comment.
Yea this is very different from what I was thinking but that not a bad thing, any idea on performance? As the reason I added the cache in the first place was because this code is call a lot during plotting operations.
It would be nice to be disable the cache maybe add a module level variable. Needs some narrative documentation could be added to top of the rst file and also needs a corresponding change log.
In the future if we have different version of the anc-ephem files and I wanted to compare the results from V0X to V0Y is this in the table or does the user have to remember which one the loaded last so will be in the cache? It would probably be useful to know which file the data came from anyway for debugging purposes anyway
|
@nicHoch I force pushed, sorry, so don't forget to pull the changes back down to your local branch. |
|
pre-commit.ci autofix |
6258511 to
8d9287d
Compare
8d9287d to
ece4d02
Compare
samaloney
left a comment
There was a problem hiding this comment.
Hum the changlog entries seem repetitive/duplicates?
I'm not sure why the CI is failing seems unrelated to the changes in this PR?
How does this play with plotting on WCSAxes e.g. sunpy Maps as that was the original driver for the lrucache.
…search and download of the same data multiple times
for more information, see https://pre-commit.ci
Co-authored-by: Shane Maloney <maloneys@tcd.ie>
114f5c3 to
98fe04b
Compare
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Remote data servers occasionally truncate responses under concurrent load and parfive caches the partial file as if complete, causing intermittent OSError failures in the py313-online CI job (confirmed: the job passes with -n 1). Add stixpy.utils.io.is_valid_fits and use it to validate downloads at both boundaries -- science products (Product/cache.download, with redownload=True on failure) and ANC ephemeris (Fido.fetch, with one overwrite re-fetch). Restores -n auto in CI now that downloads self-heal. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Replace the per-path client-side validate+redownload guards with a single CI-level mechanism: tools/run_online_tests.py runs the suite parallel, and only if an online run fails does it clear the sunpy download caches and re-run the failed tests once serially (-n 1). This covers all download paths -- including sunpy's TimeSeries URL path (which stixpy can't intercept) and doctests -- since --last-failed selects by node id. Why the guards were removed: they only covered 2 of 3 download paths and pre-read every file. The helper stixpy.utils.io.is_valid_fits and its tests are kept, with comments marking the two sites to reintroduce a (cheaper, on-error) guard if end-user resilience is later wanted. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The first (full, parallel) pass writes coverage.xml for the whole suite even when a test fails. The retry reruns only the failed tests, so if it also regenerated coverage.xml the reported project coverage collapsed (codecov/project failed while codecov/patch passed). Strip all --cov*/-n options from the rerun so it only determines pass/fail and leaves pass 1's coverage report intact. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
@samaloney — heads-up on the one (latest) non-obvious part of this PR: the testing flow change. Why: the How: instead of guarding each download site, tests now run through a small wrapper (
Two things worth a look in review:
Server-side hardening (the truncation likely also has an Apache/network angle on the FHNW/our side) is noted as a separate follow-up, out of scope here. |
| -vvv \ | ||
| -r fEs \ | ||
| online: --remote-data=any \ | ||
| --pyargs stixpy \ |
There was a problem hiding this comment.
What about just disabling the parallel runs for the online tests?
| online: --remote-data=any \ | |
| online: -n 1 \ | |
| --pyargs stixpy \ |
There was a problem hiding this comment.
my goal was to support the "normal case" as fast as possible (as done so fare) and only do something in the "rare" cases where it breaks. so the local runs can stay the very same.
…apper Replace tools/run_online_tests.py with a simpler tox config: the online env runs '-n 1' so concurrent FITS downloads never trigger the data server's edge-truncation under load. The online CI job's posargs drop '-n auto' (it would override -n 1 since posargs come last). Update the is_valid_fits helper docstring and the two download- boundary comments to point at the tox '-n 1' approach instead of the removed wrapper.
add a internal ephemeris data cache. This allows to bypass hidden internal FIDO searches and downloads of the same data multiple times
All coordinate transform and imaging methods might internally search for correct ephemeris data for higher precession.
To get the ephemeris data a FIDO search (defaults to our stix data server) is uses and data gets downloaded.
The ephemeris data search utilises a global cache in order to avoid unnecessary network traffic or file loading. ANC ephemeris fits files are organised as daily files. The entire day is put to cache if touched once.
A user can prefetch or pinpoint specific ephemeris data files with the `load_ephemeris_fits_to_cache(filename)' method.