gedih3.doctor.fused#
Fused per-partition scan for gh3_doctor’s h3db-tree diagnoses.
When the user asks for multiple per-partition diagnoses in one invocation
(e.g. --check db or --check parquet_health,metadata), this module
turns N separate parallel_map dispatches with N file opens per
partition into a single dispatch where each partition’s parquet listing,
meta JSON, and parquet footers are opened once and shared across
every enabled scan.
The shared state is built by _build_shared_state() at worker entry,
passed as a shared dict to each diagnosis’s _scan_partition_*(dir,
shared=None) worker, and dropped when the partition’s work is done.
Each scan in _SCAN_REGISTRY returns the per-partition payload its
diagnosis already produces today (no schema change), so driver-side
_finalize_check_from_results aggregation is identical to the single-
diagnosis path.
Read-amplification savings on a continental DB scale with the parquet
footer reuse — the heaviest reads — between parquet_health,
geoparquet_bbox, and backfill.
Functions#
|
Register a per-partition scan worker under |
|
Worker: run every enabled per-partition scan on one partition. |
|
Return the set of diagnosis names that participate in fusion. |
Module Contents#
- gedih3.doctor.fused.register_scan(name: str, fn: Callable[Ellipsis, Any]) None[source]#
Register a per-partition scan worker under
name.The worker must be picklable (module-level), accept
partition_diras the first positional arg, and acceptshared=Noneplus any diagnosis-specific keyword args.
- gedih3.doctor.fused.fused_scan_partition(partition_dir: str, *, enabled_scans: List[str], scan_kwargs: Dict[str, Dict[str, Any]] | None = None) Dict[str, Any][source]#
Worker: run every enabled per-partition scan on one partition.
Returns
{scan_name: per_partition_result_or_exception}. A per-scan exception is captured in the result dict (mirroringparallel_map’s exception-passthrough) so one scan’s failure on one partition never aborts the others for that same partition.scan_kwargscarries per-diagnosis broadcast args namespaced by diagnosis name — e.g.{'orphans': {'age_seconds': 86400}, 'backfill': {'products': [...], 'expected_by_product': {...}}}.
- gedih3.doctor.fused.fused_eligible_names() set[source]#
Return the set of diagnosis names that participate in fusion.
The runner uses this to decide whether
--check X,Yis fusible. Only diagnoses whose worker has been registered viaregister_scan()are eligible.