Cleanup jobs summary
cleanupDeployments
Permanently removes deployments that have been soft-deleted after the retention period.
What gets cleaned
- Deployment database records marked with
deletedAt - Associated Docker registry images
- Deployment metadata database
Configuration
Manual trigger
Run this command from a machine with access to the underlying Kubernetes cluster:cleanupDeployRevisions
Removes old deployment revision records to reduce database size.
What gets cleaned
deployRevisionrecords older than retention period- Historical deployment configuration snapshots
Configuration
Manual trigger
Run this command from a machine with access to the underlying Kubernetes cluster:Per-deployment cleanup
Run this command from a machine with access to the underlying Kubernetes cluster to clean revisions for a specific deployment:cleanupTaskUsageData
Purges task usage metrics and audit logs.
What gets cleaned
TaskUsagerecords (daily aggregated metrics)TaskUsageAuditLogrecords (raw task data)
Configuration
Manual trigger
Run this command from a machine with access to the underlying Kubernetes cluster:GraphQL trigger
Use thecleanupTaskUsageDataJob query to manually trigger a purge of task usage metrics and audit logs:
Minimum retention is 90 days and can’t be reduced.
cleanupClusterAudits
Removes cluster audit log entries.
What gets cleaned
ClusterAuditrecords tracking cluster configuration changes- Historical cluster state snapshots
Configuration
Manual trigger
Run this command from a machine with access to the underlying Kubernetes cluster:Filter by cluster
Run this command from a machine with access to the underlying Kubernetes cluster to clean audits for specific clusters:cleanupAirflowDb
Cleans Airflow metadata from individual Deployment databases.
What gets cleaned
Default tables:callback_request- Task callback requestscelery_taskmeta,celery_tasksetmeta- Celery metadatadag- Dag definitionsdag_run- Dag execution historydataset_event- Dataset eventsimport_error- Import errorsjob- Job recordslog- Task execution logssession- Session datasla_miss- SLA violationstask_fail- Task failurestask_instance- Task execution recordstask_reschedule- Reschedule eventstrigger- Trigger recordsxcom- Cross-communication data
Configuration
Cloud storage export
Export archived data to cloud storage:Specific tables only
Clean only specific tables:Manual trigger
Run this command from a machine with access to the underlying Kubernetes cluster:Schedule reference
Default schedules are staggered to avoid simultaneous execution:Common configuration options
All cleanup jobs share these options:Kubernetes CronJob behavior
All cleanup CronJobs use:- Concurrency policy:
Forbid(prevents overlapping runs) - Backoff limit: 1 retry on failure
- Restart policy: Never
Monitor cleanup jobs
Check job status
Verify data cleanup
Troubleshooting
Job not running
-
Check CronJob exists:
- Check job is enabled in Helm values.
- Verify schedule syntax is valid cron expression.
Job failing
-
Check job logs:
- Database connectivity: Ensure the APC API can reach the database.
- Permissions: Verify service account has required database permissions.
Data not being cleaned
- Check retention period: Data younger than
olderThanwon’t be deleted. - Verify timestamps: Check
createdAt/deletedAtvalues in database. - Run with dry-run: Preview what would be deleted.
Best practices
- Monitor database size before and after cleanup jobs
- Start with dry-run when adjusting retention periods
- Stagger schedules if adding custom cleanup jobs
- Archive before delete for cleanupAirflowDb in production
- Set alerts for failed cleanup jobs