Skip to content

Commit 569f1d3

Browse files
authored
Merge 3a4c51c into 14f7477
2 parents 14f7477 + 3a4c51c commit 569f1d3

File tree

4 files changed

+33
-1
lines changed

4 files changed

+33
-1
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: orderly
22
Title: Lightweight Reproducible Reporting
3-
Version: 1.5.1
3+
Version: 1.5.2
44
Description: Order, create and store reports from R. By defining a
55
lightweight interface around the inputs and outputs of an
66
analysis, a lot of the repetitive work for reproducible research

NEWS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# orderly 1.5.2
2+
3+
* Fix issue writing failure data from a failed orderly bundle.
4+
15
# orderly 1.5.0
26

37
* Add `prepare_git_example_from_source` which can be used to generate a git controlled orderly directory

R/orderly_version.R

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,7 @@ orderly_version <- R6::R6Class(
537537
private[[v]] <- info[[v]]
538538
}
539539

540+
currentwd <- getwd()
540541
withCallingHandlers({
541542
## Refetch the preflight info here: we want to keep git but
542543
## replace everything else I think. We might save the random
@@ -548,6 +549,7 @@ orderly_version <- R6::R6Class(
548549
self$run_execute(echo)
549550
self$run_cleanup()
550551
}, error = function(e) {
552+
setwd(currentwd)
551553
self$run_failed_cleanup(e)
552554
})
553555
},

tests/testthat/test-bundle.R

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,32 @@ test_that("failed bundle run writes out failed rds", {
321321
'stop\\("some error"\\)')
322322
})
323323

324+
test_that("Failure output written if a bundle fails", {
325+
path <- test_prepare_orderly_example("demo")
326+
on.exit(unlink(path, recursive = TRUE))
327+
328+
# Make parameter less than zero cause a crash
329+
330+
test_script <- file.path(path, "src", "other", "script.R")
331+
script <- readLines(test_script)
332+
script <- c("if (nmin < 0) stop('Invalid parameter')", script)
333+
writeLines(script, test_script)
334+
335+
# Run a failing bundle
336+
337+
path_bundles <- file.path(path, "bundles")
338+
bundle <- orderly::orderly_bundle_pack(path_bundles, "other",
339+
parameters = list(nmin = -1),
340+
root = path)
341+
342+
343+
bundle_path <- file.path(path, "bundles", basename(bundle$path))
344+
345+
expect_error(orderly::orderly_bundle_run(bundle_path, "output"))
346+
347+
expect_true(file.exists(file.path(getwd(), "output", bundle$id, "pack",
348+
"orderly_fail.rds")))
349+
})
324350

325351
test_that("zip list helper safely lists", {
326352
skip_on_cran()

0 commit comments

Comments
 (0)