Skip to contents

validate_workflow() runs quick checks before an expensive batch run or pipeline step: that module is a dsprrr module, how many inputs its signature has, that data has a column for every input, and that board is a pins board. It prints one line per check and makes no model calls.

Usage

validate_workflow(module, data = NULL, board = NULL)

Arguments

module

The module to check.

data

Optional data frame to check against the signature's inputs.

board

Optional pins board. Only its class is checked; the board is not accessed.

Value

Invisibly, a list with valid (FALSE when the module, data or board check fails) and checks (one list per check with passed and message).

Examples

classifier <- module(signature("text -> sentiment"))
reviews <- data.frame(text = c("Great!", "Awful."))
validate_workflow(classifier, data = reviews)
#> 
#> ── Workflow Validation ──
#> 
#> ✔ module: Module type: PredictModule
#> ✔ signature: 1 input(s) defined
#> ✔ data: 2 rows, 1 required columns present
#> ✔ Workflow validation passed

# A missing input column fails the check
result <- validate_workflow(classifier, data = data.frame(review = "Great!"))
#> 
#> ── Workflow Validation ──
#> 
#> ✔ module: Module type: PredictModule
#> ✔ signature: 1 input(s) defined
#> ✖ data: Missing columns: text
#> ✖ Workflow validation failed
result$valid
#> [1] FALSE