Skip to content

Make notebook data downloads resilient - #38

Open
spxiwh wants to merge 1 commit into
masterfrom
ci-download-resilience
Open

Make notebook data downloads resilient#38
spxiwh wants to merge 1 commit into
masterfrom
ci-download-resilience

Conversation

@spxiwh

@spxiwh spxiwh commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

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 / curl calls 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.copy to the proper name because the astropy cache names can be picked up as meaningful, which will break the code.

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>
@spxiwh

spxiwh commented Sep 4, 2026

Copy link
Copy Markdown
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant