Open the chapter list
- Chapter 1. Start Here
- Chapter 2. Set Up Your Workspace
- Chapter 3. Prepare Accelerometer Files
- Chapter 4. Record Observations
- Chapter 5. Build Your First Model
- Chapter 6. Predict with a Model
- Chapter 7. Understand Your Results
- Chapter 8. Optimise for Deployment
- Chapter 9. Scripted Reruns
- Chapter 10. Troubleshooting
Scripted Reruns and Saved Specs
Source:vignettes/scripted-reruns-and-saved-specs.Rmd
scripted-reruns-and-saved-specs.RmdThis is Chapter 9 of 10 in the beginner path.
Up to this point, we have focused on the beginner path. Now we move one step toward reproducibility and automation.
The key idea in this chapter is simple: a spec is just a
saved set of instructions for a moover run.
Why saved specs are useful
When people run a workflow interactively, they often remember the broad choices but forget the exact settings. A saved spec solves that problem. It records the file locations and settings in a form that can be reused.
That means a spec is useful for at least three reasons:
- you can rerun the same workflow later
- you can share the run instructions with a colleague
- you can move from interactive work to scripted work without changing the underlying pipeline
Create a spec in code
Here is a simple example of a spec for a training workflow.
library(moover)
spec <- create_spec(
workspace = list(root = "my_moover_workspace"),
labels = list(
tech_file = "tech.csv",
path = "observations.csv"
),
features = list(
selection = "standard",
standard_set = "manual5"
),
optimise = list(enabled = FALSE)
)Once you have the spec, you can rerun the same workflow directly.
run_pipeline(spec, stage = "all")Use a saved JSON spec
moover also writes specs to JSON so that runs can be
reproduced later without stepping through the wizard again.
# Re-run a workflow from a previously saved JSON spec.
run_pipeline("runs/20260330_012345/spec/run_spec.json", stage = "all")You do not need to hand-edit JSON to benefit from this. Most beginners can think of the JSON file as a saved record of the choices they already made.