Skip to content

Closes #22. Added a test that the memory usage doesn't balloon.#23

Merged
rhliang merged 4 commits into
mainfrom
MemoryOptimization
May 6, 2026
Merged

Closes #22. Added a test that the memory usage doesn't balloon.#23
rhliang merged 4 commits into
mainfrom
MemoryOptimization

Conversation

@rhliang

@rhliang rhliang commented Apr 28, 2026

Copy link
Copy Markdown
Contributor

Also added some other supporting code, like a CI workflow to run the test on a schedule, and also the one-off script that I used to help measure resource consumption of the code.

Also added some other supporting code, like a CI workflow to run
the test on a schedule, and also the one-off script that I used to
help measure resource consumption of the code.
@rhliang rhliang self-assigned this Apr 28, 2026
@rhliang rhliang requested a review from va7eex April 28, 2026 23:34
@codecov

codecov Bot commented Apr 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (d4366d9) to head (776d5b0).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff            @@
##              main       #23   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            5         5           
  Lines          808       803    -5     
  Branches       117       116    -1     
=========================================
- Hits           808       803    -5     

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

@rhliang rhliang added this to the v1.1 milestone Apr 28, 2026

@va7eex va7eex left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I have some suggestions that are completely optional, otherwise I approve.

Comment thread src/scripts/measure_resources.py Outdated
Comment thread src/scripts/measure_resources.py Outdated
args = parser.parse_args()

resource_summaries: list[ResourceSummary] = []
sample_regex = re.compile(r"^.*/(.*)\.BA\.txt$")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I'd probably add this regex to the other regexes defined above.

Comment thread src/scripts/measure_resources.py Outdated
Comment on lines +39 to +40
parser.add_argument("input_dir", help="Directory to scan for HLA sequences")
parser.add_argument("--output_csv", help="CSV file summary", default="out.csv")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I would recommend these be both of type Path

https://docs.python.org/3/library/argparse.html#type

You could be a bit more explicit and type the directory as "a directory", see this example: https://stackoverflow.com/a/51212150

Comment thread src/scripts/measure_resources.py Outdated
Comment on lines +45 to +51
for exon1_filename in glob.glob(f"{args.input_dir}/*.BA.txt"):
sample_name: str = sample_regex.match(exon1_filename).group(1)
exon2_filename: str = os.path.join(args.input_dir, f"{sample_name}.BB.txt")
with open(exon1_filename) as f:
exon1: str = f.read().strip()
with open(exon2_filename) as f:
exon2: str = f.read().strip()

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Typing with Path, this could become

    for exon1_filepath in args.input_dr.glob("*.BA.txt"):
        sample_name: str = sample_regex.match(exon1_filepath.name).group(1)
        exon2_filepath: Path= exon1_filepath.with_name(exon1_filepath.name.replace("BA.txt", "BB.txt"))
        exon1 = exon1_filepath.read_text().strip()
        exon2 = exon2_filepath.read_text().strip()

    ...
    json_filepath = args.input_dir / f"{sample_name}.json"
    json_filepath.write_text(json.dumps(json_input))

    ...
    result = subprocess.run(
        [
            ...,
            json_filepath.as_posix(),
        ]

Comment thread src/scripts/measure_resources.py
rhliang and others added 2 commits May 5, 2026 15:49
Using David's suggestion from review.

Co-authored-by: David Rickett <25559687+va7eex@users.noreply.github.com>
@rhliang rhliang merged commit 3be2bcb into main May 6, 2026
5 checks passed
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