tdfs4ds.deploy.apply¶
tdfs4ds.deploy.apply
¶
apply_deployment: carry out a deployment plan on the target store (0.3.8.15). No interaction.
- The target is read again. An object whose definition on the target is neither the one the plan
saw nor the one the bundle deploys means someone changed the target since the plan: refused
(
TargetChangedError,deploy.pyexit code 2). An object already holding the bundle's definition is skipped, so running apply again after a failure resumes where it stopped and a second apply of a deployed plan does nothing. - Actions run in the plan's order (tables, upstream views, managers, processes, domain clocks and settings, datasets, downstream views, glossary, documentation). The first failure stops the run: the action, the whole database error and the actions not done are reported.
- Lineage of what was written, storage statistics of the registered processes, optionally the
vector index. Then
apply.json,apply.md,managers_to_initialise.jsonandrun_order.jsonare written.
Processes are registered, never run (run_now=False): computing is compute_deployment or the
environment's own orchestrator.
TargetChangedError
¶
Bases: DeploymentError
The target changed since the plan was made: plan again (deploy.py apply exits with 2).
changed: the keys of the objects whose definition on the target is neither the one the plan
saw nor the one the bundle deploys.
UnresolvedConflictsError
¶
Bases: DeploymentError
The plan holds a fail decision: resolve it in conflict_policy.yaml and plan again.
DeploymentResult
¶
Bases: dict
The outcome of an apply: status (ok | failed | nothing_to_do | dry_run),
done / already / skipped / not_done lists, failed (the failing action and its
whole error), process_ids (target view -> PROCESS_ID), managers_to_initialise,
run_order, post (lineage, statistics, index), files.
logger_safe
¶
Wrapper around the global logger that only emits logs when
tdfs4ds.DISPLAY_LOGS is True. level is a string like "info", "error", etc.
load_definitions
¶
(definitions in deployment order, {key: relative file}, manifest) of a bundle.
load_environment
¶
An environment as a dict: a path to a YAML file or a dict. ${NAME} is expanded from the
process environment (environ). Keys: name, connection, variables, domain_map,
options.
dump_json
¶
Deterministic JSON (sorted keys, 2-space indent, LF, trailing newline).
write_text
¶
Write text UTF-8 with LF line ends; parents created. Returns the path.
target_changes
¶
target_changes(plan_actions: List[Dict[str, Any]], current: Dict[str, Dict[str, Any]], defs_by_key: Dict[str, Dict[str, Any]]) -> List[str]
Keys whose target is neither what the plan saw nor the bundle's definition. Pure.
_domain_written_without_properties
¶
True when the target holds the domain's clock and settings as the bundle has them, its feature properties not (yet) written: what an apply stopped after the domain step leaves. Pure.
_pid_lookup
¶
'DB.VIEW' -> target PROCESS_ID, from what this apply registered, else the target catalog.
run_order
¶
Waves of the processes this apply registered (or replaced) and the calls that compute them.
managers_to_initialise
¶
apply_deployment
¶
Carry out plan (a :class:DeploymentPlan or a saved plan path) on the active target store.
Parameters¶
plan : DeploymentPlan | str
environment : str | dict
The same environment file the plan was made with.
dry_run : bool
List what would be done, write nothing (the target is still read and compared).
out_dir : str | None
Where apply.json, apply.md, managers_to_initialise.json and run_order.json go
(default: the bundle's plans folder).
Raises¶
UnresolvedConflictsError
The plan holds a fail decision.
TargetChangedError
The target changed since the plan (plan again).