Skip to main content

CheckpointStore

Trait CheckpointStore 

Source
pub trait CheckpointStore: Send + Sync {
    // Required methods
    fn create_run(
        &self,
        graph_name: &str,
    ) -> Pin<Box<dyn Future<Output = Result<RunId>> + Send + '_>>;
    fn record_attempt(
        &self,
        run_id: &str,
        node_id: &str,
        attempt: u32,
        input: &Value,
    ) -> Pin<Box<dyn Future<Output = Result<CheckpointAttemptId>> + Send + '_>>;
    fn complete_attempt(
        &self,
        attempt_id: &str,
        output: &Value,
        meta: &HashMap<String, Value>,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + '_>>;
    fn fail_attempt(
        &self,
        attempt_id: &str,
        error: &str,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + '_>>;
    fn record_interrupt(
        &self,
        attempt_id: &str,
        interrupt: &Interrupt,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + '_>>;
    fn save_state_snapshot(
        &self,
        run_id: &str,
        state: &HashMap<String, Value>,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + '_>>;
    fn load_run(
        &self,
        run_id: &str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<RunState>>> + Send + '_>>;
    fn complete_run(
        &self,
        run_id: &str,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + '_>>;
    fn fail_run(
        &self,
        run_id: &str,
        error: &str,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + '_>>;
}
Expand description

Granular checkpoint store for per-attempt recording.

This trait uses boxed futures instead of async-trait for forward compat.

Required Methods§

Source

fn create_run( &self, graph_name: &str, ) -> Pin<Box<dyn Future<Output = Result<RunId>> + Send + '_>>

Create a new run and return its ID.

Source

fn record_attempt( &self, run_id: &str, node_id: &str, attempt: u32, input: &Value, ) -> Pin<Box<dyn Future<Output = Result<CheckpointAttemptId>> + Send + '_>>

Record a new node attempt (status: Running).

Source

fn complete_attempt( &self, attempt_id: &str, output: &Value, meta: &HashMap<String, Value>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + '_>>

Mark an attempt as completed with output.

Source

fn fail_attempt( &self, attempt_id: &str, error: &str, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + '_>>

Mark an attempt as failed.

Source

fn record_interrupt( &self, attempt_id: &str, interrupt: &Interrupt, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + '_>>

Record an interrupt on an attempt.

Source

fn save_state_snapshot( &self, run_id: &str, state: &HashMap<String, Value>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + '_>>

Save the current state snapshot for a run.

Source

fn load_run( &self, run_id: &str, ) -> Pin<Box<dyn Future<Output = Result<Option<RunState>>> + Send + '_>>

Load the full run state (for resume).

Source

fn complete_run( &self, run_id: &str, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + '_>>

Mark a run as completed.

Source

fn fail_run( &self, run_id: &str, error: &str, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + '_>>

Mark a run as failed.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§