pub struct Executor {
pub registry: Arc<ScriptRegistry>,
pub context_factory: Arc<dyn ContextFactory>,
pub telemetry: Arc<dyn TelemetrySink>,
/* private fields */
}Expand description
Executor for running registered scripts against scheduled jobs.
Constructed by ChrononBuilder in chronon-runtime and called when workers claim runs.
Fields§
§registry: Arc<ScriptRegistry>Script catalog used to resolve handler functions by name.
context_factory: Arc<dyn ContextFactory>Rebuilds ScriptContext from the run snapshot’s
actor_json (see Self::spawn_run), not the live job row.
telemetry: Arc<dyn TelemetrySink>Metrics and structured error events for invoke phases.
Implementations§
Source§impl Executor
impl Executor
Sourcepub fn new(
registry: Arc<ScriptRegistry>,
context_factory: Arc<dyn ContextFactory>,
telemetry: Arc<dyn TelemetrySink>,
event_tx: Sender<ExecutorEvent>,
max_in_flight: usize,
) -> Self
pub fn new( registry: Arc<ScriptRegistry>, context_factory: Arc<dyn ContextFactory>, telemetry: Arc<dyn TelemetrySink>, event_tx: Sender<ExecutorEvent>, max_in_flight: usize, ) -> Self
Builds an executor wired to the given registry, factory, telemetry, and event channel.
The runtime typically clones Self::event_sender before passing event_tx so both
sides can send lifecycle updates. max_in_flight bounds concurrent spawn_run work
(use executor_concurrency_from_env at the builder).
Sourcepub fn event_sender(&self) -> Sender<ExecutorEvent>
pub fn event_sender(&self) -> Sender<ExecutorEvent>
Clones the bounded sender for ExecutorEvent lifecycle updates.
Used by the runtime to subscribe without holding an Executor reference.
Sourcepub fn script_count(&self) -> usize
pub fn script_count(&self) -> usize
Returns the number of scripts currently registered.
Sourcepub fn spawn_run(&self, job: &Job, run: Run)
pub fn spawn_run(&self, job: &Job, run: Run)
Spawn asynchronous execution for one run of the given job.
Acquires a run-slot permit before invoking the script so enqueue cannot start
unlimited concurrent work. Emits ExecutorEvent::RunStarted after the slot is
held, then invokes via execute_script. Uses the run’s snapshotted actor_json
and params_json (not the live job row) so queued identity cannot change under a
worker.