Skip to main content

NodeObserver

Trait NodeObserver 

Source
pub trait NodeObserver: Send + Sync {
    // Required methods
    fn on_node_start(
        &self,
        node_name: &str,
        step: u32,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + '_>>;
    fn on_node_complete(
        &self,
        node_name: &str,
        step: u32,
        duration: Duration,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + '_>>;
    fn on_node_error(
        &self,
        node_name: &str,
        step: u32,
        error: &str,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + '_>>;

    // Provided method
    fn on_node_retry(
        &self,
        _node_name: &str,
        _step: u32,
        _attempt: u32,
        _max_attempts: u32,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + '_>> { ... }
}
Expand description

Observer for node lifecycle events within the execution engine.

pe-graph calls these methods around each node execution. pe-runtime provides a streaming implementation that converts them to StreamEvent.

This is the extension point for phase-aware visibility. Without an observer, no overhead — the engine just skips the calls.

§Async note

Returns boxed futures because async trait methods are not yet stable in all contexts. Implementations should be lightweight (just send to a channel).

Required Methods§

Source

fn on_node_start( &self, node_name: &str, step: u32, ) -> Pin<Box<dyn Future<Output = ()> + Send + '_>>

Called before a node starts executing.

Source

fn on_node_complete( &self, node_name: &str, step: u32, duration: Duration, ) -> Pin<Box<dyn Future<Output = ()> + Send + '_>>

Called after a node completes successfully.

Source

fn on_node_error( &self, node_name: &str, step: u32, error: &str, ) -> Pin<Box<dyn Future<Output = ()> + Send + '_>>

Called when a node fails with an error.

Provided Methods§

Source

fn on_node_retry( &self, _node_name: &str, _step: u32, _attempt: u32, _max_attempts: u32, ) -> Pin<Box<dyn Future<Output = ()> + Send + '_>>

Called before a retry attempt for a failed node.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§