Files
syops/backend/app/jobs/queue.py
T

35 lines
891 B
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""
backend/app/jobs/queue.py
用途:任务入队 API。
逻辑:API / services 调用 enqueue;Wave 2 写入 Job 表并 adapter KbJob。
"""
from __future__ import annotations
from typing import Any
from app.jobs.types import JobType
def enqueue(
job_type: JobType,
payload: dict[str, Any],
*,
correlation_id: str | None = None,
scheduled_at: Any = None,
) -> int:
"""
将任务写入队列并返回 job id。
核心逻辑:Wave 2 实现 store.create + KbJob adapter。
Args:
job_type: 任务类型。
payload: 任务参数 JSON。
correlation_id: 关联业务 id(如 kb_document_id)。
scheduled_at: 延迟执行时间(可选)。
Returns:
Job 主键。
Raises:
NotImplementedError: Wave 0 占位。
"""
raise NotImplementedError('jobs.enqueue is not wired until Wave 2')