tdfs4ds.serve.time_drivers¶
tdfs4ds.serve.time_drivers
¶
Report section "Time drivers": which TimeManager drives each process, and how synchronised processes are (0.3.1.240).
Three layers, like store_consistency: :func:collect_time_drivers is the only
I/O, :func:time_driver_model is pure, :func:render_time_drivers returns HTML.
Per process: the declared TimeManager (FS_TIME_MANAGER), the one its view reads
(lineage, deep), a status, the manager's current business date and the last business
date the process completed.
================= ======================================================================
status meaning
================= ======================================================================
OK declared and read: run(pid) computes at the manager's date
UNDECLARED read, not declared: run(pid) stamps the real time
MISMATCH declares one manager, reads another
DECLARED_UNUSED declared, not read: values carry a date they were not computed at
NONE no TimeManager (real time or FEATURE_STORE_TIME)
UNKNOWN the lineage graph does not know the process view
================= ======================================================================
Synchronisation groups: processes on the same manager view share one cursor (synchronised); managers reading the same hidden table are soft clones (same dates, own cursors); managers whose tables hold the same dates are hard clones (copies); the rest are independent.
STATUS_LABELS
module-attribute
¶
STATUS_LABELS = {'OK': 'declared and read', 'UNDECLARED': 'read but not declared', 'MISMATCH': 'declares another manager than it reads', 'DECLARED_UNUSED': 'declared but not read', 'NONE': 'no TimeManager', 'UNKNOWN': 'not in the lineage graph'}
FIXES
module-attribute
¶
FIXES = {'UNDECLARED': "tdfs4ds.link_time_managers(process_ids=['{pid}'], dry_run=False)", 'MISMATCH': "tdfs4ds.link_time_managers(process_ids=['{pid}'], dry_run=False)", 'DECLARED_UNUSED': 'make the view read {declared}, or run it without a TimeManager', 'UNKNOWN': "tdfs4ds.rebuild_lineage_graph(objects=['{view}'], check=True)"}
GROUP_LABELS
module-attribute
¶
GROUP_LABELS = {'synchronised': 'Synchronised - one manager, one cursor', 'soft_clones': 'Same timeline, own cursors (soft clones)', 'hard_clones': 'Copies of a timeline (hard clones)', 'independent': 'Independent'}
_own_manager
¶
The manager that drives a process, among the managers reads of its deep lineage.
reads also holds the managers of its upstream processes (their clones, through the datasets it reads), so the first by name could be another process's clone (seen live: one clone named as the driver of four processes). The declared one when it is read; else the nearest in the lineage, by name when tied. Pure.
time_driver_model
¶
time_driver_model(processes, graph=None, registry=None, manager_dates=None, content_keys=None, last_business=None, domain_clocks=None, manager_calendars=None) -> Dict[str, Any]
Pure model. manager_dates: {view_node: 'YYYY-MM-DD'}; content_keys:
{view_node: hash}; last_business: {pid: date}; domain_clocks:
{data_domain: {database, view, table_database, table}} (0.3.6.0);
manager_calendars: {view_node: ['YYYY-MM-DD', ...]}, the dates of the manager's
table, in TIME_ID order (0.3.7.12; a row's calendar is its driver's).
calendar_day
¶
'YYYY-MM-DD' of a business date as the driver returns it (date, datetime or text). Pure.
collect_time_drivers
¶
collect_time_drivers(processes, followup=None, max_managers: int = 50, graph=None, as_of=None) -> Dict[str, Any]
Read what the model needs (lineage graph, registry, manager dates, contents).
graph: an already loaded lineage graph (else it is read, at as_of when given). Manager dates are always the cursors' current dates.
render_time_drivers
¶
HTML body (uses the consistency section's CSS classes).