#[non_exhaustive]pub struct WorkflowRunContext {
pub run_id: String,
pub attempt: u32,
pub thread_id: String,
pub checkpoint_id: Option<String>,
pub resumed: bool,
pub cancel: CancellationToken,
/* private fields */
}Expand description
One attempt of a durable workflow run.
§Example
use adk_server::background::WorkflowRunContext;
use tokio_util::sync::CancellationToken;
let run = WorkflowRunContext::detached("run-1", CancellationToken::new());
assert_eq!(run.thread_id, "run-1");
assert!(!run.resumed);Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.run_id: StringThe run identifier.
attempt: u32The attempt number, counting recoveries.
thread_id: StringThe checkpoint thread; a graph workflow uses it as its thread_id.
checkpoint_id: Option<String>The last checkpoint the run reported, if any.
resumed: boolWhether this attempt resumes one that stopped.
cancel: CancellationTokenFires when the run is cancelled.
Implementations§
Source§impl WorkflowRunContext
impl WorkflowRunContext
Sourcepub fn detached(run_id: impl Into<String>, cancel: CancellationToken) -> Self
pub fn detached(run_id: impl Into<String>, cancel: CancellationToken) -> Self
A context for a run with no durable store behind it, for tests and direct calls.
Sourcepub async fn record_checkpoint(
&self,
checkpoint_id: impl Into<String>,
) -> Result<(), AdkError>
pub async fn record_checkpoint( &self, checkpoint_id: impl Into<String>, ) -> Result<(), AdkError>
Records checkpoint_id on the run, so a recovering worker resumes from it.
§Errors
Returns run_store.stale_epoch when another worker recovered the run; the
workflow must then stop without writing further results.
Trait Implementations§
Source§impl Clone for WorkflowRunContext
impl Clone for WorkflowRunContext
Auto Trait Implementations§
impl !RefUnwindSafe for WorkflowRunContext
impl !UnwindSafe for WorkflowRunContext
impl Forget for WorkflowRunContext
impl Freeze for WorkflowRunContextwhere
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
*const ArcInner<TreeNode> is !null: Freeze,
PhantomData<ArcInner<TreeNode>>: Freeze,
*const ArcInner<dyn DurableRunStore> is !null: Freeze,
PhantomData<ArcInner<dyn DurableRunStore>>: Freeze,
impl Move for WorkflowRunContext
impl Send for WorkflowRunContext
impl Sync for WorkflowRunContext
impl Unpin for WorkflowRunContext
impl UnsafeUnpin for WorkflowRunContextwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
*const ArcInner<TreeNode> is !null: UnsafeUnpin,
PhantomData<ArcInner<TreeNode>>: UnsafeUnpin,
*const ArcInner<dyn DurableRunStore> is !null: UnsafeUnpin,
PhantomData<ArcInner<dyn DurableRunStore>>: UnsafeUnpin,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more