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

Support checkpoint and restore of Event and TargetedEvent. #179

Merged
merged 2 commits into from
Jan 16, 2024
Merged

Conversation

plietar
Copy link
Member

@plietar plietar commented Jan 11, 2024

No description provided.

@plietar plietar requested a review from giovannic January 11, 2024 15:43
Copy link
Member

@giovannic giovannic left a comment

Choose a reason for hiding this comment

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

V. nice

@@ -4,24 +4,36 @@ test_that("deterministic state model is resumable", {
health <- CategoricalVariable$new(c('S', 'I', 'R'), rep('S', population))
render <- Render$new(timesteps)

shift_generator <- function(from, to, rate) {
infection <- TargetedEvent$new(population)
Copy link
Member

Choose a reason for hiding this comment

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

[nit] It would be nicer to have this as a separate test "deterministic model with events is resumable". So that a failure would point to a more specific issue.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure. I've changed it to leave the original test unchanged.

@@ -15,23 +15,6 @@ test_that("first event is triggered at t=1", {
event$.tick()
})

test_that("first event is triggered at t=1", {
Copy link
Member

Choose a reason for hiding this comment

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

Do we not need this anymore?

Copy link
Member Author

Choose a reason for hiding this comment

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

Sorry should have left a note. I'd just noticed it was identical to the test right above. Probably a spurious copy/paste

expect_targeted_listener(listener, 2, t = 5, target = c(5, 7))
})

test_that("targeted events are cleared on restored", {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
test_that("targeted events are cleared on restored", {
test_that("targeted events are cleared when restored", {

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

Copy link

codecov bot commented Jan 15, 2024

Codecov Report

Attention: 4 lines in your changes are missing coverage. Please review.

Comparison is base (c9cdee3) 96.28% compared to head (e0d2c4f) 96.25%.
Report is 3 commits behind head on dev.

Files Patch % Lines
src/event.cpp 92.50% 3 Missing ⚠️
R/simulation.R 95.83% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              dev     #179      +/-   ##
==========================================
- Coverage   96.28%   96.25%   -0.03%     
==========================================
  Files          36       36              
  Lines        1722     1816      +94     
==========================================
+ Hits         1658     1748      +90     
- Misses         64       68       +4     

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

@plietar plietar merged commit 0ad4ec6 into dev Jan 16, 2024
7 checks passed
@plietar plietar deleted the checkpoint2 branch January 16, 2024 12:08
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