This function allows inspection of some of orderly's metadata
during an orderly run. The format returned is internal to orderly
and subject to change. It is designed to be used within report
code. To use in conjunction with
orderly_test_start()
, you must pass in the path to the
report in question.
Arguments
- path
Path to the report currently being run. This should be left as
NULL
when running a report, and the path to the report being run should be used when usingorderly_test_start()
Examples
path <- orderly::orderly_example("demo")
# This example uses orderly_run_info within its script, saving the
# output to "output.rds"
readLines(file.path(path, "src", "use_dependency", "script.R"))
#> [1] "d <- read.csv(\"incoming.csv\", stringsAsFactors = FALSE)"
#> [2] ""
#> [3] "png(\"graph.png\")"
#> [4] "par(mar = c(15, 4, .5, .5))"
#> [5] "barplot(setNames(d$number, d$name), las = 2)"
#> [6] "dev.off()"
#> [7] ""
#> [8] "info <- orderly::orderly_run_info()"
#> [9] "saveRDS(info, \"info.rds\")"
# Run the dependency:
id <- orderly::orderly_run("other", list(nmin = 0), root = path)
#> [ name ] other
#> [ id ] 20230621-105038-32dff26e
#> [ sources ] functions.R
#> [ parameter ] nmin: 0
#> [ start ] 2023-06-21 10:50:38
#> [ data ] source => extract: 20 x 2
#> [ parameter ] nmin: 0
#>
#> > extract$number <- extract$number + rnorm(1)
#>
#> > write.csv(extract, "summary.csv", row.names = TRUE)
#>
#> > png("graph.png")
#>
#> > par(mar = c(15, 4, 0.5, 0.5))
#>
#> > do_plot(extract)
#>
#> > dev.off()
#> agg_png
#> 2
#> [ end ] 2023-06-21 10:50:38
#> [ elapsed ] Ran report in 0.017658 secs
#> [ artefact ] summary.csv: 3fac8347e152c84c96e6676413c718b7
#> [ ... ] graph.png: a70cdfd037035a0b34e71b921fc9de42
orderly::orderly_commit(id, root = path)
#> [ commit ] other/20230621-105038-32dff26e
#> [ copy ]
#> [ import ] other:20230621-105038-32dff26e
#> [ success ] :)
#> [1] "/tmp/RtmpGRuIRx/file472ff3654c/archive/other/20230621-105038-32dff26e"
# Then the report
id <- orderly::orderly_run("use_dependency", root = path)
#> [ name ] use_dependency
#> [ id ] 20230621-105038-74628ae7
#> [ depends ] other@20230621-105038-32dff26e:summary.csv -> incoming.csv
#> [ start ] 2023-06-21 10:50:38
#>
#> > d <- read.csv("incoming.csv", stringsAsFactors = FALSE)
#>
#> > png("graph.png")
#>
#> > par(mar = c(15, 4, 0.5, 0.5))
#>
#> > barplot(setNames(d$number, d$name), las = 2)
#>
#> > dev.off()
#> agg_png
#> 2
#>
#> > info <- orderly::orderly_run_info()
#>
#> > saveRDS(info, "info.rds")
#> [ end ] 2023-06-21 10:50:38
#> [ elapsed ] Ran report in 0.0127244 secs
#> [ artefact ] graph.png: a70cdfd037035a0b34e71b921fc9de42
#> [ ... ] info.rds: e22d40f422a519b0fe0aa630fdb2cb8c
# This is the contents:
readRDS(file.path(path, "draft", "use_dependency", id, "info.rds"))
#> $id
#> [1] "20230621-105038-74628ae7"
#>
#> $name
#> [1] "use_dependency"
#>
#> $root
#> [1] "/tmp/RtmpGRuIRx/file472ff3654c"
#>
#> $depends
#> id index name draft filename as is_pinned
#> 1 20230621-105038-32dff26e 1 other NA summary.csv incoming.csv FALSE
#> path
#> 1 /tmp/RtmpGRuIRx/file472ff3654c/archive/other/20230621-105038-32dff26e
#> is_latest hash time id_requested
#> 1 TRUE 3fac8347e152c84c96e6676413c718b7 2023-06-21 10:50:38 latest
#>