s365b.jobs.progress¶
Live progress of a running job, saved on the job run for the web UI.
The runner reports what it is doing to a ProgressTracker; the
tracker keeps it in memory and writes a snapshot to job_run.progress
every few seconds, so a busy backup does not write to the database for
every item.
Percent and time left are estimates. When the module can estimate the items each object will process (Exchange counts the messages in folders not yet backed up), progress is by items; otherwise it is by objects.
Attributes¶
Classes¶
Collects progress for one job run and saves it periodically. |
Module Contents¶
- class s365b.jobs.progress.ProgressTracker(db: s365b.db.session.Database, run_id: int, modules_total: int, interval: float = 3.0, stop: asyncio.Event | None = None)[source]¶
Collects progress for one job run and saves it periodically.
- Parameters:
db – Database.
run_id – The job run.
modules_total – Number of modules in the job.
interval – Seconds between saves.
- start_module(module_id: str, name: str, noun: tuple[str, str], objects_total: int) None[source]¶
A module starts: discovery is done, objects are known.
- set_phase(phase: str) None[source]¶
Set the phase: discovering, estimating, backing_up (or restoring), finishing.
- set_estimates(estimates: dict[int, int | None]) None[source]¶
Record per-object item estimates (
Nonewhere unknown).
- object_progress(key: int, *, done: int = 0, total: int | None = None, message: str = '', unit: str = '', **_: Any) None[source]¶
The module reported progress within an object (
ctx.progress).
- object_stats(key: int, stats: s365b.core.catalog.VersionStats) None[source]¶
Items stored for an object since the last report.