Skip to content

ump_workflow.save

module ump-workflow

save_workflow: fit the analyst’s module on training data and write a bundle.

The author’s own run: the module is executed from code_path (it is the author’s code), fitted with the given seed and params, its state checked to be plain and to round-trip (STATE_NOT_PLAIN, WORKFLOW_STATE_LOSSY; nothing is written on a refusal), the questions answered on the training data, and those answers kept as the bundle’s Tier D summary. The code hash is added to this session’s trust set (as finprint does for code a session recorded), not persisted; OpenBundle.trust() persists it. The code file is read once: the same bytes are run, written and trusted, and the module is dropped from sys.modules when the save is over.

function

def training_stats(
data: pd.DataFrame,
prepped: pd.DataFrame,
contract: InputContract,
) -> dict[str, Any]

workflow.json’s training block: rows and time range of the raw input data, history_end (the last period, which a score must follow on from) and the min and max of every numeric contract variable on the prepped frame (channel_ranges, read by the out-of-support check).

Source: packages/ump-workflow/src/ump_workflow/save.py, line 33

function

def save_workflow(
path: str | Path,
*,
code_path: str | Path,
data: pd.DataFrame,
contract: InputContract | dict[str, Any],
questions: list[dict[str, Any]],
name: str,
version: str = '0.1.0',
author: str | None = None,
seed: int = 0,
params: dict[str, Any] | None = None,
recipe_path: str | Path | None = None,
inputs: dict[str, Any] | None = None,
tier: str = 'D',
dependence: str | dict[str, Any] | None = None,
include_data: bool = False,
transient_only: bool = False,
summary: dict[str, Any] | None = None,
) -> Path

Fit, check and write a workflow bundle at path; returns the bundle folder.

data is the raw input (what run will receive later); with recipe_path it is prepped with finprint.apply (inputs binds the recipe’s other inputs) before the fit. author is a principal id such as user:maya.chen, never an email. include_data adds data/training.csv unless an input is transient_only. summary overrides the generated Tier D summary.

Source: packages/ump-workflow/src/ump_workflow/save.py, line 47