fix: pipeline stop now halts all workers and flushes queues

Workers (ingestion, parser, extractor, aggregation, recommendation,
broker, lake-publisher) now check the pipeline:enabled Redis flag on
each loop iteration and sleep when disabled.

The toggle endpoint flushes all pipeline queues on disable so queued
jobs don't resume when workers eventually check. Broker/trading queues
are excluded from flush to avoid dropping in-flight orders.
This commit is contained in:
Celes Renata
2026-04-29 07:59:35 +00:00
parent cfcfd655e7
commit 8c3c1aab43
10 changed files with 80 additions and 9 deletions
+10 -1
View File
@@ -35,7 +35,13 @@ from services.shared.metrics import (
PARSE_LOW_QUALITY_TOTAL,
PARSE_QUALITY_SCORE,
)
from services.shared.redis_keys import QUEUE_EXTRACTION, QUEUE_MACRO_CLASSIFICATION, QUEUE_PARSING, queue_key
from services.shared.redis_keys import (
QUEUE_EXTRACTION,
QUEUE_MACRO_CLASSIFICATION,
QUEUE_PARSING,
is_pipeline_enabled,
queue_key,
)
from services.shared.storage import upload_normalized_text, upload_parser_output
logger = logging.getLogger("parser_worker")
@@ -260,6 +266,9 @@ async def main() -> None:
try:
while True:
if not await is_pipeline_enabled(rds):
await asyncio.sleep(2)
continue
raw = await rds.lpop(queue)
if raw:
job = json.loads(raw)