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

Add option to not run simulations when converting snapshots #1488

Merged
merged 17 commits into from
Sep 23, 2024

Conversation

Felixmil
Copy link
Contributor

To test this:

devtools::load_all()

convertSnapshot(getTestDataFilePath("test_snapshot.json"),
                format = "project",
                runSimulations = FALSE)

file.rename("test_snapshot.pksim5",
            "test_snapshot_nosim.pksim5")


convertSnapshot(getTestDataFilePath("test_snapshot.json"),
                format = "project",
                runSimulations = TRUE)

file.rename("test_snapshot.pksim5",
            "test_snapshot_sim.pksim5")

@Felixmil Felixmil changed the title Convert snapshot dont run simulations Add option to not run simulations when converting snapshots Sep 13, 2024
@Felixmil
Copy link
Contributor Author

Felixmil commented Sep 13, 2024

!!! To merge only once this PR is merged into PKSim

@rwmcintosh
Copy link
Member

!!! To merge only once this PR is merged into PKSim

You should run the update dll script to get the CI build versions before merging.

rengelke
rengelke previously approved these changes Sep 23, 2024
Copy link
Member

@rengelke rengelke 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. Added a small comment FYI

invisible(rSharp::callStatic("PKSim.R.Api", "RunSnapshot", SnapshotRunOptions))
},
error = function(e) {
message <- stringr::str_extract(as.character(e), "(?<=Message: )[^\\n]*")
Copy link
Member

Choose a reason for hiding this comment

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

Some error messages won't have a message line of format "Message: *". In this case str_extract() returns in NA resulting in

Error in `convertSnapshot()`:
! NA
✖ An error occured while converting files

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch, I added an if case to handle this.

rengelke
rengelke previously approved these changes Sep 23, 2024
@Felixmil Felixmil merged commit cbdde28 into main Sep 23, 2024
8 checks passed
@Felixmil Felixmil deleted the convert-snapshot-dont-run-simulations branch September 23, 2024 10:42
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.

3 participants