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

Downloader prototype and CLI rework #7

Merged
merged 3 commits into from
Aug 12, 2024
Merged

Downloader prototype and CLI rework #7

merged 3 commits into from
Aug 12, 2024

Conversation

mtauraso
Copy link
Collaborator

@mtauraso mtauraso commented Aug 9, 2024

This is (like a lot of this project now) super preliminary. Comments encouraged, but may be addressed on followup for the sake of building out the scaffolding of this project quickly 🙂

Reworking the CLI to have a single entrypoint. The intent here is to centralize config parsing in the hopes that we can keep discipline about reproducibility via the config file mechanism, and keep the CLI small. There is a potential trade-off in CLI ergonomics which we're going to keep an eye on as development continues.

Downloader: This is a basic downloader that can process the z_0_025.fits catalog and download snapshots. It is currently hard-coded to only attempt the first 10 sources. It uses the downloadCutouts utility which has been imported from HSC's repository.

@mtauraso mtauraso self-assigned this Aug 9, 2024
Copy link

github-actions bot commented Aug 9, 2024

Before [2d5c9a5] After [9285957] Ratio Benchmark (Parameter)
2.91±0.8s 2.58±1s ~0.89 benchmarks.time_computation
448 3.9k 8.70 benchmarks.mem_list

Click here to view all benchmarks.

Copy link

codecov bot commented Aug 9, 2024

Codecov Report

Attention: Patch coverage is 2.17391% with 45 lines in your changes missing coverage. Please review.

Project coverage is 9.83%. Comparing base (2d5c9a5) to head (d7f8d6e).

Files Patch % Lines
src/fibad/download.py 0.00% 43 Missing ⚠️
src/fibad/predict.py 0.00% 1 Missing ⚠️
src/fibad/train.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #7       +/-   ##
==========================================
- Coverage   33.33%   9.83%   -23.50%     
==========================================
  Files           5       6        +1     
  Lines          18      61       +43     
==========================================
  Hits            6       6               
- Misses         12      55       +43     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -1,3 +1,3 @@
from .example_module import greetings, meaning

__all__ = ["greetings", "meaning"]
__all__ = ["greetings", "meaning", "download"]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting, does this just grab the module named download? I don't think I've seen this syntax before.

Main entrypoint for downloading cutouts from HSC for use with fibad
"""

config = config["download"]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can be pretty confident that "download" will be a key in the config at this point, but I think it would be good practice to try to be as defensive as possible with something like config.get('download', {}).

If we adopt something that enforces more of the config structure like Pydantic or just using dataclasses that might let us be a bit less explicit.

src/fibad/download.py Outdated Show resolved Hide resolved
src/fibad/download.py Outdated Show resolved Hide resolved
parser.add_argument("--version", dest="version", action="store_true", help="Show version")
parser.add_argument("-c", "--runtime-config", type=str, help="Full path to runtime config file")

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed, just want to confirm that both of the following will work on the command line still:

fibad download --runtime-config=<foo>
and
fibad --runtime-config=<foo> download

Copy link
Collaborator

@drewoldag drewoldag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks pretty good to me. I left a few comments on here, but no blockers for sure. After the comments are addressed, feel free to merge.

Dutifully downloads HSC cutouts for 10 sources from a fits file
using HSC's downloadCutout utility

Modified CLI to use a single entrypoint with the idea to centralize
argument and config parsing independent of what verb is used.
@mtauraso mtauraso merged commit 0cd1e6c into main Aug 12, 2024
7 checks passed
@mtauraso mtauraso deleted the downloader-prototype branch August 12, 2024 18:07
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.

2 participants