taolib.testing.data_sync.repository.job_repo#

同步作业 Repository。

提供 SyncJob 的 MongoDB 持久化操作。

Classes#

SyncJobRepository

同步作业 Repository。

Module Contents#

class taolib.testing.data_sync.repository.job_repo.SyncJobRepository(collection: motor.motor_asyncio.AsyncIOMotorCollection)#

Bases: taolib.testing._base.repository.AsyncRepository[taolib.testing.data_sync.models.job.SyncJobDocument]

同步作业 Repository。

async find_by_name(name: str) taolib.testing.data_sync.models.job.SyncJobDocument | None#

根据名称查找作业。

参数:

name -- 作业名称

返回:

作业文档,如果不存在则返回 None

async find_enabled_jobs() list[taolib.testing.data_sync.models.job.SyncJobDocument]#

查找所有启用的作业。

返回:

启用的作业文档列表

async find_by_schedule() list[taolib.testing.data_sync.models.job.SyncJobDocument]#

查找所有有调度配置的作业。

返回:

有 schedule_cron 的作业列表

async update_last_run(job_id: str, status: str, timestamp) taolib.testing.data_sync.models.job.SyncJobDocument | None#

更新最后运行状态。

参数:
  • job_id -- 作业 ID

  • status -- 运行状态

  • timestamp -- 运行时间

返回:

更新后的作业文档,如果不存在则返回 None

async create_indexes() None#

创建索引。