gedih3.doctor.runner#

Diagnosis registry + orchestrator for gh3_doctor.

Each diagnosis is a callable with check(ctx) -> Report and optional fix(ctx, report) -> Report. Diagnoses register themselves at import time via register(); the package’s diagnoses subpackage auto-imports all known diagnosis modules.

Attributes#

Classes#

Functions#

register(name, description[, scope, fix])

Decorator to register a check function.

get_diagnoses(→ Dict[str, Diagnosis])

Return a copy of the diagnosis registry.

resolve_names(→ List[str])

Expand alias groups (db, soc, all) into concrete names.

run_diagnoses(→ List[gedih3.doctor.report.Report])

Run the named diagnoses (or aliases) against ctx.

Module Contents#

class gedih3.doctor.runner.Diagnosis[source]#
name: str#
description: str#
scope: str#
check: Callable[[gedih3.doctor.report.DoctorContext], gedih3.doctor.report.Report]#
fix: Callable[[gedih3.doctor.report.DoctorContext, gedih3.doctor.report.Report], gedih3.doctor.report.Report] | None = None#
aliases: List[str] = None#
gedih3.doctor.runner.ALIAS_GROUPS#
gedih3.doctor.runner.register(name: str, description: str, scope: str = 'global', fix: Callable | None = None)[source]#

Decorator to register a check function.

Usage:

@register('orphans', 'Leftover temp + empty partitions', scope='global', fix=orphans_fix)
def orphans_check(ctx): ...
gedih3.doctor.runner.get_diagnoses() Dict[str, Diagnosis][source]#

Return a copy of the diagnosis registry.

gedih3.doctor.runner.resolve_names(names: List[str]) List[str][source]#

Expand alias groups (db, soc, all) into concrete names.

gedih3.doctor.runner.run_diagnoses(ctx: gedih3.doctor.report.DoctorContext, names: List[str], mode: str = 'check') List[gedih3.doctor.report.Report][source]#

Run the named diagnoses (or aliases) against ctx.

When two or more per-partition h3db diagnoses are requested at mode='check', dispatch fuses them into a single per-partition scan that opens each partition’s files once and routes the per- partition payload to every enabled diagnosis’s driver-side aggregator. Falls back to per-diagnosis dispatch for fix mode and for single-diagnosis check invocations.

Parameters:
ctxDoctorContext

Shared state.

nameslist of str

Diagnosis names or alias groups. Empty list = all registered.

modestr

‘check’ (read-only) or ‘fix’ (apply remedies where supported).

Returns:
list of Report