soev for developers

warren.storage.publishing_tracker

Publishing tracker: what happened when each document of a job was submitted.

Classes

MongoDBPublishingTracker

classMongoDBPublishingTracker(client, *, database_name, collection_name='job_publishing_results', job_records_ttl_seconds=None, name=None, scoping_enabled=False)

Async MongoDB implementation of PublishingTrackerInterface.

Stores publishing outcomes in a job_publishing_results collection. Success records are keyed by (job_id, doc_id). Failure records may have doc_id=None if the failure occurred before a doc_id could be assigned.

Requires calling await setup() after construction to create indexes.

paramclientAsyncMongoClient
paramdatabase_namestr
paramcollection_namestr
= 'job_publishing_results'
paramjob_records_ttl_secondsint | None
= None

TTL on time: a record is deleted this many seconds after its last write. Must be positive. None: the index stays as it is (no TTL by default).

paramnamestr | None
= None
paramscoping_enabledbool
= False

Store the scope of the current handler on each record in a scope field, and index that field.

methodsetupasync () -> None

Create indexes for the job_publishing_results collection.

methodrecord_successasync (job_id, doc_id) -> None
paramjob_idstr
paramdoc_idstr
methodrecord_failureasync (job_id, doc_id, source, error, stage) -> None
paramjob_idstr
paramdoc_idstr | None
paramsourcestr
paramerrorstr
paramstagestr
methodget_resultsasync (job_id) -> list[dict]
paramjob_idstr
methodget_failuresasync (job_id) -> list[dict]
paramjob_idstr

Protocols

PublishingTrackerInterface

protocolPublishingTrackerInterface

Storage protocol for publishing outcomes.

methodsetupasync () -> None

Create indexes and prepare the store for use.

methodrecord_successasync (job_id, doc_id) -> None

Record a successfully published document.

paramjob_idstr
paramdoc_idstr
methodrecord_failureasync (job_id, doc_id, source, error, stage) -> None

Record a failed publish attempt.

paramjob_idstr
paramdoc_idstr | None

Document ID, or None if the failure occurred before a doc_id could be assigned.

paramsourcestr

Human-readable source identifier for diagnostics.

paramerrorstr

Error message describing what went wrong.

paramstagestr

Which step failed: "load", "register", or "publish".

methodget_resultsasync (job_id) -> list[dict]

Get all publishing results for a job.

paramjob_idstr

Returns

list[dict]

List of result records, each containing at least {doc_id, time, success}. Failure records additionally contain {source, error, stage}.

methodget_failuresasync (job_id) -> list[dict]

Get only publishing failures for a job.

paramjob_idstr

Returns

list[dict]

List of failure records (success=False).

On this page