refactor(section-a+c): decompose step_tasks.py into pipeline domain

Section A — 1172-line step_tasks.py split into 4 focused modules under
backend/app/domains/pipeline/tasks/:
- extract_metadata.py: process_step_file, reextract_cad_metadata,
  _auto_populate_materials_for_cad, bbox helpers + PipelineLogger
- render_thumbnail.py: render_step_thumbnail, regenerate_thumbnail
  + PipelineLogger instrumentation
- render_order_line.py: dispatch_order_line_render, render_order_line_task
  (full still+turntable paths) + PipelineLogger step tracking
- export_glb.py: generate_gltf_geometry_task, generate_gltf_production_task

All task names preserved (app.tasks.step_tasks.*) for backward compat.
step_tasks.py is now a 23-line import-only shim.

Section C — celery_app.py task routing:
- app.domains.pipeline.tasks.* → step_processing (primary route)
- All 4 new modules added to include list for Celery discovery
- app.tasks.step_tasks.* kept as legacy fallback for in-flight tasks

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-08 20:43:56 +01:00
parent 07e3d1e026
commit c6556434d6
8 changed files with 1307 additions and 1175 deletions
+10 -4
View File
@@ -7,7 +7,11 @@ celery_app = Celery(
broker=settings.redis_url,
backend=settings.redis_url,
include=[
"app.tasks.step_tasks",
"app.tasks.step_tasks", # shim — re-exports from domains.pipeline.tasks.*
"app.domains.pipeline.tasks.extract_metadata",
"app.domains.pipeline.tasks.render_thumbnail",
"app.domains.pipeline.tasks.render_order_line",
"app.domains.pipeline.tasks.export_glb",
"app.tasks.ai_tasks",
"app.tasks.beat_tasks",
"app.domains.rendering.tasks",
@@ -24,10 +28,12 @@ celery_app.conf.update(
timezone="UTC",
enable_utc=True,
task_routes={
"app.tasks.step_tasks.*": {"queue": "step_processing"},
"app.tasks.ai_tasks.*": {"queue": "ai_validation"},
"app.tasks.beat_tasks.*": {"queue": "step_processing"},
"app.domains.pipeline.tasks.*": {"queue": "step_processing"},
"app.domains.rendering.tasks.*": {"queue": "thumbnail_rendering"},
"app.tasks.beat_tasks.*": {"queue": "step_processing"},
"app.tasks.ai_tasks.*": {"queue": "ai_validation"},
# Legacy task names (shim) — keep until old queued tasks drain
"app.tasks.step_tasks.*": {"queue": "step_processing"},
},
beat_schedule={
"broadcast-queue-status-every-10s": {