1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
//! Coordinator tick loop: due-job discovery, claims, and run enqueue.
//!
//! Parses cron expressions, discovers due jobs, claims partition slices, and enqueues runs.
//! Workers in `chronon-runtime` claim and execute runs separately from the tick loop.
//!
//! # Documentation map
//!
//! - **Embedded / coordinator ticks** — [`Scheduler`], [`run_coordinator_tick_loop`]
//! - **Cron parsing** — [`CronExpr`]
//! - **Horizontal scale-out** — [`PartitionAssigner`], [`try_acquire_leader`]
//! - **Env tuning** — `num_partitions_from_env`, `tick_interval_ms_from_env`, and related helpers (see table below)
//!
//! # Environment variables
//!
//! | Variable | Default | Purpose |
//! |----------|---------|---------|
//! | `CHRONON_NUM_PARTITIONS` | 64 | Partition count for due-job sharding |
//! | `CHRONON_TICK_INTERVAL_MS` | 250 | Sleep between ticks when idle |
//! | `CHRONON_TICK_BATCH_LIMIT` | 500 | Max due jobs processed per tick |
//! | `CHRONON_JOB_CLAIM_LEASE_TTL_S` | 5 | Tick claim lease on a job row |
//! | `CHRONON_PARTITION_LEASE_TTL_S` | 30 | Partition ownership lease |
//! | `CHRONON_PARTITION_LEASE_RENEW_S` | 5 | Partition lease renew interval |
//! | `CHRONON_RUN_LEASE_TTL_S` | 300 | Worker claim lease on a run |
//! | `CHRONON_RUN_LEASE_RENEW_S` | 1 | Worker lease renew interval |
//! | `CHRONON_WORKER_POOL` | `"general"` | Default worker pool id |
//! | `CHRONON_WORKER_CONCURRENCY` | 4 | Concurrent run tasks per worker loop |
//! | `CHRONON_LEADER_TTL_S` | 30 | Scheduler leader lease (see [`try_acquire_leader`]) |
//! | `CHRONON_DISABLE_COORDINATOR` | — | Set to `1` or `true` to pause coordinator ticks |
//! | `CHRONON_DISABLE_WORKER` | — | Set to `1` or `true` to pause worker claiming |
//!
//! `ChrononBuilder::tick_interval_ms` (in `chronon-runtime`) overrides
//! `CHRONON_TICK_INTERVAL_MS` when set at build time. Partition count is env-only.
//!
//! # Notes
//!
//! Embedded mode assigns all partitions locally and skips distributed lease churn.
//! Coordinator ticks enqueue runs only; they do not execute scripts.
pub use CronExpr;
pub use ;
pub use PartitionAssigner;
pub use ;
pub use Scheduler;
pub use ;
use Arc;
use SchedulerStore;
use TelemetrySink;
/// Scheduler configuration.
///
/// Defaults are loaded from environment helpers such as [`tick_interval_ms_from_env`]; override fields
/// before constructing [`Scheduler`].
/// Handle for a running scheduler loop.
///
/// Snapshot of the components passed into [`run_coordinator_tick_loop`] after boot.