File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 66from pydantic import ValidationError
77
88from src .config import load_config
9- from src .tasks import build_classify_and_update_chain
9+ from src .queueing import build_classify_and_update_chain
1010from src .turn_webhook import TurnWebhook
1111from src .utils import validate_turn_signature
1212
Original file line number Diff line number Diff line change 1+ """Celery task submission helpers for producer processes."""
2+
3+ from celery import chain
4+
5+ from src .celery_app import celery_app
6+
7+ CLASSIFY_TURN_MESSAGE_TASK = "src.tasks.classify_turn_message"
8+ UPDATE_TURN_MESSAGE_LABEL_TASK = "src.tasks.update_turn_message_label"
9+
10+
11+ def build_classify_and_update_chain (message_id : str , message_text : str ):
12+ """Build a Celery chain without importing worker-only task modules."""
13+ return chain (
14+ celery_app .signature (
15+ CLASSIFY_TURN_MESSAGE_TASK ,
16+ args = (message_id , message_text ),
17+ ),
18+ celery_app .signature (UPDATE_TURN_MESSAGE_LABEL_TASK ),
19+ )
Original file line number Diff line number Diff line change 1- """Celery tasks for async processing ."""
1+ """Celery task implementations for worker processes ."""
22
33import logging
44from pathlib import Path
55
6- from celery import chain
7-
86from src .celery_app import celery_app
97from src .intent_classifier import IntentClassifier
108from src .turn_client import TurnAPIClient , TurnAPIServerError
@@ -140,11 +138,3 @@ def update_turn_message_label(classification: dict) -> dict:
140138 exc_info = True ,
141139 )
142140 raise
143-
144-
145- def build_classify_and_update_chain (message_id : str , message_text : str ):
146- """Build a Celery chain that classifies then updates the Turn label."""
147- return chain (
148- classify_turn_message .s (message_id , message_text ),
149- update_turn_message_label .s (),
150- )
Original file line number Diff line number Diff line change 33import pytest
44
55from src .celery_app import celery_app
6- from src .tasks import (
7- build_classify_and_update_chain ,
8- classify_turn_message ,
9- update_turn_message_label ,
10- )
6+ from src .queueing import build_classify_and_update_chain
7+ from src .tasks import classify_turn_message , update_turn_message_label
118from src .turn_client import TurnAPIClientError , TurnAPIServerError
129
1310# Enable eager mode for all tests in this module (run tasks synchronously)
You can’t perform that action at this time.
0 commit comments