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
A scheduled job configuration.
Jobs reference a script and define when/how it should run.
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 for identity reconstruction.
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
Create a baseline job record with generated IDs and defaults.
This constructor intentionally leaves identity and advanced scheduling fields in default/empty form. Populate cron, actor, and params fields before persistence (via coordinator service, HTTP upsert API, or direct store calls).
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.