orderly_bundle_pack {orderly} | R Documentation |
Pack and run orderly "bundles"
Description
Pack up and run orderly reports to run elsewhere. By using these functions you can safely copy all requirements of an orderly report into a portable archive and run them on another machine (perhaps a cluster or HPC), then import the completed archive into your orderly tree. There is considerable overhead to using these functions (mostly due to transport costs) so they are intended primarily for very computationally demanding patterns.
Usage
orderly_bundle_pack(
path,
name,
parameters = NULL,
envir = NULL,
root = NULL,
locate = TRUE,
message = NULL,
instance = NULL,
remote = NULL,
tags = NULL
)
orderly_bundle_run(path, workdir = tempfile(), echo = TRUE, envir = NULL)
orderly_bundle_import(path, root = NULL, locate = TRUE)
orderly_bundle_list(path)
Arguments
path |
A path, whose interpretation depends on the function:
|
name |
Name of the report to pack (see
|
parameters |
Parameters passed to the report. A named list of
parameters declared in the |
envir |
The parent of the environment that will be used to evaluate the report script; by default a new environment will be made with the global environment as the parent. |
root |
The path to an orderly root directory, or |
locate |
Logical, indicating if the configuration should be
searched for. If |
message |
An optional character string containing a message explaining why the report was run |
instance |
Select instance of the source database to be used,
where multiple instances are configured. Use a single
unnamed character string to indicate an instance to
match. If given, then this name must be present in all
databases where instances are listed in
|
remote |
Remote to use to resolve dependencies. Use this in
order to run a report with the same dependencies as are
available on a remote server, particularly when using |
tags |
Character vector of tags to add to the report. Tags
are immutable and cannot be removed once the report is run.
Tags added here will be in addition to any tags listed in
the |
workdir |
The path in which to run bundles. If it does not
exist it will be created for you. The completed bundle will be
saved in this directory as |
echo |
Print the result of running the R code to the console |
Value
For orderly_bundle_pack
and
orderly_bundle_run
, a list with elements path
(the
path to the bundle) and id
(its orderly id). For
orderly_bundle_list
a data.frame with key information
about the report in the bundles (id, name, parameters, status,
time). The function orderly_bundle_import
is called for
its side effect only and does not return anything useful.
Examples
path <- orderly::orderly_example("minimal")
# A working directory to export bundles to:
workdir <- tempfile()
# Pack up the "example" report to go:
res <- orderly::orderly_bundle_pack(workdir, "example", root = path)
# The return value is a list with the id and the path to the zip
# file created:
res
# A list of reports bundled in this directory and their status
orderly::orderly_bundle_list(workdir)
# Run the bundle (this would ordinarily be done on another computer)
zip <- orderly::orderly_bundle_run(res$path, workdir)
zip
# The status has now been updated to reflect the status
orderly::orderly_bundle_list(workdir)
# We can import this into the orderly tree
orderly::orderly_bundle_import(zip$path, root = path)
# This has now been included in your orderly archive and the
# workdir can be safely deleted
unlink(workdir, recursive = TRUE)
orderly::orderly_list_archive(path)