Lifecycles¶
Four kinds of object have a life in a feature store: a feature, a process, a dataset and a data domain. For each, this page gives the states, the call that moves it from one to the next, what that call records, and the guard that stops a move that would break something. Recipes with full code are in Maintain a workflow; this page is the map that tells you which recipe applies.
All four lifecycles share three rules:
- Removals are refused when something depends on the object.
remove_process,remove_featureandremove_datasetraisetdfs4ds.DependentObjectsError(.dependents,.unverified,.plan) unlessforce=True. An unreadable lineage also refuses: the guard never treats "could not read" as "nothing depends". - Every removal and refusal is a row of
tdfs4ds.get_removal_log()(REFUSED,COMPLETED,FAILED). - Stored values are kept unless the removal plan is made with
purge_values=True. A removed process leaves its history in theFS_T_*tables.
What registration records¶
| Where | Written when | Content |
|---|---|---|
Process catalog (FS_PROCESS_CATALOG) |
upload_features |
the process id, view, entity, features, options; the FilterManager / TimeManager pairing |
Feature catalog (FS_FEATURE_CATALOG) and FS_T_* storage tables |
the first run |
one entry per feature (data domain, entity, name), its type and table |
Follow-up (FS_FOLLOW_UP) |
each run, per segment | RUNNING, then COMPLETED, COMPLETED,0 rows or FAILED,..., with the business date |
Stored SQL versions (FS_PROCESS_SQL) |
registration, run, an approved optimization |
the SQL chain under the view; a new version when it changes |
Lineage (FS_LINEAGE_GRAPH) |
registration, dataset build | the edges of the view |
| Documentation | document=True, rebuild_documentation, by hand |
business dictionary rows, provenance, documentation log |
Removal log (FS_REMOVAL_LOG) |
any removal | what was removed or refused, by whom, the dependents |
Feature¶
A feature is the triplet (data domain, entity, name). It has one catalog entry, whatever the number of processes
computing it; each process writes under its own FEATURE_VERSION.
declared in a process view
| upload_features(run_now=False) process registered, feature NOT in the catalog yet
v
registered ---- first run() ----------------> stored (catalog entry + FS_T_* table + values)
| |
type must grow / table move | | no process computes it any more
v v
changed (plan_type_change, orphan (feature_without_process)
plan_relocation) |
| remove_feature / plan_removal
v
retired (values stay unless purged)
| Move | Call | Records | Guard |
|---|---|---|---|
| Declare | a column of the process view named in feature_names |
nothing until a run | upload_features(run_now=False) EXPLAINs the source and registers nothing if it fails |
| Register and first value | run(pid) (done by upload_features unless run_now=False) |
catalog entry, FS_T_* table, values |
types checked against the stored type: a value that no longer fits is refused with the CAST to add or plan_type_change |
| Change type | plan_type_change(process_id), then relocate_features(plan, dry_run=False) |
new table with the new type, history copied and verified, catalog and datasets updated, old rows deleted last | blocking value_conversion when stored values do not convert |
| Move to its own table | upload_features(storage_tag=), or plan_relocation(...) and relocate_features |
as above | shared (another producer) blocks unless include_shared=True; verify_relocation(plan) |
| Retire from one process | remove_feature(name, entity_id=[...], data_domain=, process_id=pid) |
the catalog entry stays while another process computes it; only this process's documentation goes | DependentObjectsError if datasets read it |
| Retire completely | plan_removal([(name, entity, domain)]), write_removal_script(plan) |
catalog entry, documentation, index entries; values only with purge_values=True |
the script is a dry run until --apply, then verifies nothing is left |
A re-registration keeps the recorded primary index and partitioning; to change them, relocate. Look for features whose
process is gone with the feature_without_process finding of the sanity check, and
for orphaned stored values with the storage scan of Inspect & monitor.
Process¶
A process is a registered view plus its options (managers, close_absent_entities, valid_time_column, dataset
behaviour). Its id is a UUID; the view name finds it.
declared ----- run() / roll_out() ------> in use <---- scheduled run()/refresh_domain() ---+
(run_now=False) | ^ |
| | re-register (SQL change): new SQL version |
| +----------------------------------------------+
| promote lab -> production: plan_migration / migrate_objects
v
removed (remove_process, plan_removal) -> history stays in FS_T_*
| Move | Call | Records | Guard |
|---|---|---|---|
| Declare | upload_features(..., run_now=False, return_process_id=True) |
process catalog row, view, lineage; no feature, no table | EXPLAIN of the source first; recoverable errors return None after a log line |
| Register and run | upload_features(...) (run_now=True) |
the above, then features, tables, follow-up rows, optional documentation | registering a view again keeps its recorded primary index and partitioning; replace=False (default) replaces only a registered process view |
| Run | run(pid), roll_out(...), refresh_domain(...) |
a follow-up row per segment and date | on_failure=, check_upstream=True (refuses when an upstream failed at this date) |
| Change | edit the view, or upload_features again; set_process_options(pid, ...) for options |
a new SQL version (FS_PROCESS_SQL); lineage refreshed |
plan the effect with tdfs4ds.impact_of; replay with roll_out(..., time_id_start=1, force_compute=True); sql_drift flags a view changed without a run |
| Interrupted | close_interrupted_runs(dry_run=True) |
closes RUNNING rows as FAILED,interrupted |
one update per row, only while still RUNNING |
| Migrate | plan_migration(seeds, source=), migrate_objects(plan, approvals) |
a fresh process id in the target, re-registered, data recomputed, lineage and documentation re-homed | approvals per conflict; a replace that drops a feature a downstream needs is blocking |
| Remove | plan_removal([pid]), write_removal_script(plan); or remove_process(pid) |
catalog rows, documentation, stored SQL versions, manager rows, index entries, the view's lineage (when the view is gone); drop_view=True drops the view |
DependentObjectsError when a dataset reads its values or another process reads its view |
plan = tdfs4ds.plan_removal(['<process id>'])
for s in plan['steps']:
print(s['action'], s['object'], '<-', s['reason'])
path = tdfs4ds.write_removal_script(plan) # dry run until --apply; checks afterwards, exit code 2 if something is left
print(tdfs4ds.get_removal_log().tail())
A process used from outside the framework (a loop around run, values closed by hand) cannot be refreshed
faithfully: the usage and closed_entities checks give each process a verdict, refreshable, at risk or
not refreshable. Run tdfs4ds.sanity_check() before a migration and before a removal.
Dataset¶
A dataset is a view that joins the stored values of features, registered in the dataset catalog (catalog, entity, feature, build, window and offset tables).
built (build_dataset / build_historical_dataset / upload_features(dataset_view_name=))
| |
| reads current, as of, a manager, | a feature or process it reads is removed or moved
| or a history window v
v defective (dataset_reads_* findings)
in use <--- rebuild_dataset(replace=True) / rewrite_dataset_tables / restore_dataset_catalog ---+
|
| remove_dataset(dry_run=False)
v
removed (catalog rows, documentation, index entries; the view is kept unless drop_view=True)
| Move | Call | Records | Guard |
|---|---|---|---|
| Build | build_dataset(entity_id, selected_features, view_name) |
the view, catalog rows, lineage (record_lineage=True) |
a feature produced by several processes needs a version; FeatureSelectionError lists every problem |
| Build in time | as_of=, time_manager=, build_historical_dataset(start=, end=) |
a TIME_MODE row in the build table, a window row for histories |
modes are mutually exclusive |
| Rebuild | rebuild_dataset(view, grouped=, as_of=, time_manager=, replace=True) |
the view regenerated from its own DDL, same DATASET_ID |
an existing target is refused without replace=True |
| Repair | rewrite_dataset_tables(dataset, dry_run=True), restore_dataset_catalog(dry_run=True) |
table references or catalog rows corrected | dry run first |
| Remove | remove_dataset(name) returns what would go (dry_run=True is the default); remove_dataset(name, dry_run=False) removes |
catalog rows, lineage edges, documentation, provenance, index entries | refused while process views read it; attached views are named in the error |
| Migrate | with the processes it reads, plan_migration / migrate_objects |
rebuilt in the target with build_dataset (its feature ids are store-local) |
the plan lists it as an object |
Removing a process or feature that a dataset reads is refused; plan_removal lists the dataset first, in the order
things must go.
Data domain¶
A data domain is not an object of its own. It is the DATA_DOMAIN value carried by process and feature catalog rows,
plus optional settings (its clock, CALENDAR_GAPS) in FS_DATA_DOMAIN_SETTINGS.
named (tdfs4ds.DATA_DOMAIN = 'SALES') --upload_features--> exists (get_data_domains() lists it)
| |
| set_domain_time_manager(clock) | clock: refresh_domain / roll_out(data_domain=)
v v
clocked ------------------------------------------------> in use
| plan_removal(domain_processes(...)) + leftovers
| detach_domain_time_manager
v
gone (no catalog row carries the name)
| Move | Call | Records | Guard |
|---|---|---|---|
| Create | set tdfs4ds.DATA_DOMAIN, register a process |
the name on the process and feature rows | none: a typo creates a domain; get_data_domains() shows it |
| Give it a clock | set_domain_time_manager(clock, data_domain=) |
the TIME_MANAGER setting |
the clock must own its table of dates |
| Run it | refresh_domain, roll_out(data_domain=), run(data_domain=) |
follow-up rows for every process | Manage the clock |
| Migrate | plan_migration(..., target_data_domain=) |
processes, datasets, clock and rule moved | see Prototype to production |
| Remove | no single call, on purpose: plan_removal(domain_processes(dom), purge_values=True, drop_views=True), the leftover features, then detach_domain_time_manager(dom) |
the same guarded steps as above | the plan includes datasets of other projects that read the domain's features: decide first. Full recipe: Remove a data domain |
The admin app's Remove objects page writes the same script for a whole domain; the app itself removes nothing.
Before any move¶
| Before you... | Run |
|---|---|
| change a process, a view or a dataset | tdfs4ds.impact_of(...) (Study the impact of a change) |
| remove anything | plan_removal, then read the dry run |
| change a type, index or partitioning | plan_type_change / plan_relocation, relocate_features(plan, dry_run=True) |
| promote to production | plan_migration(...) and the sanity checks it runs on the source |
| rebuild a history | tdfs4ds.sanity_check(processes=[...]) afterwards (Check a history after a replay) |