Background Tasks - ads04r/imouto-viewer GitHub Wiki

Imouto Viewer uses the django-background-tasks package to run a variety of asynchronous and scheduled operations that are too intensive or time-consuming to perform during standard HTTP requests. This allows for a responsive user experience while handling operations such as file imports, photo processing, report generation, and data analysis in the background.

Background tasks are organized by their purpose into different modules under viewer/tasks/, each one has its own queue...

  • process: Handles core data import and processing (e.g., importing files, calculating journeys).
  • reports: Manages report generation and visual content creation (e.g., annual reports, collages, static maps).
  • datacrunching: Responsible for analysis tasks (e.g., face detection, OCR, event similarity).

Many tasks include logic to prevent duplicate jobs from running simultaneously, and some tasks also reschedule themselves if system load is high or if dependencies are unfinished. Tasks are stored in the database (background_task.models.Task) and can be monitored via the Django admin. You should run the background task runner process (e.g., python manage.py process_tasks) as a separate service, ideally with concurrency for each queue. This is best done with something like systemd.

For more details, see the individual files in viewer/tasks/ and the django-background-tasks documentation.

⚠️ **GitHub.com Fallback** ⚠️