Reports¶
A run returns a RunReport and writes it to .last_run.json in the storage
path, where databrew report and read_reports read it back. The file's
keys are those of RunReport.record, some of which differ from the
attribute names: stopped_reason holds detail, pass_count holds passes, and
consecutive_empty_runs holds empty_runs. How a run ends gives the
meaning of each Stop and Outcome.
databrew.RunReport
¶
RunReport(
name: str,
stop: Stop,
detail: str | None,
outcome: Outcome,
stats: CrawlStats,
total_items: int,
passes: int,
empty_runs: int = 0,
elapsed: float = 0.0,
traversal: Literal["paused", "completed"] | None = None,
coverage_gaps: int = 0,
)
The result of one run, which .last_run.json records under its own keys.
detail
¶
detail: str | None
The specifics of the stop, empty listing results, or exhausted listing retries, or
None when the queue emptied without these notes.
empty_runs
¶
empty_runs: int = 0
The runs in a row that stored no new item and no change. A run that processed no URL
keeps the previous count. A run killed before it ends leaves a record with the stop
interrupted, the detail "Run did not finish", and the previous count plus 1.
traversal
¶
traversal: Literal['paused', 'completed'] | None = None
The captured traversal state: paused when ready listing pages wait for the next run,
completed otherwise, or None when setup failed or no traversal has begun.
coverage_gaps
¶
coverage_gaps: int = 0
Unresolved failed listing requests captured at crawl end, or zero when setup failed.
record
¶
record() -> dict[str, object]
The report as .last_run.json stores it.
Source code in src/databrew/report.py
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | |
from_record
¶
from_record(record: Mapping[str, Any]) -> RunReport
Rebuild a report from what record wrote; a key or value out of place raises.
Source code in src/databrew/report.py
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | |
databrew.Stop
¶
Bases: StrEnum
Why a run ended.
databrew.Outcome
¶
databrew.CrawlStats
¶
CrawlStats(
urls_processed: int = 0,
urls_succeeded: int = 0,
urls_failed: int = 0,
urls_answered: int = 0,
new_items: int = 0,
changed_items: int = 0,
observations: int = 0,
degraded_responses: int = 0,
extraction_diagnostics: int = 0,
items_dropped: int = 0,
listing_pages: int = 0,
empty_listing_pages: int = 0,
consecutive_failures: int = 0,
started_at: datetime = now(),
)
The counts of one run, which the stop rules, adaptive concurrency, and the report read.
urls_answered
¶
urls_answered: int = 0
Terminal failures that are the site's answer about one URL: a 404, a 410, or a page extraction cannot use.
observations
¶
observations: int = 0
Listing-page sightings stored, including unchanged values and repeated keys.
degraded_responses
¶
degraded_responses: int = 0
Successful responses with a parser_failed or required_missing diagnostic.
extraction_diagnostics
¶
extraction_diagnostics: int = 0
Those diagnostics across all successful responses.
items_dropped
¶
items_dropped: int = 0
Items that extraction dropped or that had no key, counted in every extracted response, retried and failed ones included.
empty_listing_pages
¶
empty_listing_pages: int = 0
Listing pages that yielded no item and no item link.
listings_empty
¶
listings_empty: bool
Whether a start URL was fetched and no listing page yielded an item or an item link.
Without a start URL, an empty page is the end of a branch that an earlier run or pass began, as when a run resumes a traversal or retries its last page.
databrew.read_reports
¶
Read every .last_run.json under paths without writing anything.
A path that holds no record, or a record that cannot be read, becomes a failed report
named by its path.
Source code in src/databrew/report.py
234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 | |