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 Kubernetes StatefulSet with persistent storage to maintain schedule state across restarts. - Celery Workers โ Background processors (
APP_MODE=worker) that execute the scheduled tasks. Can be scaled horizontally based on workload.
Task Schedule
๐ Generate Query Suggestions
| Property | Value |
|---|---|
| Task name | generate_suggestions_scheduled_task |
| Schedule | Daily at 3:00 AM (server time) |
| Purpose | Pre-generate AI-powered query suggestions for all data sources |
- Retrieves all data sources from Composer using administrative credentials
- For each data source, fetches field-level attribute values and statistics
- Generates natural language question suggestions based on available data
- Caches the suggestions so they are immediately available when users open the Playground
๐ก Pro Tip: Pre-generated suggestions improve the user experience by showing relevant questions instantly when a user selects a data source, rather than generating them on demand.
๐งน Purge Question Records
| Property | Value |
|---|---|
| Task name | purge_question_records_task |
| Schedule | Every 24 hours |
| Purpose | Clean up old query history records based on the configured retention policy |
- Queries the database for question records older than the retention period
- Deletes expired records to manage database size
questionRecordRetentionDays (default: 90 days).
๐ Cleanup Expired OAuth Tokens
| Property | Value |
|---|---|
| Task name | cleanup_expired_oauth_tokens_task |
| Schedule | Every 7 days |
| Purpose | Remove expired OAuth tokens and authorization codes from the database |
- 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.
Monitoring Scheduled Tasks
Verifying Beat is Running
Verifying Worker Execution
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
- Suggestion generation 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
MAIN_DB_URLis 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.

