Branch: ty/thumbnail-worker-setup
Phase: 4 🔄 — 4.1-4.5 done; next: 4.6 CeleryInstrumentor wiring
Task file: tasks/THUMBNAIL_WORKER.md — read at session start, update as tasks complete
Known pitfalls:
django.taskshas no Redis backend/worker → use Celery- Never call
manage.pydirectly → usemakecommands - Django commands / imports need
cd django_thumbnailfirst —DJANGO_SETTINGS_MODULE=django_thumbnail.settings.testonly resolves from inside that directory
Async thumbnail generation. User uploads image → Django saves to MinIO → Celery task generates 300×300 thumbnail → saves back to MinIO → status tracked in PostgreSQL.
App (Django):
- Worker: Celery + Redis broker,
@shared_task - Storage:
django-storages[s3]+ boto3 → MinIO - Frontend:
django-bootstrap5, 3 pages - Observability: OpenTelemetry → Jaeger,
telemetry.py
Infra: read docker-compose.yml
django-thumbnail/
├── CLAUDE.md
├── Makefile ← need commands? read this
├── docker-compose.yml
├── pyproject.toml
├── tasks/
│ └── THUMBNAIL_WORKER.md ← task status & architecture decisions
├── django_thumbnail/
│ ├── django_thumbnail/
│ │ ├── settings/
│ │ │ ├── base.py ← env vars & defaults here
│ │ │ ├── local.py
│ │ │ └── test.py ← InMemoryStorage, CELERY_TASK_ALWAYS_EAGER
│ │ ├── celery.py
│ │ └── urls.py
│ └── images/ ← main app
│ ├── models.py ← need schema? read this (Image + ImageTask)
│ ├── migrations/ ✅
│ ├── admin.py ← ✅ 1.3
│ ├── views.py
│ ├── urls.py
│ ├── tasks.py ← Celery task: generate_thumbnail (⬜ 2.1)
│ ├── storage.py ← MinIO helpers
│ ├── management/commands/
│ │ ├── create_test_users.py ← ✅ 1.4
│ │ ├── generate_placeholders.py ← ✅ 1.5
│ │ └── createbucket.py ← ✅ 1.6
│ └── tests/
Image+ImageTasksplit — why: retry → newImageTaskrecord → full history, Image stays clean- Owner isolation: always
Image.objects.for_user(request.user)— never expose cross-user data - No DRF — plain
JsonResponse+@login_required - Test accounts:
test1@example.com/test1,test2@example.com/test2(permanent, no registration) - Thumbnail naming:
{stem}_thumbnail{ext}
- Session start: read
tasks/THUMBNAIL_WORKER.mdfor phase + task status - Commands: read
Makefile, never constructmanage.pycalls manually - Schema: read
images/models.py, don't trust memory - Before implementing: restate task, ask if ambiguous
- After each task: mark complete in
tasks/THUMBNAIL_WORKER.md, update §0 - Scope change: update
tasks/THUMBNAIL_WORKER.mdfirst, then implement - No web search unless user allows
- Idempotency: all Celery tasks safe to retry
- Owner isolation: every queryset scoped to
request.user