Files
syops/backend/app/jobs/handlers/shipping_auto_progress.py
T

27 lines
1.0 KiB
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.
"""
jobs/handlers/shipping_auto_progress.py
用途:消费 P0-3 Task 级 AutoProgress Job。
依赖:JobContext、auto_progress_controller。
逻辑:Job 已由通用队列领取为 running;本 Handler 只委托正式控制器执行一个 Gate,不再调用旧全链路 facade。
"""
from __future__ import annotations
from app.jobs.context import JobContext
from app.jobs.registry import register_handler
from app.jobs.types import JobType
from app.services.shipping_notice.auto_progress_controller import run_auto_progress_job
@register_handler(JobType.SHIPPING_AUTO_PROGRESS)
def run_shipping_auto_progress(ctx: JobContext, payload: dict) -> None:
"""执行一个正式 Gate;payload 必须含队列注入的 job_id。"""
raw_job_id = payload.get('job_id')
if not raw_job_id:
raise RuntimeError('missing_job_id_for_shipping_auto_progress')
run_auto_progress_job(
job_id=int(raw_job_id),
worker_id=str(ctx.extras.get('worker_label') or f'shipping-auto-progress-{raw_job_id}'),
)