Summary
Refactor Vorta's scheduler to improve reliability, maintainability, and user visibility into scheduled and past jobs.
Goals
1. Add Persistent Jobs Store
Current state: EventLogModel only tracks executed jobs. Pause states and pending schedules are stored in-memory and lost on restart.
Goal: Add a database model to track:
- Pending/scheduled jobs (survive restarts)
- Skipped jobs with reasons (audit trail)
- Link between scheduled intent and execution results
2. Separate Scheduling, Execution, and State Management
Current state: VortaScheduler (532 lines) handles scheduling, execution triggering, and state management in one class with manual lock management and interleaved post-backup tasks.
Goal: Split into focused components:
- Scheduling: Calculate next run times, manage timers
- Execution: Create jobs, queue them, handle results, coordinate post-backup tasks
- State: Pause/resume persistence, job status tracking, crash recovery
3. Add Jobs View UI
Current state: Log page only shows past jobs. No view of pending jobs or filtering options.
Goal: New Jobs page showing:
- Pending (scheduled) and completed jobs in one view
- Filtering by profile, repository, job type, and status
- Skip reasons for jobs that didn't run
- Ability to cancel pending or re-queue failed jobs
4. Improve Reliability
Current issues:
- QTimer 32-bit limitation (~24.8 days) with imprecise workaround
- Race conditions between job checks and submission
- Post-backup tasks not guaranteed sequential
- DBus sleep/resume detection fails silently
Goal: More reliable scheduling that handles edge cases gracefully.
Out of Scope
- Cron expression support (e.g., "weekdays at 9am")
- Job dependencies/chaining
- Retry policies for failed jobs
Open Questions
- Should the Jobs view replace the existing Log page or be a separate tab?
- What filtering options are most important?
- How should crash recovery handle jobs that were running when the app crashed?
Related Files
Key files that will be affected:
src/vorta/scheduler.py - Current scheduler (to be refactored)
src/vorta/store/models.py - Add new job model
src/vorta/borg/jobs_manager.py - Job queue management
src/vorta/views/schedule_tab.py - Add Jobs page
src/vorta/views/log_page.py - Existing log view
Summary
Refactor Vorta's scheduler to improve reliability, maintainability, and user visibility into scheduled and past jobs.
Goals
1. Add Persistent Jobs Store
Current state:
EventLogModelonly tracks executed jobs. Pause states and pending schedules are stored in-memory and lost on restart.Goal: Add a database model to track:
2. Separate Scheduling, Execution, and State Management
Current state:
VortaScheduler(532 lines) handles scheduling, execution triggering, and state management in one class with manual lock management and interleaved post-backup tasks.Goal: Split into focused components:
3. Add Jobs View UI
Current state: Log page only shows past jobs. No view of pending jobs or filtering options.
Goal: New Jobs page showing:
4. Improve Reliability
Current issues:
Goal: More reliable scheduling that handles edge cases gracefully.
Out of Scope
Open Questions
Related Files
Key files that will be affected:
src/vorta/scheduler.py- Current scheduler (to be refactored)src/vorta/store/models.py- Add new job modelsrc/vorta/borg/jobs_manager.py- Job queue managementsrc/vorta/views/schedule_tab.py- Add Jobs pagesrc/vorta/views/log_page.py- Existing log view