Skip to content

Background Tasks

Long-running work is executed with Django's native task framework (Django 6.0 django.tasks) using the database backend (django_tasks_db). Enqueued tasks are picked up by the worker container (python manage.py db_worker). Django 6.0 has no built-in scheduler, so tasks are launched on demand (e.g. from an admin button) and periodic work is scheduled by host cron.

Viewing task results

Every task run produces a result row visible in the admin under System → Task Status (/<institute>/admin/django_tasks_database/dbtaskresult/). The list shows status (READY/RUNNING/SUCCESSFUL/FAILED), queue, target, and timestamps, scoped to the active institute.

Retention / cleanup

Results are read-only in the admin. django_tasks_db has no automatic retention, so results are pruned by the scheduled job prune_db_task_results (finished after 14 days, FAILED after 45 days):

python manage.py prune_db_task_results --min-age-days 14 --failed-min-age-days 45 --dry-run

Defined tasks

Task Trigger Purpose
run_ai_generation Exam Assembly → Start AI Generation Full AI question generation: extract corpus → LLM generate → verify citations → save questions
regenerate_non_frozen_questions Exam Assembly → Regenerate Regenerate questions while preserving frozen (locked) ones
auto_translate_messages System → Translations → Auto-translate Translate missing/review catalog rows via the institute's provider (tenant-scoped)
seed_catalog System → Translations → Seed Import msgids from django.po into the catalog (shared/public)
publish_catalog System → Translations → Publish Snapshot approved strings and make them live (shared/public)