Make notebook data downloads resilient - #38
Open
spxiwh wants to merge 1 commit into
Open
Conversation
The "tutorial tests" CI job regularly fails while a notebook is fetching
GW strain data. Two causes:
* bare astropy download_file / !wget calls with no retry;
* the data came from the Git-LFS media.githubusercontent.com mirror of
gwastro/pycbc_data, which is subject to the LFS bandwidth quota and
then serves truncated bodies / 404s.
Route every gwastro/pycbc_data download through pycbc.io.get_file, passing
the original GWOSC / DCC URL. get_file retries with bounded back-off and,
inside GitHub Actions, transparently falls back to the pycbc_data release
asset and then the LFS media copy (see the companion pycbc change that
teaches _candidate_urls about dcc.ligo.org / losc.ligo.org URLs). The
result is copied to its real basename with shutil.copy, because the .gwf
filename matters to later cells / read_frame.
Notebooks touched: tutorial/{1_CatalogData, inference_0_Overview,
inference_1_ModelsAndPEByHand, inference_8_BHRingdown,
inference_4_bbh_example/IntroToPyCBCInference} and
examples/{gw150914_audio, gw151226_snr, gw170104_look,
gw170817_mass_estimate}.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
1 task
Contributor
Author
|
It will be difficult for the tests to pass here. The latest PyCBC release doesn't contain gwastro/pycbc#5352 or the new patch, and so passing the original URLs hit up against all the issues of trying to download from GWOSC we saw in PyCBC. We would want a new PyCBC release post gwastro/pycbc#5441, which should then improve this. |
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.
This patch goes along with gwastro/pycbc#5441 in PyCBC, though the order in which they are merged shouldn't matter (but we need to both to, hopefully, improve PyCBC test reliability).
In this patch we move most of the notebook downloads to PyCBC's get_file functionality. That function knows to redirect downloads when in the CI, which basically moves responsibility for reliability to PyCBC and not here. There are still a few raw
wget/curlcalls here to locations other than GWOSC / DCC, which aren't touched. If these continue to cause failures we can reconsider that.These files will also be added to the caching being added in 5441 so in most cases CI runs should pick up cached local files and not call GWOSC (or the github redirect).
NOTE: Frame file naming matters if using FrameLib (I think it doesn't if using the C++ alternative) and this leads to some "interesting" bugs (e.g. if you have spaces in your path, good luck!). Because of this we need to
shutil.copyto the proper name because the astropy cache names can be picked up as meaningful, which will break the code.