Actor runs: fetch, wait for and abort them.
Functions take the connection options described in ApifyClient.Client
(:token, :config, ...) next to their own. For everything else about runs,
see ApifyClient.API.Runs.
{:ok, run} = ApifyClient.Actors.start("apify/web-scraper", input)
{:ok, run} = ApifyClient.Runs.wait_for_finish(run.id, wait_secs: 600)
if ApifyClient.Runs.finished?(run) do
{:ok, items} = ApifyClient.Datasets.list_items(run.default_dataset_id)
end
Summary
Functions
Aborts a run.
Whether the run has reached a terminal status.
Gets a run.
Whether the run finished successfully.
Waits until the run reaches a terminal status (SUCCEEDED, FAILED,
ABORTED, TIMED-OUT) and returns it.
Functions
@spec abort(String.t(), keyword()) :: {:ok, ApifyClient.Schemas.Run.t()} | {:error, ApifyClient.Error.t()}
Aborts a run.
Options
:gracefully- let the run finish its current work and persist its state before stopping (it gets theabortingevent and 30 seconds)
@spec finished?(ApifyClient.Schemas.Run.t()) :: boolean()
Whether the run has reached a terminal status.
@spec get(String.t(), keyword()) :: {:ok, ApifyClient.Schemas.Run.t()} | {:error, ApifyClient.Error.t()}
Gets a run.
Options
:wait_for_finish- seconds (at most 60) the API waits for the run to finish before responding
@spec succeeded?(ApifyClient.Schemas.Run.t()) :: boolean()
Whether the run finished successfully.
@spec wait_for_finish(String.t(), keyword()) :: {:ok, ApifyClient.Schemas.Run.t()} | {:error, ApifyClient.Error.t()}
Waits until the run reaches a terminal status (SUCCEEDED, FAILED,
ABORTED, TIMED-OUT) and returns it.
The API holds each request open for up to 60 seconds, so this doesn't poll in a tight loop.
Options
:wait_secs- stop waiting after this many seconds and return the run as it is then; check it withfinished?/1. Default: wait as long as it takes.:poll_interval_ms- minimum time between two requests, in case the API answers before the run finishes without holding the request (default: 1000)