Skip to contents

Commit a generated report, moving it from the draft/ directory to archive/ and updating the orderly index. Once committed, reports should not be deleted.

Usage

orderly_commit(id, name = NULL, root = NULL, locate = TRUE, timeout = 10)

Arguments

id

The identifier of the report

name

The name of the report - this can be omitted and the name will be determined from the id.

root

The path to an orderly root directory, or NULL (the default) to search for one from the current working directory if locate is TRUE.

locate

Logical, indicating if the configuration should be searched for. If TRUE and config is not given, then orderly looks in the working directory and up through its parents until it finds an orderly_config.yml file.

timeout

Time in seconds to wait for db to be available. In parallel the database may become locked so we can choose to wait for timeout seconds before throwing an error.

Value

The path to the newly committed report

Examples

# In a new example orderly, run a report
path <- orderly::orderly_example("minimal")
id <- orderly::orderly_run("example", root = path)
#> [ name       ]  example
#> [ id         ]  20230621-105025-ff775118
#> [ start      ]  2023-06-21 10:50:26
#> [ data       ]  source => dat: 20 x 2
#> 
#> > png("mygraph.png")
#> 
#> > par(mar = c(15, 4, 0.5, 0.5))
#> 
#> > barplot(setNames(dat$number, dat$name), las = 2)
#> 
#> > dev.off()
#> agg_png 
#>       2 
#> [ end        ]  2023-06-21 10:50:26
#> [ elapsed    ]  Ran report in 0.01639485 secs
#> [ artefact   ]  mygraph.png: 175369b2bcf4115f343c8ad746c0c072

# To commit it, all we need is the report id
orderly::orderly_commit(id, root = path)
#> [ commit     ]  example/20230621-105025-ff775118
#> [ copy       ]
#> [ import     ]  example:20230621-105025-ff775118
#> [ success    ]  :)
#> [1] "/tmp/RtmpGRuIRx/file4750018077/archive/example/20230621-105025-ff775118"

# The report is now committed, and as such could be used as a
# dependency in another report and is not subject to deletion by
# orderly::orderly_cleanup
orderly::orderly_list_archive(root = path)
#>      name                       id
#> 1 example 20230621-105025-ff775118