taolib.testing.data_sync.repository.log_repo#

同步日志 Repository。

提供 SyncLog 的 MongoDB 持久化操作。

Classes#

SyncLogRepository

同步日志 Repository。

Module Contents#

class taolib.testing.data_sync.repository.log_repo.SyncLogRepository(collection: motor.motor_asyncio.AsyncIOMotorCollection)#

Bases: taolib.testing._base.repository.AsyncRepository[taolib.testing.data_sync.models.log.SyncLogDocument]

同步日志 Repository。

async find_by_job(job_id: str, skip: int = 0, limit: int = 50) list[taolib.testing.data_sync.models.log.SyncLogDocument]#

查找指定作业的日志。

参数:
  • job_id -- 作业 ID

  • skip -- 跳过记录数

  • limit -- 限制记录数

返回:

日志文档列表,按 started_at 降序

async find_recent(skip: int = 0, limit: int = 50) list[taolib.testing.data_sync.models.log.SyncLogDocument]#

查找最近的日志。

参数:
  • skip -- 跳过记录数

  • limit -- 限制记录数

返回:

最近的日志文档列表

async get_aggregate_metrics(job_id: str, days: int = 7) dict[str, Any]#

获取聚合指标。

参数:
  • job_id -- 作业 ID

  • days -- 天数

返回:

聚合指标字典

async create_indexes() None#

创建索引。