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 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

Source

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).

Source

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.

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.

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.

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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 = !

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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more