Skip to content

Attach model_creation and solve_complete timestamps to model data attrs #586

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 5 commits into from
Apr 30, 2024

Conversation

sjpfenninger
Copy link
Member

@sjpfenninger sjpfenninger commented Apr 15, 2024

Fixes #583

Summary of changes in this pull request:

  • Attach model_creation and solve_complete timestamps to model data attrs

Reviewer checklist:

  • Test(s) added to cover contribution
  • Documentation updated
  • Changelog updated
  • Coverage maintained or improved

Copy link

codecov bot commented Apr 15, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.92%. Comparing base (872978d) to head (ebbfa66).
Report is 8 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #586      +/-   ##
==========================================
+ Coverage   95.85%   95.92%   +0.06%     
==========================================
  Files          24       24              
  Lines        3619     3628       +9     
  Branches      788      723      -65     
==========================================
+ Hits         3469     3480      +11     
+ Misses         86       84       -2     
  Partials       64       64              
Files Coverage Δ
src/calliope/model.py 93.72% <100.00%> (+0.07%) ⬆️
src/calliope/postprocess/postprocess.py 98.24% <100.00%> (+4.69%) ⬆️
src/calliope/util/logging.py 94.44% <100.00%> (+0.56%) ⬆️

Copy link
Member

@brynpickering brynpickering left a comment

Choose a reason for hiding this comment

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

I have come across an issue in previous runs that this should solve. If there is any lag between calling model.build() and model.solve(), you get an artificially extended solve time. The logger should also capture when model.build() and model.run() were called. Then build/solve time is the difference between finish and start times.

@sjpfenninger
Copy link
Member Author

Since run is deprecated, we probably don't want to start logging it? Maybe we add the following timestamps to the results?

  • timestamp_build_started
  • timestamp_build_complete
  • timestamp_solve_started
  • timestamp_solve_complete

@brynpickering
Copy link
Member

Sorry, yeah, mistype on my part. Those logging timestamps sound good.

@sjpfenninger
Copy link
Member Author

Now have five timestamps (in order of occurrence):

  • timestamp_model_creation: at the start of Model.__init__()
  • timestamp_build_started: at the start of Model.build()
  • timestamp_build_complete: at the end of Model.build()
  • timestamp_solve_started: at the start of Model.solve()
  • timestamp_solve_complete: at the end of Model.solve()

@sjpfenninger sjpfenninger merged commit 9f79791 into main Apr 30, 2024
13 checks passed
@sjpfenninger sjpfenninger deleted the feature-timestamps-in-attrs branch April 30, 2024 10:49
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.

Store start and stop time stamps in model results
2 participants