tdfs4ds.scheduling.changed¶
tdfs4ds.scheduling.changed
¶
Which (process, business date) pairs were computed with SQL that has changed since (0.3.8.15).
roll_out(..., force_compute='changed') and run(..., force_compute='changed') recompute only
those pairs; :func:changed_processes lists them without running anything.
What is seen. A process version is the SQL beneath the process view (the view and the views it
reads, managers set aside: process_sql). A run belongs to the version in force when it STARTED
(process_sql.version_in_periods, the rule of value_version). A business date is stale for a
process when its latest successful run at that date (COMPLETED or COMPLETED,0 rows, per
FilterManager segment) was made under another version than the current one. The current version is
the LIVE chain (read from the view definitions, nothing written), so a REPLACE VIEW made since the
last capture is seen.
From t onward. A run at date d rewrites every later period of the values it writes (the MERGE's
rule), so a process stale from d is recomputed at every completed date >= d, in date order.
Every process transitively downstream of it in the same data domain (lineage graph; reference
processes DOMAIN_ROLL_OUT = N left out, as run_order.with_downstream does) is stale from d
too, for the dates it has completed runs at.
What is not seen (use force_compute=True): corrected source data, a changed function, model
or table operator, changed manager contents (calendar, filter values), PROCESS_SQL_VERSIONING
off, processes reading their valid time from a column (valid_time_column), dates computed before
SQL versioning existed for the process. Those processes are reported not_decided and treated as
unchanged.
Layers: :func:stale_runs (pure), :func:collect_changed_inputs (only reads, fail-open per input),
:func:changed_plan / :func:changed_processes (both). Nothing here writes to the database.
COLUMNS
module-attribute
¶
to_utc
¶
A UTC pandas.Timestamp of x, or None (missing, unreadable, or an open end in year 9000+).
to_wall
¶
The wall-clock time of x (its own offset dropped), naive, or None. A naive valid time (a
FEATURE_STORE_TIME without offset) is stored in the session's time zone and read back with
that zone: it compares with this wall-clock time, not with UTC.
_periods
¶
Stored versions as version_in_periods periods; tuples (version, valid_from, valid_to,
chain_hash) or dicts with those names (PROCESS_VERSION/VALID_FROM/VALID_TO/CHAIN_HASH
or VALIDSTART/VALIDEND).
_run_parts
¶
(pid, validtime_date, start, status, applied_filter) from a tuple or a dict row.
stale_runs
¶
stale_runs(processes: dict, versions: dict, runs: Iterable, edges: Iterable, domains=None, *, current: Optional[dict] = None) -> dict
{process_id: record} of the processes to recompute (or that cannot be judged). Pure.
- processes:
{pid: {"view", "data_domain", "valid_time_column": bool, "versioning": bool, "reference": bool, "error": str | None}}(reference=DOMAIN_ROLL_OUT = N;error= an input that could not be read for this process). - versions:
{pid: [(version, valid_from, valid_to, chain_hash), ...]}(FS_PROCESS_SQL). - current:
{pid: {"version", "hash", "error"}}the live chain (versionNone andhashset = a change not captured yet); an int is read as the version. - runs: follow-up rows
(pid, validtime_date, start_datetime, status, applied_filter). - edges: process-level
(upstream, dependent)pairs. - domains: when given, only processes of these data domains are reported.
A record: {"process_id", "view", "data_domain", "reason" (sql_changed | upstream_changed |
never_run | not_decided), "detail", "first_date", "dates" (sorted UTC timestamps, every completed
date >= first_date), "realtime" (None, or {"detail"} when real-time runs were made under an older
version: they are not replayable per date, the next real-time run recomputes them)}. Unchanged
processes are not in the result.
forced_records
¶
The records whose dates are recomputed (sql_changed / upstream_changed with a first date).
_after_first
¶
(valid_time >= first stale date, valid_time > first stale date) of a record, or None when
valid_time cannot be read. A valid time without offset compares with the stored dates' wall-clock
time (followup_open writes such a literal in the session's zone and it is read back with that
zone); one with an offset compares in UTC.
is_forced
¶
True when (process_id, valid_time) must be recomputed: valid_time is at or after the
process's first stale date (from t onward). A date that cannot be read is forced (safe side).
starts_before
¶
True when the process is stale from a date strictly before valid_time (a roll-out starting at valid_time would leave earlier stale dates).
log_lines
¶
[(level, text)] announcing what force_compute='changed' does (pure).
collect_changed_inputs
¶
The inputs of :func:stale_runs for processes (ids), or the processes of data_domain (a name,
a list, True = tdfs4ds.DATA_DOMAIN), or every process of the primary store; plus their
upstream processes of the same data domain (an upstream change makes them stale).
Reads: the process catalog (or proc_df), the lineage graph (or graph), the settings
(valid_time_column, DOMAIN_ROLL_OUT) in one statement, the stored SQL versions in one
statement, the live chain of each process (SHOW VIEW of its views, the read capture makes,
without its write), the follow-up rows in one statement. Fail-open per input: a failed read makes
the processes it concerns not_decided with the error, never changed or unchanged silently.
Returns {"requested", "processes", "versions", "current", "runs", "edges", "lineage_ok",
"errors"}.
changed_plan
¶
:func:collect_changed_inputs then :func:stale_runs, restricted to the requested processes.
Without a readable lineage graph, a process that is not sql_changed itself cannot be said
unchanged (an upstream change is not seen): it is not_decided. Returns {"stale", "edges",
"errors", "lineage_ok"}.
changed_processes
¶
The processes whose stored values were computed with SQL that changed since (read-only).
Lists what roll_out(..., force_compute='changed') / run(..., force_compute='changed') would
recompute, and why: one row per process with PROCESS_ID, VIEW_NAME, DATA_DOMAIN, REASON, DETAIL,
FIRST_DATE, N_DATES. REASON is sql_changed (the SQL beneath the process view differs from
the SQL its runs used: DETAIL 'v2 -> v3'), upstream_changed (an upstream process of the same
data domain changed: recomputed from that upstream's first stale date), never_run or
not_decided (cannot be judged, treated as unchanged). Unchanged processes are not listed.
data_domain: a name, a list, or True (tdfs4ds.DATA_DOMAIN); processes: process ids;
neither = every process of the primary store.
Only a change of the SQL chain (the process view and the views beneath it) is seen. Corrected source
data, a changed function or model, changed manager contents (calendar, filter values),
PROCESS_SQL_VERSIONING off, processes reading their valid time from a column and dates computed
before SQL versioning are not: recompute those with force_compute=True.