Skip to content

Add better time tracking - #668

Merged
arrjon merged 15 commits into
developfrom
update_timing
Jul 28, 2026
Merged

Add better time tracking#668
arrjon merged 15 commits into
developfrom
update_timing

Conversation

@arrjon

@arrjon arrjon commented Jul 24, 2026

Copy link
Copy Markdown
Member

This pull request adds detailed execution time profiling to the ABC-SMC run, including both wall-clock and fine-grained sub-step timings. Additionally, per-generation walltimes are now stored in the database, and visualizations have been updated to reflect these more accurate timings.

I also cleaned up some minor code.

Resolves #325 and #667

@codecov-commenter

codecov-commenter commented Jul 24, 2026

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 94.44444% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.28%. Comparing base (1749237) to head (2ec22d1).

Files with missing lines Patch % Lines
pyabc/visualization/walltime.py 86.36% 2 Missing and 1 partial ⚠️
...s/versions/2_20260724_add_populations_wall_time.py 90.00% 1 Missing ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #668      +/-   ##
===========================================
+ Coverage    79.21%   79.28%   +0.07%     
===========================================
  Files          141      142       +1     
  Lines         8337     8386      +49     
  Branches      1111     1116       +5     
===========================================
+ Hits          6604     6649      +45     
- Misses        1362     1365       +3     
- Partials       371      372       +1     
Flag Coverage Δ
base 59.39% <64.51%> (+0.03%) ⬆️
external-R 36.98% <61.29%> (+0.13%) ⬆️
external-other-simulators 31.61% <61.29%> (+0.16%) ⬆️
migrate 25.44% <25.00%> (+0.01%) ⬆️
petab 35.64% <61.29%> (+0.14%) ⬆️
visualization 52.98% <93.54%> (+0.18%) ⬆️

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

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR improves time tracking in pyABC by (1) persisting per-generation walltime in the database to make walltime visualizations accurate across resumed runs, and (2) adding fine-grained per-generation execution-time profiling inside the ABC-SMC loop.

Changes:

  • Store per-population walltime (Population.wall_time) in the DB and use it in plot_walltime / plot_total_walltime to avoid counting idle resume gaps.
  • Add per-generation execution-time profiling in ABCSMC.run_generation (pipeline setup, simulation, in-between steps) and return these timings to callers.
  • Add a regression test for “resume gap” walltime plotting; bump package + DB versions and document in the changelog.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
test/visualization/test_base_viz.py Adds a regression test ensuring resume gaps don’t inflate plotted walltime when per-generation walltimes exist.
pyabc/visualization/walltime.py Uses per-generation wall_time when available for walltime plots; adds low-level support for passing walltimes.
pyabc/version.py Bumps package version to 0.12.19.
pyabc/storage/version.py Bumps DB version to 2.
pyabc/storage/history.py Extends population queries and storage updates to include wall_time; threads walltime through calibration/population storage.
pyabc/storage/db_model.py Adds wall_time column to the populations table model.
pyabc/inference/smc.py Adds _Timer and per-generation profiling; stores per-generation walltime in the DB; returns timing data from run_generation.
pyabc/distance/pnorm.py Type-hint refinements (Optional/None unions).
pyabc/distance/base.py Type-hint refinements; tightens FunctionDistance typing and allows None in to_distance input typing.
CHANGELOG.rst Documents new profiling, walltime plotting behavior, and DB format change for 0.12.19.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pyabc/storage/version.py
Comment thread pyabc/visualization/walltime.py
@arrjon
arrjon requested a review from kilianvolmer July 24, 2026 09:18

@kilianvolmer kilianvolmer 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.

Thank you for implementing all those changes so fast! I left a few minor comments here and there, nothing severe.

Comment thread pyabc/distance/base.py
Comment thread pyabc/inference/smc.py
Comment thread pyabc/inference/smc.py Outdated
Comment thread pyabc/inference/smc.py Outdated
Comment thread pyabc/storage/history.py
Comment thread test/visualization/test_base_viz.py
Comment thread CHANGELOG.rst Outdated
Comment thread CHANGELOG.rst Outdated
Comment thread CHANGELOG.rst
@arrjon
arrjon requested a review from kilianvolmer July 24, 2026 15:31
arrjon added 3 commits July 28, 2026 14:02
# Conflicts:
#	pyabc/distance/pnorm.py
#	pyabc/inference/smc.py
#	pyabc/visualization/walltime.py
@arrjon

arrjon commented Jul 28, 2026

Copy link
Copy Markdown
Member Author

Ready to merge now

@arrjon
arrjon merged commit e4a09cc into develop Jul 28, 2026
16 checks passed
@arrjon
arrjon deleted the update_timing branch July 28, 2026 13:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants