tdfs4ds.time_manager_report¶
tdfs4ds.time_manager_report
¶
TimeManager inventory and report (0.3.7.22).
TimeManagers multiply as a project grows: a clock per data domain, a soft clone per process, copies made by hand, managers left behind by removed processes. This module answers, per data domain and per manager: what is there, what each manager is (role), which dates it holds, where its cursor is, who follows it (processes, datasets) and what is wrong with it, with the call that fixes each finding. It changes nothing.
Three layers, like serve/efs_map and workflow_assessment:
- :func:
collect_time_manager_inputs- the only I/O (fail-open: a failed read is recorded inerrorsand the matching facts read as unknown, never as "nothing"); - :func:
build_time_manager_model- pure; - :func:
render_time_manager_html/ :func:render_time_manager_markdown/ :func:time_manager_findings_csv- text.
It builds on the process-level model of the Report's "Time drivers" section
(serve.time_drivers.time_driver_model), which it does not redefine.
================= ===========================================================================
role meaning
================= ===========================================================================
clock the data domain's clock (set_domain_time_manager)
clone of clock a soft clone of a clock: the clock's dates, its own cursor
soft clone shares its table of dates with another manager that is not a clock
hard copy its own table holding the same dates as another manager's (a copy)
own calendar none of the above
================= ===========================================================================
ROLES
module-attribute
¶
ROLE_TEXT
module-attribute
¶
ROLE_TEXT = {'clock': "the data domain's clock", 'clone of clock': 'a soft clone of the clock: its dates, its own cursor', 'soft clone': 'shares its table of dates with another manager', 'hard copy': "a copy of another manager's dates, in its own table", 'own calendar': 'its own table of dates'}
KIND_TEXT
module-attribute
¶
KIND_TEXT = {'table_missing': 'Table of dates missing', 'view_missing': 'View missing', 'literal': 'Holds a literal date', 'unused': 'Followed by nothing', 'hard_copy': 'Copy of another calendar', 'clone_out_of_step': "Clone not at the clock's date", 'reader_status': 'Process does not read what it declares', 'off_clock': 'Processes not on the domain clock', 'shared_view': 'Clock read through a shared view', 'no_clock': 'Several managers, no domain clock', 'unverified': 'Not verified', 'registry_orphan': 'Registered, but its view and table are gone', 'rollout_refused': 'roll_out of the domain refuses', 'rollout_no_single_calendar': 'No single roll-out covers the domain', 'manager_shared_across_domains': 'Manager read by several data domains', 'domains_share_calendar': 'Domains on one calendar', 'calendar_rule_inferable': 'No rule stored, one can be', 'calendar_irregular': 'Dates follow no rule', 'calendar_off_rule_dates': 'Dates that do not fit the stored rule'}
ROLLOUT_TEXT
module-attribute
¶
ROLLOUT_TEXT = {'ok': 'covers every manager', 'refused': 'refuses: a manager on other dates', 'no_single_calendar': 'no single roll-out', 'real_time': 'no TimeManager (real time)', 'unverified': 'not verified (lineage)'}
CALENDAR_STATE_TEXT
module-attribute
¶
CALENDAR_STATE_TEXT = {'stored': 'rule stored', 'stored_off_rule': 'rule stored, dates off the rule', 'inferable': 'no rule stored, one can be', 'irregular': 'no rule, dates irregular', 'unknown': 'not verified'}
collect_time_manager_inputs
¶
collect_time_manager_inputs(data_domains: Optional[Iterable[str]] = None, max_managers: int = 200) -> Dict[str, Any]
Read everything the model needs. The only function of this module that touches the
database. data_domains: keep these domains (None = all).
_followup
¶
Follow-up rows of the processes (for the last business date each completed).
rollout_coverage
¶
Will roll_out(data_domain=...) / run(data_domain=...) move every TimeManager the
processes of each data domain read, and is a manager read across data domains? Pure (0.3.7.22).
rows: the process model's rows (process_id, view, domain, reads, status);
clocks: {domain: {'view', 'table'}} (node ids); tables: {manager view: table}.
Returns (coverage, findings): one coverage dict per data domain (moved: the managers a
roll-out of the domain moves, not_moved: those it cannot, verdict: ok /
refused / no_single_calendar / real_time / unverified) and findings in the
report's shape.
The rule is the one roll_out applies: with a clock it moves the clock and the soft clones of
it that the processes read, and refuses before step 1 a process reading a manager on another
table of dates; without a clock it needs the processes on one table of dates
(_attached_time_manager). A manager (view) read by processes of several domains moves for
all of them whichever domain is rolled out.
build_time_manager_model
¶
The inventory: {'kpis', 'domains', 'managers', 'findings', 'growth', 'errors', ...}. Pure.
time_manager_inventory
¶
The TimeManager inventory of the store (or of data_domains) as a dict: per data domain (clock, managers by role, processes with and without a manager), per manager (role, table of dates, first and last date, cursor, processes and datasets following it) and the findings, each with the call that fixes it. Reads only.
render_time_manager_html
¶
HTML body (the consistency section's CSS classes).
write_time_manager_report
¶
write_time_manager_report(path: Optional[str] = None, fmt: Optional[str] = None, *, data_domains: Optional[Iterable[str]] = None, model=None) -> str
Write the TimeManager report and return its path. fmt: 'html' (default),
'md' or 'csv' (the findings), else taken from path's extension. Reads only.