Scheduled Tasks
This guide documents the background tasks that Simba Intelligence runs automatically on a recurring schedule. These tasks are managed by the Celery Beat scheduler and executed by Celery workers.Overview
Simba Intelligence uses a task queue architecture with two key components:- Celery Beat β A scheduler process (
APP_MODE=beat) that triggers tasks at configured intervals. Runs as a single-replica Kubernetes StatefulSet with a small persistent volume for thecelerybeat-schedulefile. The replica count is fixed by the chart and is not configurable: more than one beat instance would schedule every periodic task multiple times. - Celery Workers β Background processors (
APP_MODE=worker) that execute the scheduled tasks. Can be scaled horizontally based on workload.
simbaIntelligence.celery.beat.* and simbaIntelligence.celery.worker.*.
Task Schedule
π Build Attribute Cache
What it does:
- Retrieves all data sources from Composer using administrative credentials
- For each data source, fetches the distinct values of its attribute fields
- Stores them in the Redis field-value cache so the Query Agent can match user text against real values without re-fetching from Composer on every query
FIELD_VALUE_CACHE_BUDGET_MB sizes this cache. See the Environment Variables Reference.
π§Ή Purge and Sync Question Records
What it does:
- Queries the database for question records older than the retention period
- Deletes expired records to manage database size
- Syncs the surviving records so the semantic cache reflects what remains
simbaIntelligence.celery.worker.questionRecordRetentionDays (QUESTION_RECORD_RETENTION_DAYS, default 90 days). Left empty (the chart default), the value is omitted entirely and the applicationβs internal default applies. Only the worker reads it β beat just publishes the job on its schedule.
ποΈ Purge Task Results
What it does:
- Deletes task results whose
finished_attimestamp is older than the retention window - Deletes tasks that never finished whose
created_attimestamp is older than the retention window
simbaIntelligence.celery.worker.purgeTaskResultsDays (PURGE_TASK_RESULTS_DAYS, default 90 days). It behaves the same way as questionRecordRetentionDays above: empty means the application default applies, and only the worker reads it.
π Note: The retention window is a minimum, not an exact expiry. Because the purge runs only once a day, a taskβs results remain accessible for at least the configured number of days and may survive up to roughly 24 hours longer β until the next purge run passes the deadline.
π Cleanup Expired OAuth Tokens
What it does:
- Scans for expired OAuth access tokens, refresh tokens, and authorization codes
- Deletes expired entries to prevent unbounded database growth
π Note: This task is relevant only when the MCP Server is deployed, as OAuth tokens are used exclusively for MCP client authentication.
πΈοΈ Rebuild Schema Graphs
What it does:
- Iterates over connections and rebuilds each oneβs schema graph from Composer
- Stores the rebuilt graph for use by the Data Source Agent
π Note: A missing schema graph is built on demand by whoever needs it, so this job exists purely to catch schema drift on connections nobody has touched. It runs at midnight rather than 3:00 AM to stagger its Composer and LLM load away from the other overnight jobs.
Monitoring Scheduled Tasks
Verifying Beat is Running
Verifying Worker Execution
π·οΈ Label note: These labels assume the default chart name. Confirm them for your release with kubectl get pods -l app.kubernetes.io/instance=<release-name> --show-labels.
Troubleshooting
Tasks Not Running
- Beat pod not healthy β Verify the beat StatefulSet has a running pod and its persistent volume is attached. The schedule state is stored on disk.
- Workers not processing β Check that at least one worker pod is running and connected to Redis. Workers use Redis as the message broker.
- Redis connectivity β Confirm
REDIS_URLis correct and Redis is accessible from both beat and worker pods.
Task Failures
- Attribute cache build fails β Usually caused by Composer connectivity issues or missing LLM configuration. Check worker logs for error details.
- OAuth cleanup fails β Typically a database connectivity issue. Verify
POSTGRES_HOST,POSTGRES_PORT, andPOSTGRES_DATABASEare correct and PostgreSQL is accessible.
π Note: All scheduled tasks are idempotent β if a task fails, it will be retried on the next scheduled run without causing data inconsistency.