tasp tasks¶
tasp.tasks
¶
logger = get_task_logger(__name__)
module-attribute
¶
CASE_LOCK_TTL = 120
module-attribute
¶
fetch_emails(self)
¶
sync_cortex(self)
¶
update_ongoing_cases(self)
¶
check_challengeable(self)
¶
sync_monthly_kpi(self)
¶
sync_user_profiles(self)
¶
delete_old_reports(self)
¶
purge_old_mail_previews(self, older_than_days=90)
¶
Age-only bucket sweep; see mail_feeder.utils.email_preview.retention
for why this never touches Mail.preview_object_key. Oversized-but-recent
outliers (the actual disk-usage incident) are a manual
purge_mail_previews --min-size-mb call, not part of the automated
sweep — an automatic size cutoff could delete a legitimately long
email's preview the same day it was rendered.
materialise_dashboard_snapshots(self)
¶
fail_stale_jobs(self)
¶
Auto-fail CaseAnalyzerJob rows pending beyond STALE_JOB_TIMEOUT.
Mirrors the existing AnalyzerReport stale-rescue but operates on the ledger so per-case visibility is preserved even when AnalyzerReport rows have been GC'd by delete_old_reports.
render_mail_preview(self, mail_id)
¶
Render + store one mail's .eml->PNG preview from its MinIO archive.
Sourced from the durable MinIO archive (not the ingestion workdir), so it runs on the worker pool independent of the request that created the mail. No-op when the mail or its fetchable archive is gone; retries on transient MinIO / render errors.
sweep_missing_mail_previews(self, limit=200)
¶
Self-healing backfill of missing mail previews.
Replaces the manual regenerate_mail_previews command for the steady
state: each run enqueues render_mail_preview for rows that (a) have
no preview yet and (b) own a MinIO archive with a non-empty bucket
(i.e. are fetchable). Bucket-less submissions are excluded so they are
not re-enqueued every run.
dispatch_case_analysis(self, case_id, intents)
¶
Launch Cortex analyzers for a just-submitted case in the background.
Moved off the request/response path: the synchronous Cortex round-trips
(analyzer lookup + run_by_name per matched analyzer) used to run inline
in the submit view, so users waited on Cortex for every submission.
intents is a JSON-safe list of (app_label.model, pk, data_type) triples
(model instances aren't JSON-serializable, so callers resolve+serialize
them before enqueueing); we re-fetch the objects here.
reconcile_case(self, case_id)
¶
Single finalise entrypoint: sync ledger + advance the state machine.