Skip to main content

Runner

Trait Runner 

Source
pub trait Runner: Send + Sync {
    // Required methods
    fn runner_id(&self) -> &RunnerId;
    fn runner_cls(&self) -> &str;
    fn max_parallel_slots(&self) -> usize;
    fn active_worker_ids(&self) -> Vec<RunnerId>;
    fn run<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = RustvelloResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn run_one<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = RustvelloResult<bool>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn shutdown<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = RustvelloResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn heartbeat<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = RustvelloResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Runner interface — the task execution engine.

Mirrors pynenc’s BaseRunner. A runner:

  1. Polls the broker for queued invocations
  2. Loads invocation data from the state backend
  3. Executes the task function
  4. Stores results and updates status

Required Methods§

Source

fn runner_id(&self) -> &RunnerId

Get this runner’s unique identifier.

Source

fn runner_cls(&self) -> &str

Human-readable runner class name (e.g., “PersistentTokioRunner”).

Source

fn max_parallel_slots(&self) -> usize

Maximum number of parallel execution slots.

Source

fn active_worker_ids(&self) -> Vec<RunnerId>

Get runner_ids of currently active workers.

Source

fn run<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = RustvelloResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Start the runner’s main execution loop. This is a blocking call that runs until shutdown.

Source

fn run_one<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = RustvelloResult<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Perform a single iteration of the runner loop. Returns true if work was done, false if idle.

Source

fn shutdown<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = RustvelloResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Graceful shutdown signal.

Source

fn heartbeat<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = RustvelloResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Send a heartbeat to indicate the runner is alive.

Implementors§