Skip to main content

somatize_runtime/
lib.rs

1// The crate is fully documented and clippy runs with -D warnings in CI,
2// so this makes "public API without docs" a build error from here on.
3#![warn(missing_docs)]
4
5//! Execution engine for Soma computational graphs.
6//!
7//! Two decisions shape this crate. [`NodeCatalog`] is THE registry — every
8//! node, filter or step, plus the trained states; the compiler and the
9//! executor read the same value, which is what keeps "what compiles" and
10//! "what runs" from drifting apart. And `run_node` (in [`executor`]) is the
11//! one execution site: input resolution, the output cache, panic
12//! containment and the start/complete/fail events happen once, for both
13//! kinds — whether a node is cacheable is *data* on its
14//! [`NodeMeta`](somatize_core::node::NodeMeta), not a branch on its kind.
15//!
16//! The pieces:
17//! - [`runner`] — trait-based execution: LocalRunner, StudyRunner, PbtRunner
18//! - [`executor`] — walks `ExecutionPlan` trees (sequence, parallel, step, loop, remote)
19//! - [`GraphSession`] — the primary orchestrator: Graph + catalog → compile → execute;
20//!   give it an [`EffectDriver`] via `with_driver`
21//!   and it drives steps too
22//! - [`effects`] — [`EffectDriver`] performs what steps
23//!   ask for; [`EffectJournal`] records once and
24//!   replays on resume; [`GraphHandler`](effects::GraphHandler) runs a
25//!   pipeline on an agent's behalf
26//! - [`cache`] — LRU memory cache, local disk cache, tiered cache
27//! - [`sampler`] — hyperparameter samplers (Grid, Random, Bayesian/TPE)
28//! - [`pruner`] — early stopping strategies (Median, Percentile)
29//! - [`tracking`] — local run directories: JSONL event sink, LocalTracker
30
31pub mod cache;
32pub mod effects;
33pub mod event_bus;
34pub mod executor;
35pub mod executors;
36pub mod forward;
37pub mod graph_session;
38pub mod node_catalog;
39pub mod pruner;
40pub mod runner;
41pub mod sampler;
42pub mod strategy;
43pub mod study_io;
44pub mod tracking;
45
46pub use cache::{LocalCache, MemoryCache, TieredCache};
47pub use effects::{EffectDriver, EffectHandler, EffectJournal, EffectSite, NodeOutcome};
48pub use event_bus::EventBus;
49pub use executor::{Context, GraphInfo, execute};
50pub use executors::{
51    FnPbtExecutor, FnTrialExecutor, PbtConfig, PbtExecutor, PbtRunner, PopulationMember,
52    StreamOutput, StreamRun, StudyRunner, TrialContext, TrialExecutor, TrialOutcome,
53};
54pub use forward::{Batched, ForwardStrategy, Standard, Stream};
55pub use graph_session::{GraphSession, graph_fit, graph_predict, graph_run};
56pub use node_catalog::{NodeCatalog, NodeImpl};
57pub use pruner::{MedianPruner, PercentilePruner, Pruner};
58pub use runner::{LocalRunner, RemoteRunner, Runner, Transport};
59pub use sampler::{BayesianSampler, GridSampler, RandomSampler, Sampler};
60pub use study_io::StudyIo;
61pub use tracking::{
62    JsonlEventSink, LocalTracker, RunInfo, RunReader, collect_git_info, list_runs, load_manifest,
63    load_status,
64};