pub struct WorkflowRunHandle { /* private fields */ }Expand description
A started run of a whole workflow.
Its tasks have their own output types, so the result is handed back
untyped and each output is deserialized on the way out; see
WorkflowResult.
Like RunHandle, it holds a clone of the Client it was started
from, so it can wait and cancel after that client goes out of scope.
Implementations§
Source§impl WorkflowRunHandle
impl WorkflowRunHandle
Sourcepub async fn cancel(&self) -> Result<()>
pub async fn cancel(&self) -> Result<()>
Stops this run.
Exactly RunHandle::cancel, which documents what a run id does and
does not reach.
let run = workflow.run_no_wait(client, &(), RunOpts::default()).await?;
run.cancel().await?;§Errors
Error::Grpc when the call fails.
Sourcepub async fn stream(&self) -> Result<OutputStream>
pub async fn stream(&self) -> Result<OutputStream>
The output stream of this run: the chunks its tasks publish with
Context::put_stream.
Exactly RunsClient::stream for this run’s id, which documents what
a subscription opened after the trigger can miss, what ends the stream,
and the five seconds this can spend waiting for the engine to answer
before handing back a stream that is still being opened. The race-free
pattern is RunsClient::stream_by_metadata, opened before the run
is triggered.
A workflow run has one chunk sequence per task, so
StreamChunk::task_run_id is what
tells two tasks’ outputs apart when they stream at once.
let run = workflow.run_no_wait(client, &(), RunOpts::default()).await?;
let mut chunks = run.stream().await?;
while let Some(chunk) = chunks.next().await {
let chunk = chunk?;
println!("{}: {}", chunk.task_run_id, chunk.payload);
}§Errors
Those of RunsClient::stream.
Sourcepub async fn result(&self) -> Result<WorkflowResult>
pub async fn result(&self) -> Result<WorkflowResult>
Waits for every task of the run to finish.
Waits without a time limit, exactly like RunHandle::result, and
like it goes on working after the Client the run was started from
goes out of scope.
§Errors
Error::RunFailed when any task of the run reported an error,
Error::RunCancelled when the run was cancelled before it finished
(the same sources as for RunHandle::result), and
Error::ResultStream when the subscription was given up on. Reading
an output is what can fail with Error::RunOutput, and that happens
in WorkflowResult::output rather than here.
Trait Implementations§
Source§impl Clone for WorkflowRunHandle
impl Clone for WorkflowRunHandle
Auto Trait Implementations§
impl !RefUnwindSafe for WorkflowRunHandle
impl !UnwindSafe for WorkflowRunHandle
impl Forget for WorkflowRunHandle
impl Freeze for WorkflowRunHandle
impl Move for WorkflowRunHandle
impl Send for WorkflowRunHandle
impl Sync for WorkflowRunHandle
impl Unpin for WorkflowRunHandle
impl UnsafeUnpin for WorkflowRunHandle
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
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,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request