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

Fix reading manifest file when it's only one line and also served by GitHub #1323

Merged
merged 2 commits into from
Dec 10, 2024

Conversation

ivirshup
Copy link
Collaborator

@ivirshup ivirshup commented Dec 7, 2024

For some reason changing the size of our manifest file has broken our code to read it. It has something to do with how the file is encoded. I believe it is related to fsspec/filesystem_spec#389.

The issue only comes up due to some handling of partial reads. So I switched to doing a full read since the file is never that large.

We use fsspec instead of requests since sometimes we read a local file or one from s3.

@ivirshup ivirshup requested a review from ebezzi December 7, 2024 02:07
@ivirshup
Copy link
Collaborator Author

ivirshup commented Dec 7, 2024

Cleaner version:

blocklist = (
    # Figure out protocol to open file
    fsspec.filesystem(
        fsspec.utils.infer_storage_options(dataset_id_blocklist_uri)["protocol"]
    )
    # Read whole file as bytes
    .cat_file(dataset_id_blocklist_uri)
    # Decode to string and split into lines
    .decode("utf-8").strip().split("\n")
)

Copy link

codecov bot commented Dec 7, 2024

Codecov Report

Attention: Patch coverage is 92.30769% with 1 line in your changes missing coverage. Please review.

Project coverage is 91.36%. Comparing base (f32c274) to head (908423c).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...ls/cellxgene_census_builder/tests/test_manifest.py 83.33% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1323   +/-   ##
=======================================
  Coverage   91.36%   91.36%           
=======================================
  Files          82       82           
  Lines        6482     6482           
=======================================
  Hits         5922     5922           
  Misses        560      560           
Flag Coverage Δ
unittests 91.36% <92.30%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@ivirshup
Copy link
Collaborator Author

I did not touch the code that mypy is complaining about so I am okay with skipping it for this PR

@ivirshup ivirshup merged commit ec0e754 into main Dec 10, 2024
12 of 13 checks passed
@ivirshup ivirshup deleted the ivirshup/fix-blocklist-download branch December 10, 2024 21:38
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