Skip to content

Commit a1f80f4

Browse files
committed
Merge branch 'master' into pr/1138
2 parents 640961e + 6b7f04a commit a1f80f4

5 files changed

Lines changed: 41 additions & 3 deletions

File tree

LICENSE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
YEAR: 2019
22
COPYRIGHT HOLDER: Stan Developers and their Assignees
3+
ORGANIZATION: Stan Development Team (stan-dev)

R/model.R

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2034,12 +2034,16 @@ generate_quantities <- function(fitted_params,
20342034
sig_figs = NULL,
20352035
parallel_chains = getOption("mc.cores", 1),
20362036
threads_per_chain = NULL,
2037-
opencl_ids = NULL) {
2037+
opencl_ids = NULL,
2038+
show_messages = TRUE,
2039+
show_exceptions = TRUE) {
20382040
fitted_params_files <- process_fitted_params(fitted_params)
20392041
procs <- CmdStanGQProcs$new(
20402042
num_procs = length(fitted_params_files),
20412043
parallel_procs = checkmate::assert_integerish(parallel_chains, lower = 1, null.ok = TRUE),
2042-
threads_per_proc = assert_valid_threads(threads_per_chain, self$cpp_options(), multiple_chains = TRUE)
2044+
threads_per_proc = assert_valid_threads(threads_per_chain, self$cpp_options(), multiple_chains = TRUE),
2045+
show_stderr_messages = show_exceptions,
2046+
show_stdout_messages = show_messages
20432047
)
20442048
model_variables <- NULL
20452049
if (is_variables_method_supported(self)) {

man/model-method-generate-quantities.Rd

Lines changed: 16 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/testthat/test-model-generate_quantities.R

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,3 +92,14 @@ test_that("generate_quantities() warns if threads specified but not enabled", {
9292
"'threads_per_chain' will have no effect"
9393
)
9494
})
95+
96+
test_that("no output with show_messages = FALSE", {
97+
output <- utils::capture.output(
98+
fit_gq <- mod_gq$generate_quantities(
99+
fitted_params = fit,
100+
data = data_list,
101+
show_messages = FALSE
102+
)
103+
)
104+
expect_equal(length(output), 0)
105+
})

tests/testthat/test-model-pathfinder.R

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,3 +150,10 @@ test_that("no error when checking estimates after failure", {
150150
expect_silent(fit$summary()) # no error
151151
})
152152

153+
test_that("no output with show_messages = FALSE", {
154+
output <- utils::capture.output(
155+
fit <- mod$pathfinder(data = data_list, show_messages = FALSE, seed = 123)
156+
)
157+
expect_equal(length(output), 0)
158+
})
159+

0 commit comments

Comments
 (0)