Skip to contents

Fresh runs require an absent destination with an existing parent. Resume revalidates a READY bundle without invoking its writer. Failed/interrupted attempts require explicit caller reconciliation; no subprocess absence is inferred from an R error or owner PID. Stale locks require manual inspection. Orphan attempts with missing state always require a new run after external reconciliation; supplying retry arguments does not bypass this refusal. Receipts use atomic rename visibility, not a power-loss durability guarantee. Writers are trusted: observable input changes are detected, but transient restored changes and escaped subprocesses are not prevented.

Usage

reflow_artifact_run(spec, directory)

reflow_artifact_resume(
  spec,
  directory,
  reconciled_attempt = NULL,
  reconciliation = NULL
)

Arguments

spec

A reflow_artifact_spec().

directory

New run directory, or an existing directory for resume.

reconciled_attempt

Exact latest failed/interrupted attempt identifier.

reconciliation

Nonempty caller assertion explaining that all writer and subprocess activity has stopped. Required together with the identifier before a fresh retry. This is not automatic process verification.

Value

An authenticated descriptor with stable bundle path and file manifest.

Examples

spec <- reflow_artifact_spec(
  "base", "writeLines",
  args = list(text = c("alpha", "beta")),
  outputs = list(con = list(path = "lines.txt", type = "file")),
  inventory = c(lines = "lines.txt")
)
# Running fingerprints the installed packages involved, which reads
# many files and can take several seconds.
# \donttest{
run <- tempfile("artifact-", tmpdir = normalizePath(tempdir(), winslash = "/", mustWork = TRUE))
bundle <- reflow_artifact_run(spec, run)
readLines(file.path(bundle$bundle, "lines.txt"))
#> [1] "alpha" "beta" 
bundle$inventory
#>    name      path bytes
#> 1 lines lines.txt    11
#>                                                             sha256
#> 1 e49c81e2d2f84e259d40e2fb8192f3bcd198b355184845d76d8f58807d0d78ee

# Resume re-verifies the accepted bundle without calling the writer
identical(reflow_artifact_resume(spec, run), bundle)
#> [1] TRUE
unlink(run, recursive = TRUE)
# }