Schedule Integration
Schedule Integration
Server Sync integrates directly into the Pelican Schedule system.
SyncTaskSchema
Registers "Server Sync" as a task type in the Schedule system:
| Property | Value |
|---|---|
| Task ID | server_sync |
| Payload | Sync Pair ID |
| Display | Pair direction display + sync mode |
| Availability | Only when the server has active sync pairs |
Task Execution
- Load pair and check if enabled
- Acquire cache lock:
server_sync_schedule_{pairId}(10 min timeout) - If
sync_mode = on_restart: Stop partner server + wait 15s - Execute
SyncService::executeSync() - If
sync_mode = on_restart: Start partner server - Release lock
Automatic Scheduler
A scheduler runs every minute:
server-sync:run-due — every minute, without overlapping (15 min lock)
server-sync:cleanup-logs — daily
Flow (every minute):
- Reset stale syncs: Pairs in
runningstatus for >30 min → set tofailed - Check concurrent limit: Calculate available slots
- Load due pairs:
SyncPair::dueForSync()(limited to available slots) - Execute synchronously (not via queue)
Log Cleanup:
Daily, all SyncLog entries older than log_retention_days are deleted.
Create Sync Schedule (Admin)
Creates a schedule with preconfigured tasks:
| Sequence | Action | Payload | Time Offset |
|---|---|---|---|
| 1 | power | stop | 0s |
| 2 | server_sync | Pair ID | 20s |
| 3 | power | start | 5s |
Preset Options:
| Preset | Cron |
|---|---|
| Hourly | 0 * * * * |
| Every 6 hours | 0 */6 * * * |
| Every 12 hours | 0 */12 * * * |
| Daily | 0 0 * * * |
| Daily 3 AM | 0 3 * * * |
Schedule Mirroring
When enabled, the schedule is automatically mirrored to the partner server:
- Mirror name:
"{originalName} [Sync Mirror]" only_when_online = false(sync runs even when server is offline)- All tasks are cloned
- Changes to the original schedule are automatically synchronized
- Deleting the source schedule removes the mirror