pub trait ExecutionUnit:
Send
+ Sized
+ 'static {
type Constants: DeserializeOwned + 'static;
// Required methods
fn initialize(
constants: Self::Constants,
schema: &SystemStateSchema,
context: &InitializationContext,
) -> TaskResult<Self>;
fn member_count(&self) -> usize;
fn member(&self, index: usize) -> Option<MemberView<'_>>;
fn step(&mut self) -> TaskResult;
// Provided method
fn preflight(
_constants: &Self::Constants,
_schema: &SystemStateSchema,
) -> TaskResult<ObservationPlan> { ... }
}Expand description
One schedulable scientific execution containing one or more members.
Workflow manages every implementation through the same lifecycle and does
not distinguish a standalone unit from a coordinated ensemble. A normal
unit returns one MemberView; an ensemble returns one view per member and
keeps all internal parallelism, shared inputs, and synchronization private.
Each exposed member owns a distinct SystemState.
Member count, index order, identities, state owners, and schema allocations
must remain stable after initialization. One successful Self::step must
strictly advance at least one incomplete member and must never advance a
member that was already complete. Other incomplete members may wait during a
coordinated step, which permits synchronized ensembles and restored members
at different iterations.
Required Associated Types§
Sourcetype Constants: DeserializeOwned + 'static
type Constants: DeserializeOwned + 'static
One complete set of constants supplied by Config.
Required Methods§
Sourcefn initialize(
constants: Self::Constants,
schema: &SystemStateSchema,
context: &InitializationContext,
) -> TaskResult<Self>
fn initialize( constants: Self::Constants, schema: &SystemStateSchema, context: &InitializationContext, ) -> TaskResult<Self>
Builds a fully initialized standalone unit or ensemble.
Every state subsequently exposed through Self::member must have been
created from this exact schema allocation.
Sourcefn member_count(&self) -> usize
fn member_count(&self) -> usize
Returns the stable positive number of independently stateful members.
Sourcefn member(&self, index: usize) -> Option<MemberView<'_>>
fn member(&self, index: usize) -> Option<MemberView<'_>>
Borrows one member by stable zero-based index.
The method must be side-effect free. Workflow calls it repeatedly before
and after coordinated steps. An index below Self::member_count must
always return Some; all other indices must return None.
Sourcefn step(&mut self) -> TaskResult
fn step(&mut self) -> TaskResult
Performs one coordinated scientific transition.
A standalone unit advances itself. An ensemble may advance members in
parallel or share generated inputs, but it must return only after the
complete logical step is visible through Self::member.
Provided Methods§
Sourcefn preflight(
_constants: &Self::Constants,
_schema: &SystemStateSchema,
) -> TaskResult<ObservationPlan>
fn preflight( _constants: &Self::Constants, _schema: &SystemStateSchema, ) -> TaskResult<ObservationPlan>
Validates unit-owned configuration and defines per-member observations.
All members of one execution unit use the state schema selected by the task and this common observation plan. The default records every field at every iteration without additional validation. An override owns all domain validation that can be performed before initialization; Study trusts a successful result. This preflight operation must not create output, initialize the unit, or mutate external state.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".