pub struct RunClient<'a> { /* private fields */ }Expand description
Operations on Runs.
A Run is a single execution of an Actor or Task. This client lets you monitor progress, read results, and control lifecycle (abort, resurrect).
Implementations§
Source§impl<'a> RunClient<'a>
impl<'a> RunClient<'a>
Sourcepub async fn list(
&self,
params: Option<ListParams>,
) -> Result<ListData<RunShort>, ApifyError>
pub async fn list( &self, params: Option<ListParams>, ) -> Result<ListData<RunShort>, ApifyError>
List Runs with optional pagination.
Sourcepub async fn metamorph(
&self,
run_id: &str,
target_actor_id: &str,
input: Option<impl Serialize>,
) -> Result<Run, ApifyError>
pub async fn metamorph( &self, run_id: &str, target_actor_id: &str, input: Option<impl Serialize>, ) -> Result<Run, ApifyError>
Metamorph a Run into a different Actor.
This is an advanced feature: the current container is re-purposed to execute another Actor, preserving state (e.g. request queues).
Sourcepub async fn resurrect(&self, run_id: &str) -> Result<Run, ApifyError>
pub async fn resurrect(&self, run_id: &str) -> Result<Run, ApifyError>
Resurrect a finished or aborted Run.
Useful for debugging or when you need to continue a partially failed job without starting from scratch.
Sourcepub async fn get_dataset_items(
&self,
run_id: &str,
params: Option<ListParams>,
) -> Result<Vec<DatasetItem>, ApifyError>
pub async fn get_dataset_items( &self, run_id: &str, params: Option<ListParams>, ) -> Result<Vec<DatasetItem>, ApifyError>
Read the default Dataset of a Run as raw serde_json::Value rows.
Datasets are Apify’s tabular output storage. Most Actors write one
row per scraped item. Use get_typed_dataset_items
when you know the schema.
Sourcepub async fn get_typed_dataset_items<T: DeserializeOwned>(
&self,
run_id: &str,
params: Option<ListParams>,
) -> Result<Vec<T>, ApifyError>
pub async fn get_typed_dataset_items<T: DeserializeOwned>( &self, run_id: &str, params: Option<ListParams>, ) -> Result<Vec<T>, ApifyError>
Read the default Dataset of a Run, deserialising rows into T.
let posts: Vec<InstagramPost> =
client.runs().get_typed_dataset_items(&run_id, None).await?;Sourcepub async fn wait_for_finish(
&self,
run_id: &str,
poll_interval_secs: u64,
max_wait_secs: u64,
) -> Result<Run, ApifyError>
pub async fn wait_for_finish( &self, run_id: &str, poll_interval_secs: u64, max_wait_secs: u64, ) -> Result<Run, ApifyError>
Poll a Run until it reaches a terminal status or max_wait_secs elapse.
Sleeps poll_interval_secs between requests. Returns the latest Run
state even if it never becomes terminal.