Skip to main content

Executor

Struct Executor 

Source
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

Source

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.

Source

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.

Source

pub fn script_count(&self) -> usize

Returns the number of scripts currently registered.

Source

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.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.