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 job actor_json.
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: UnboundedSender<ExecutorEvent>,
) -> Self
pub fn new( registry: Arc<ScriptRegistry>, context_factory: Arc<dyn ContextFactory>, telemetry: Arc<dyn TelemetrySink>, event_tx: UnboundedSender<ExecutorEvent>, ) -> 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.
Sourcepub fn event_sender(&self) -> UnboundedSender<ExecutorEvent>
pub fn event_sender(&self) -> UnboundedSender<ExecutorEvent>
Clones the unbounded 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.
Emits ExecutorEvent::RunStarted immediately, then invokes the script via
execute_script. Run params_json takes precedence over job defaults.