Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: single function call to preload Astropy cache #1374

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

aarchiba
Copy link
Contributor

@aarchiba aarchiba commented Aug 11, 2022

This is intended to resolve #1372 by providing a single function call that preloads the Astropy cache. Documentation on how to forbid PINT/Astropy from connecting to the Internet should also be included.

New functions:

pint.utils.preload_cache - download everything you're likely to need
pint.utils.no_internet - context manager to run stuff without letting PINT/Astropy access the internet
pint.utils.set_no_internet - function to set Astropy config to turn off internet access for the duration of the current session

@codecov
Copy link

codecov bot commented Aug 11, 2022

Codecov Report

Base: 62.26% // Head: 62.18% // Decreases project coverage by -0.07% ⚠️

Coverage data is based on head (c757529) compared to base (31c3865).
Patch coverage: 52.00% of modified lines in pull request are covered.

❗ Current head c757529 differs from pull request most recent head 82f6691. Consider uploading reports for the commit 82f6691 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1374      +/-   ##
==========================================
- Coverage   62.26%   62.18%   -0.08%     
==========================================
  Files          89       89              
  Lines       20260    20239      -21     
  Branches     3652     3657       +5     
==========================================
- Hits        12614    12585      -29     
- Misses       6856     6868      +12     
+ Partials      790      786       -4     
Impacted Files Coverage Δ
src/pint/utils.py 56.78% <52.00%> (-0.29%) ⬇️
src/pint/logging.py 51.35% <0.00%> (-5.62%) ⬇️
src/pint/scripts/pintempo.py 58.57% <0.00%> (-4.29%) ⬇️
src/pint/polycos.py 76.87% <0.00%> (-1.25%) ⬇️
src/pint/scripts/pintbary.py 88.63% <0.00%> (-0.95%) ⬇️
src/pint/scripts/zima.py 75.92% <0.00%> (-0.44%) ⬇️
src/pint/scripts/photonphase.py 39.87% <0.00%> (-0.38%) ⬇️
src/pint/scripts/event_optimize.py 63.23% <0.00%> (-0.09%) ⬇️
src/pint/scripts/convert_parfile.py 0.00% <0.00%> (ø)
src/pint/scripts/compare_parfiles.py 0.00% <0.00%> (ø)
... and 4 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@aarchiba
Copy link
Contributor Author

@JPGlaser I think that adjusting your script to call pint.utils.preload_cache should reliably ensure that all files are loaded to the Astropy cache even starting from nothing. You could call pint.utils.set_no_internet() at the beginning of all scripts, but almost certainly you are better off creating an Astropy config file with the same options in it. (You'll need to set them back in the updater script.)

@aarchiba
Copy link
Contributor Author

This one is a bit of a headache because I'm trying to get the "don't access the Internet, be okay with old data" to work with everything from Astropy 4.0 to 5.1, and the code to deal with out-of-range data has changed several times over the course of that time. I might need to create some specialized tox tasks and test all the versions. We particularly need 4.3 to work because that's what NANOGrav used for 15yr and they want to keep using it; 5.1 works fine and quite gracefully, but so far 4.3, 5.0, and 5.1 need different solutions.

@JPGlaser
Copy link

@aarchiba We are okay with advancing to Astropy 5.1+ with the 15yr. This is because we have to advance our versions of other software for the wideband results. I think this feature would be a fantastic add as we get more folks in the IPTA using pint. ^_^

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.

[Feature Request] Single Command for Caching Remote Files for Runs on Machines with No Access to the Internet
2 participants