ApifyClient.Builds (apify_client v1.0.0)

Copy Markdown View Source

Actor builds: fetch, wait for and abort them.

{:ok, build} = ApifyClient.Actors.build("jane/my-actor", "0.1")
{:ok, build} = ApifyClient.Builds.wait_for_finish(build.id, wait_secs: 600)
ApifyClient.Builds.succeeded?(build)

Functions take the connection options described in ApifyClient.Client (:token, :config, ...) next to their own. For everything else about builds, see ApifyClient.API.Builds and ApifyClient.API.Actors.Builds.

Summary

Functions

Aborts a build.

Whether the build has reached a terminal status.

Whether the build finished successfully.

Waits until the build reaches a terminal status (SUCCEEDED, FAILED, ABORTED, TIMED-OUT) and returns it.

Functions

abort(build_id, opts \\ [])

@spec abort(String.t(), keyword()) ::
  {:ok, ApifyClient.Schemas.Build.t()} | {:error, ApifyClient.Error.t()}

Aborts a build.

finished?(build)

@spec finished?(ApifyClient.Schemas.Build.t()) :: boolean()

Whether the build has reached a terminal status.

get(build_id, opts \\ [])

@spec get(String.t(), keyword()) ::
  {:ok, ApifyClient.Schemas.Build.t()} | {:error, ApifyClient.Error.t()}

Gets a build.

Options

  • :wait_for_finish - seconds (at most 60) the API waits for the build to finish before responding

succeeded?(build)

@spec succeeded?(ApifyClient.Schemas.Build.t()) :: boolean()

Whether the build finished successfully.

wait_for_finish(build_id, opts \\ [])

@spec wait_for_finish(String.t(), keyword()) ::
  {:ok, ApifyClient.Schemas.Build.t()} | {:error, ApifyClient.Error.t()}

Waits until the build reaches a terminal status (SUCCEEDED, FAILED, ABORTED, TIMED-OUT) and returns it.

Options

  • :wait_secs - stop waiting after this many seconds and return the build as it is then; check it with finished?/1. Default: wait as long as it takes.
  • :poll_interval_ms - minimum time between two requests, in case the API answers before the build finishes without holding the request (default: 1000)