Skip to content

Refactor batch sample matching #954

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

Merged
merged 4 commits into from
Sep 3, 2024
Merged

Conversation

benjeffery
Copy link
Member

Refactor to work like ancestor matching.
Some feedback on the approach would be good here.

Copy link

codecov bot commented Aug 27, 2024

Codecov Report

Attention: Patch coverage is 91.50943% with 9 lines in your changes missing coverage. Please review.

Project coverage is 93.16%. Comparing base (1b88b5e) to head (abcab58).
Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
tsinfer/inference.py 91.50% 5 Missing and 4 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #954      +/-   ##
==========================================
- Coverage   93.23%   93.16%   -0.07%     
==========================================
  Files          18       18              
  Lines        6299     6337      +38     
  Branches     1139     1133       -6     
==========================================
+ Hits         5873     5904      +31     
- Misses        290      294       +4     
- Partials      136      139       +3     
Flag Coverage Δ
C 93.16% <91.50%> (-0.07%) ⬇️
python 95.53% <91.50%> (-0.12%) ⬇️

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.

Copy link
Member

@jeromekelleher jeromekelleher left a comment

Choose a reason for hiding this comment

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

Looks good. I think some classes to capture the parameters would be helpful here, as the "metadata" dictionaries are confusing and easy to make mistakes with.

You could even add some functionality to the class to abstract out some of the common boilerplate, like


class WorkDescriptor:

     def common_params(self) -> dict:
            return {"precision": self.precision, ... etc}

match_samples(..., **wd.common_params())

# Create work dir
work_dir.mkdir(parents=True, exist_ok=True)

metadata = {
Copy link
Member

Choose a reason for hiding this comment

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

I think it's worth making a dataclass to capture this now - it's getting a bit of out hand. "Metadata" is confusing as a name as I thought we were talking about "tskit metadata" initially. The thing we're talking about is a serialisable description of some work that's to be done... So,

@dataclasses.dataclass
class SampleBatchWorkDescriptor:
     sample_data_path: str
    ....

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed in 6924929

@benjeffery benjeffery marked this pull request as ready for review August 28, 2024 14:49
Copy link
Member

@jeromekelleher jeromekelleher left a comment

Choose a reason for hiding this comment

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

Looks good, happy to merge

@mergify mergify bot merged commit a080e8f into tskit-dev:main Sep 3, 2024
12 of 14 checks passed
@benjeffery benjeffery deleted the batch_samples branch September 3, 2024 12:04
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