feat(forecast): forecast Celery task + persist §22 «1.0» (Step 3b-i) #1068
No reviewers
Labels
No labels
admin
analytics
auth
automation
bug
business
chore
ci
compliance
data
data-moat
docs
duplicate
dx
enhancement
Fable 5 ревью
feedback/max
generative
GG-форсайт
needs-discussion
needs-human
observability
pause-bots
performance
priority/p0
priority/p1
priority/p2
priority/p3
scope/backend
scope/db
scope/devops
scope/frontend
scope/qa
scrapers
security
site-finder
stage/1
stage/2
status/blocked
status/done
status/needs-analysis
status/needs-fix
status/qa
status/ready
status/review
status/wip
tech-debt
tradein
ux
week ревью 1
wontfix
вторичка
ИРД
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: lekss361/gendesign#1068
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "feat/forecast-celery-task-persist"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What — Step 3b-i: forecast Celery task + persist §22 (no endpoint trigger yet)
The §22 orchestrator
build_site_finder_report(3a, #1056) takes ~30-180s → can't run inline on the sync/analyze. This adds the background Celery task that runs it and persists the result as aschema_version="1.0"run.repository.latest_run_for(db, cad_num, *, schema_version=None)— keyword-only param (default None = currentv_analysis_runs_latest, backward-compat; sole existing caller unaffected). When given → base-tableanalysis_runs WHERE cad_num AND schema_version ORDER BY created_at DESC LIMIT 1(index-served via #127), so the task fetches the latest analyze-1.0 site-analysis run even when newer 1.0 rows exist on top.workers/tasks/forecast.py::forecast_site_finder_report(cad_num, horizon=12, created_by)— reads latest analyze-1.0 →build_site_finder_report(analyze=row.result, …)→persist_analysis_run(result=report.as_dict(), schema_version="1.0", status, confidence, segment, params). Graceful: no base run / compute error → log + return None (worker not crashed).time_limit=900/soft=840. Registered in celeryinclude.Prod-confirmed input assumption
analyze-1.0runs store the full analyze dict inresult(competitors=20, district populated — verified on 66:41:0702048:27/Кировский, 66:41:0204016:10/Железнодорожный) → the orchestrator'sanalyzeinput read from the persisted run is valid.Quality
:x::type, index-served); task degrades gracefully (no worker crash) + persists "1.0" (contract verified against the realSiteFinderReport.as_dict());status="done"→normalized→"complete" (CHECK-valid, no IntegrityError). Tests genuine (filtered-read returns analyze-1.0 over newer 1.0; happy/graceful paths).Inert until 3b-ii wires the
/analyze?horizon=enqueue (next). Full live-chain prod ground-truth lands with 3b-ii (analyze→task→§22 row→fetch). Refs #994 #961.