Struct DistributedOrchestrator

Source
pub struct DistributedOrchestrator<W, C, Q, RIS, MS, ES, LS, WIS, CS>
where W: Workflow<C>, C: Context + Merge + Default, Q: WorkQueue<C, W::WorkItem> + Send + Sync, RIS: RunInfoStore + Send + Sync, MS: MetricsStore + Send + Sync, ES: ErrorStore + Send + Sync, LS: LivenessStore + Send + Sync, WIS: WorkItemStateStore<W::WorkItem> + Send + Sync, CS: ContextStore<C> + Send + Sync,
{ /* private fields */ }

Implementations§

Source§

impl<W, C, Q, RIS, MS, ES, LS, WIS, CS> DistributedOrchestrator<W, C, Q, RIS, MS, ES, LS, WIS, CS>
where W: Workflow<C>, C: Context + Merge + Default, Q: WorkQueue<C, W::WorkItem> + Send + Sync, RIS: RunInfoStore + Send + Sync, MS: MetricsStore + Send + Sync, ES: ErrorStore + Send + Sync, LS: LivenessStore + Send + Sync, WIS: WorkItemStateStore<W::WorkItem> + Send + Sync, CS: ContextStore<C> + Send + Sync,

Source

pub fn new( workflow: W, queue: Q, run_info_store: RIS, metrics_store: MS, error_store: ES, liveness_store: LS, work_item_state_store: WIS, context_store: CS, ) -> Self

Create a new orchestrator.

Source

pub async fn start_run( &self, ctx: &WorkflowCtx<C>, input: W::Input, ) -> Result<String, FloxideError>

Start a new workflow run. Returns a run_id.

Note: Requires uuid crate in Cargo.toml: uuid = { version = “1”, features = [“v4”] }

Source

pub async fn status(&self, run_id: &str) -> Result<RunStatus, FloxideError>
where C: Debug + Clone + Send + Sync,

Query the status of a run.

Source

pub async fn list_runs( &self, filter: Option<RunStatus>, ) -> Result<Vec<RunInfo>, FloxideError>
where C: Debug + Clone + Send + Sync,

List all runs (optionally filter by status).

Source

pub async fn cancel(&self, run_id: &str) -> Result<(), FloxideError>
where C: Debug + Clone + Send + Sync,

Cancel a run.

Source

pub async fn pause(&self, run_id: &str) -> Result<(), FloxideError>
where C: Debug + Clone + Send + Sync,

Pause a run.

Source

pub async fn resume(&self, run_id: &str) -> Result<(), FloxideError>
where C: Debug + Clone + Send + Sync,

Resume a run.

Source

pub async fn errors( &self, run_id: &str, ) -> Result<Vec<WorkflowError>, FloxideError>
where C: Debug + Clone + Send + Sync,

Get all errors for a run.

Source

pub async fn liveness(&self) -> Result<Vec<WorkerHealth>, FloxideError>
where C: Debug + Clone + Send + Sync,

Source

pub async fn context(&self, run_id: &str) -> Result<C, FloxideError>
where C: Debug + Clone + Send + Sync,

Source

pub async fn metrics(&self, run_id: &str) -> Result<RunMetrics, FloxideError>
where C: Debug + Clone + Send + Sync,

Get progress/metrics for a run.

Source

pub async fn pending_work( &self, run_id: &str, ) -> Result<Vec<W::WorkItem>, FloxideError>
where C: Debug + Clone + Send + Sync,

Get pending work for a run.

Source

pub async fn check_worker_liveness( &self, worker_ids: &[usize], threshold: Duration, ) -> Vec<(usize, LivenessStatus)>

Check liveness status of a list of workers.

Source

pub async fn list_workers(&self) -> Result<Vec<usize>, LivenessStoreError>

List all known worker IDs.

Source

pub async fn list_worker_health( &self, ) -> Result<Vec<WorkerHealth>, LivenessStoreError>

List all worker health info.

Source

pub async fn list_work_items( &self, run_id: &str, ) -> Result<Vec<WorkItemState<W::WorkItem>>, WorkItemStateStoreError>

Get all work items for a run.

Source

pub async fn complete_run(&self, run_id: &str) -> Result<(), FloxideError>

Mark a run as completed and set finished_at timestamp.

Source

pub async fn wait_for_completion( &self, run_id: &str, poll_interval: Duration, ) -> Result<RunInfo, FloxideError>

Wait for a run to reach a terminal state (Completed, Failed, or Cancelled).

Auto Trait Implementations§

§

impl<W, C, Q, RIS, MS, ES, LS, WIS, CS> Freeze for DistributedOrchestrator<W, C, Q, RIS, MS, ES, LS, WIS, CS>
where W: Freeze, Q: Freeze, RIS: Freeze, MS: Freeze, ES: Freeze, LS: Freeze, WIS: Freeze, CS: Freeze,

§

impl<W, C, Q, RIS, MS, ES, LS, WIS, CS> RefUnwindSafe for DistributedOrchestrator<W, C, Q, RIS, MS, ES, LS, WIS, CS>

§

impl<W, C, Q, RIS, MS, ES, LS, WIS, CS> Send for DistributedOrchestrator<W, C, Q, RIS, MS, ES, LS, WIS, CS>

§

impl<W, C, Q, RIS, MS, ES, LS, WIS, CS> Sync for DistributedOrchestrator<W, C, Q, RIS, MS, ES, LS, WIS, CS>

§

impl<W, C, Q, RIS, MS, ES, LS, WIS, CS> Unpin for DistributedOrchestrator<W, C, Q, RIS, MS, ES, LS, WIS, CS>
where W: Unpin, Q: Unpin, RIS: Unpin, MS: Unpin, ES: Unpin, LS: Unpin, WIS: Unpin, CS: Unpin, C: Unpin,

§

impl<W, C, Q, RIS, MS, ES, LS, WIS, CS> UnwindSafe for DistributedOrchestrator<W, C, Q, RIS, MS, ES, LS, WIS, CS>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more