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

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         ]  20211125-140115-5af9bae7
#> [ start      ]  2021-11-25 14:01:15
#> [ 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        ]  2021-11-25 14:01:15
#> [ elapsed    ]  Ran report in 0.01530766 secs
#> [ artefact   ]  mygraph.png: 175369b2bcf4115f343c8ad746c0c072

# To commit it, all we need is the report id
orderly::orderly_commit(id, root = path)
#> [ commit     ]  example/20211125-140115-5af9bae7
#> [ copy       ]
#> [ import     ]  example:20211125-140115-5af9bae7
#> [ success    ]  :)
#> [1] "/tmp/RtmpP7mCov/file4628ab8991/archive/example/20211125-140115-5af9bae7"

# 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 20211125-140115-5af9bae7