pub struct RunsClient { /* private fields */ }Expand description
The runs client is a client for interacting with task and workflow runs within Hatchet.
Implementations§
Source§impl RunsClient
impl RunsClient
Sourcepub async fn get(
&self,
workflow_run_id: &str,
) -> Result<GetWorkflowRunResponse, HatchetError>
pub async fn get( &self, workflow_run_id: &str, ) -> Result<GetWorkflowRunResponse, HatchetError>
Get a workflow run by its ID.
use hatchet_sdk::{Hatchet, EmptyModel};
#[tokio::main]
async fn main() {
let hatchet = Hatchet::from_env().await.unwrap();
let workflow_run = hatchet.workflow_rest_client.get("123").await.unwrap();
}Sourcepub async fn subscribe_to_stream(
&mut self,
workflow_run_id: &str,
) -> Result<Pin<Box<dyn Stream<Item = Result<Vec<u8>, HatchetError>> + Send>>, HatchetError>
pub async fn subscribe_to_stream( &mut self, workflow_run_id: &str, ) -> Result<Pin<Box<dyn Stream<Item = Result<Vec<u8>, HatchetError>> + Send>>, HatchetError>
Subscribe to stream events for a workflow run. Returns an async Stream of byte chunks
emitted by tasks via ctx.put_stream().
use hatchet_sdk::Hatchet;
use futures::StreamExt;
#[tokio::main]
async fn main() {
let mut hatchet = Hatchet::from_env().await.unwrap();
let mut stream = hatchet.workflow_rest_client.subscribe_to_stream("run-id").await.unwrap();
while let Some(chunk) = stream.next().await {
println!("Got chunk: {:?}", chunk.unwrap());
}
}Trait Implementations§
Source§impl Clone for RunsClient
impl Clone for RunsClient
Source§fn clone(&self) -> RunsClient
fn clone(&self) -> RunsClient
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl !Freeze for RunsClient
impl !RefUnwindSafe for RunsClient
impl Send for RunsClient
impl Sync for RunsClient
impl Unpin for RunsClient
impl UnsafeUnpin for RunsClient
impl !UnwindSafe for RunsClient
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Wrap the input message
T in a tonic::Request