Background Jobs¶
The Background Jobs system runs scheduled and periodic tasks outside the interactive request-response cycle. It handles email ingestion, calendar sync, email classification, proactive notifications (daily briefings, meeting prep, commitment reminders), fact decay, Threema polling, and Redis state monitoring. Each job extends a BaseJob ABC that provides correlation ID tracing, structured logging, and timing. Jobs are dispatched via a CLI runner (python -m swisper.jobs.main <job_name>) and scheduled externally (cron, Kubernetes CronJobs).
Key Components¶
| Component | Purpose |
|---|---|
| BaseJob | Abstract base class: correlation ID generation, start/stop logging, timing, error capture |
| Job Registry | Maps job names to async runner functions for CLI dispatch |
| CLI Runner | Entry point (main.py): parses job name, initializes configuration and LLM providers, executes the job |
| Data Ingestion Jobs | Email ingestion, calendar event ingestion, email classification |
| Notification Jobs | Daily briefing, important email alerts, pre-meeting prep, commitment reminders, awaiting-response notifications |
| Maintenance Jobs | Fact decay batch, Redis expiration monitoring, Threema polling |
Documentation Sections¶
- Overview — What this module does, the full job inventory, and scheduling model
- Architecture — System design, BaseJob interface, job registry, and per-job details