pub struct Job {Show 30 fields
pub job_id: String,
pub job_name: String,
pub script_name: String,
pub script_sig_hash: String,
pub enabled: bool,
pub schedule_kind: ScheduleKind,
pub cron_expr: Option<String>,
pub timezone: Option<String>,
pub run_once_at: Option<DateTime<Utc>>,
pub run_once_claimed_at: Option<DateTime<Utc>>,
pub run_once_claimed_by: Option<String>,
pub run_once_completed_at: Option<DateTime<Utc>>,
pub run_once_claim_expires_at: Option<DateTime<Utc>>,
pub partition_hash: Option<i64>,
pub claim_lease_id: Option<String>,
pub claim_lease_until: Option<DateTime<Utc>>,
pub pool: Option<String>,
pub region: Option<String>,
pub placement_json: Option<Value>,
pub actor_json: Value,
pub params_json: Value,
pub concurrency: i32,
pub timeout_ms: Option<i64>,
pub retry_policy_json: Value,
pub misfire_policy_json: Value,
pub parent_limits_json: Option<Value>,
pub next_run_at: Option<DateTime<Utc>>,
pub current_revision: i32,
pub updated_at: DateTime<Utc>,
pub created_at: DateTime<Utc>,
}Expand description
Scheduled work unit: binds a script name to a ScheduleKind and params.
Preferred construction: Chronon JobBuilder (chronon_scheduler::JobBuilder,
re-exported from the chronon / uf-chronon facade) from a crate::ScriptHandle,
then persist with CoordinatorService::upsert_job (or HTTP upsert /
RemoteCoordinatorClient).
Job::new / crate::ScriptHandle::job / crate::ScriptHandle::job_with_params
only seed baseline rows — a low-level alternate to the fluent builder.
| Field group | Purpose |
|---|---|
script_name / params_json | What to run and with which args |
schedule_kind + cron / run-once fields | When it becomes due |
actor_json | Identity snapshotted onto each run at enqueue; dispatch uses the run snapshot |
pool / placement | Worker pool targeting in split deployments |
§Examples
Baseline row (no schedule yet). Prefer JobBuilder for cron / run-once / manual:
use chronon_core::Job;
let job = Job::new("nightly-cleanup", "nightly_cleanup");
assert!(job.enabled);
assert_eq!(job.script_name, "nightly_cleanup");
assert_eq!(job.schedule_kind, chronon_core::ScheduleKind::Cron);Runnable: cargo run -p uf-chronon --example script_handle_job --features mem.
Fields§
§job_id: StringUnique identifier (UUID).
job_name: StringHuman-readable name, unique in the deployment.
script_name: StringName of the script to execute.
script_sig_hash: StringSignature hash at job creation (for validation).
enabled: boolWhether the job is enabled.
schedule_kind: ScheduleKindHow the job is scheduled.
cron_expr: Option<String>Cron expression (when schedule_kind is Cron).
timezone: Option<String>Timezone for cron evaluation (e.g., “America/New_York”).
run_once_at: Option<DateTime<Utc>>One-time execution timestamp (when schedule_kind is RunOnce).
run_once_claimed_at: Option<DateTime<Utc>>When a coordinator claimed this run-once job for enqueue (distributed safety).
run_once_claimed_by: Option<String>Coordinator instance id that holds the claim (coordinator_instance_id).
run_once_completed_at: Option<DateTime<Utc>>Set after a scheduled run-once execution is successfully enqueued (persisted run row).
run_once_claim_expires_at: Option<DateTime<Utc>>Claim lease expiry; after this, another coordinator may reclaim if not completed.
partition_hash: Option<i64>Partition hash for coordinator sharding (distributed mode).
claim_lease_id: Option<String>Coordinator tick-claim holder id.
claim_lease_until: Option<DateTime<Utc>>Coordinator tick-claim lease expiry.
pool: Option<String>Execution pool (e.g., “global”, “region/us-west”).
region: Option<String>Target region for execution.
placement_json: Option<Value>Additional placement constraints as JSON.
actor_json: ValueSerialized actor identity. Copied onto each run at enqueue; workers rebuild context from the run snapshot so later job updates cannot change queued identity.
params_json: ValueParameters to pass to the script.
concurrency: i32Maximum concurrent runs allowed.
timeout_ms: Option<i64>Execution timeout in milliseconds.
retry_policy_json: ValueRetry policy JSON (RetryPolicy).
misfire_policy_json: ValueMisfire policy JSON (MisfirePolicy).
parent_limits_json: Option<Value>Limits for parent/child runs.
next_run_at: Option<DateTime<Utc>>When the job should next run.
current_revision: i32Current revision number.
updated_at: DateTime<Utc>Last modification timestamp.
created_at: DateTime<Utc>Creation timestamp.
Implementations§
Source§impl Job
impl Job
Sourcepub fn new(job_name: impl Into<String>, script_name: impl Into<String>) -> Self
pub fn new(job_name: impl Into<String>, script_name: impl Into<String>) -> Self
Baseline job with generated job_id, enabled = true, and
ScheduleKind::Cron (no expression yet).
Populate schedule fields via Chronon JobBuilder (chronon_scheduler::JobBuilder,
preferred), or set schedule_kind, cron / run-once fields, params_json, and
actor_json before upsert. crate::ScriptHandle::job /
crate::ScriptHandle::job_with_params only seed baseline rows.
§Examples
use chronon_core::Job;
let job = Job::new("demo", "noop");
assert!(!job.job_id.is_empty());
assert_eq!(job.job_name, "demo");
assert_eq!(job.script_name, "noop");Sourcepub fn retry_policy(&self) -> RetryPolicy
pub fn retry_policy(&self) -> RetryPolicy
Decode RetryPolicy from Self::retry_policy_json, or default on null/invalid.
Sourcepub fn misfire_policy(&self) -> MisfirePolicy
pub fn misfire_policy(&self) -> MisfirePolicy
Decode MisfirePolicy from Self::misfire_policy_json, or default on null/invalid.
Sourcepub fn set_retry_policy(&mut self, policy: &RetryPolicy)
pub fn set_retry_policy(&mut self, policy: &RetryPolicy)
Persist a typed retry policy into Self::retry_policy_json.
Sourcepub fn set_misfire_policy(&mut self, policy: &MisfirePolicy)
pub fn set_misfire_policy(&mut self, policy: &MisfirePolicy)
Persist a typed misfire policy into Self::misfire_policy_json.
Sourcepub fn clamp_security_bounds(&mut self)
pub fn clamp_security_bounds(&mut self)
Clamp concurrency, timeout, and retry policy to production-safe ceilings.
Applied by the HTTP upsert path and available to hosts before persist.