feat(tradein): checkpoint/resume for cian full-load — survive restart (#930) #932
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
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: lekss361/gendesign#932
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "feat/cian-fullload-checkpoint-resume"
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?
Summary
done_buckets(list of"room_label:lo:hi"strings) accumulates inscrape_runs.countersas each leaf-bucket is completed, persisted per-bucket viaupdate_heartbeat.run_cian_full_loadgainsresume_run_id: int | None = None— if set, readsdone_bucketsfrom the previous run's counters and passes them asskip_bucketstofetch_all_secondary, skipping pagination andon_bucketfor already-completed buckets. Probe requests (for split decisions) still execute.CianFullLoadRequestgainsresume_run_idfield; without it behaviour is unchanged (full walk from scratch).on_bucketsignature changed from(lots)to(bucket_key, lots)throughout —_walk_price_range,run_cian_full_load._on_bucket, and test stubs updated.countersreading usesCAST(:rid AS bigint)(psycopg v3 safe, no::cast).test_skip_buckets_skips_pagination_and_on_bucketandtest_on_bucket_receives_key_and_lots. All 8 exhaustive tests pass.Test plan
uv run pytest tests/scrapers/test_cian_exhaustive.py -v→ 8 passedruff check→ All checks passedresume_run_id=<prev_run_id>→ skip already-completed buckets in logs✅ APPROVE — чистый checkpoint/resume, additive, cross-file чисто. Мержу.
Verified
done_bucketsкопится вcountersper leaf-бакет (update_heartbeat);resume_run_idчитает прошлый run черезCAST(:rid AS bigint)(psycopg-v3 safe, не::) →skip_set→_walk_price_rangeпропускает пагинацию+on_bucket для совпавшегоbucket_key, но probe всё равно выполняется (нужен для split-решения). Корректно.on_bucketsig(lots)→(bucket_key, lots)пробросана консистентно (_walk_price_range+run_cian_full_load._on_bucket+ тесты). Пустой бакет тоже маркируется done (не реపаగинируется на resume).on_bucket(1-arg, из #931) — отдельный метод, НЕ задет → нет коллизии сигнатур.resume_run_iddefault None → поведение без него не меняется.skip_buckets→ только probe, без пагинации/on_bucket;bucket_keyформатroom2:0:200000000).done_bucketsи в success, и в cancel-ветке. ✓🟡 Advisory (не блокер)
bucket_keyсовпадёт на resume только если count-driven split-дерево идентично между прогонами (listings меняются → totalOffers дрейфует → часть бакетов re-paginate). Dedup гасит, best-effort — приемлемо.Squash-merge + delete branch.