User Guide¶
IN-PROGRESS This comprehensive guide plans to cover all aspects of using PG Scheduler.
Overview¶
PG Scheduler is designed to be both simple for basic use cases and powerful for production deployments. This guide will walk you through:
Basic Usage - Core concepts and simple job scheduling
Periodic Jobs - Using the
@periodicdecorator effectivelyReliability - Understanding deduplication, retries, and error handling
Vacuum Policies - Managing job lifecycle and cleanup
Configuration - Tuning the scheduler for your needs
Troubleshooting - Common issues and solutions
Key Concepts¶
Jobs vs Periodic Jobs¶
Jobs: One-time executions scheduled for a specific time
Periodic Jobs: Recurring executions that reschedule themselves
Deduplication¶
PG Scheduler prevents duplicate job executions across multiple worker replicas using:
Deterministic Job IDs: Based on function signature and parameters
Database Constraints: PostgreSQL primary keys prevent duplicates
Window-based Logic: Time-based deduplication for periodic jobs
Priority System¶
Jobs can have different priorities:
JobPriority.CRITICAL- Executes before normal jobsJobPriority.NORMAL- Default priority
Reliability Features¶
Heartbeat Monitoring: Detect crashed workers
Orphan Recovery: Clean up abandoned jobs
Graceful Shutdown: Complete active jobs before stopping
Retry Logic: Automatic retry with exponential backoff