ApifyClient.API.Actors.Runs.Last (apify_client v1.0.0)

Copy Markdown View Source

Provides API endpoints related to api/actors/runs/last

Summary

Functions

Abort Actor's last run

Get Actor's last run

Get log of an Actor's last run

Metamorph Actor's last run

Reboot Actor's last run

Functions

abort(actor_id, opts \\ [])

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

Abort Actor's last run

Aborts the last run of the specified Actor and returns an object that contains all the details about the run.

This endpoint is a shortcut for Abort Actor run on the Actor's last run. Only runs that are starting or running are aborted. For runs with status FINISHED, FAILED, ABORTING and TIMED-OUT this call does nothing.

Options

  • status: Filter for the run status.
  • origin: Filter for the run origin, i.e. the means by which the run was started.
  • gracefully: If true passed, the Actor run will abort gracefully. It will send aborting and persistState event into run and force-stop the run after 30 seconds. It is helpful in cases where you plan to resurrect the run later.

get(actor_id, opts \\ [])

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

Get Actor's last run

This is not a single endpoint, but an entire group of endpoints that lets you to retrieve and manage the last run of given Actor or any of its default storages. All the endpoints require an authentication token.

The base path represents the last Actor run object is:

/v2/actors/{actorId}/runs/last{?token,status,origin}

Using the status query parameter you can ensure to only get a run with a certain status (e.g. status=SUCCEEDED). Similarly, the origin query parameter filters runs by the means by which they were started (e.g. origin=API). The output of this endpoint and other query parameters are the same as in the Get Actor run endpoint.

Convenience endpoints for last Actor run

Options

  • status: Filter for the run status.
  • origin: Filter for the run origin, i.e. the means by which the run was started.
  • wait_for_finish: The maximum number of seconds the server waits for the run to finish. By default it is 0, the maximum value is 60. <!-- MAX_ACTOR_JOB_ASYNC_WAIT_SECS --> If the run finishes in time then the returned run object will have a terminal status (e.g. SUCCEEDED), otherwise it will have a transitional status (e.g. RUNNING).

log(actor_id, opts \\ [])

@spec log(actor_id :: String.t(), opts :: keyword()) ::
  {:ok, String.t()} | {:error, ApifyClient.Error.t()}

Get log of an Actor's last run

Retrieves last Actor run's logs.

This endpoint is a shortcut for getting last Actor run's log. Same as Get Actor build or run log endpoint.

Options

  • status: Filter for the run status.

  • origin: Filter for the run origin, i.e. the means by which the run was started.

  • stream: If true or 1 then the logs will be streamed as long as the run or build is running.

  • download: If true or 1 then the web browser will download the log file rather than open it in a tab.

  • raw: If true or 1, the logs will be kept verbatim. By default, the API removes ANSI escape codes from the logs, keeping only printable characters.

metamorph(actor_id, opts \\ [])

@spec metamorph(actor_id :: String.t(), opts :: keyword()) ::
  {:ok, ApifyClient.Schemas.Run.t()} | {:error, ApifyClient.Error.t()}

Metamorph Actor's last run

Transforms the last run of the specified Actor into a run of another Actor with a new input.

This endpoint is a shortcut for Metamorph Actor run on the Actor's last run.

Options

  • status: Filter for the run status.

  • origin: Filter for the run origin, i.e. the means by which the run was started.

  • target_actor_id: ID of a target Actor that the run should be transformed into.

  • build: Optional build of the target Actor.

    It can be either a build tag or build number. By default, the run uses the build specified in the default run configuration for the target Actor (typically latest).

reboot(actor_id, opts \\ [])

@spec reboot(actor_id :: String.t(), opts :: keyword()) ::
  {:ok, ApifyClient.Schemas.Run.t()} | {:error, ApifyClient.Error.t()}

Reboot Actor's last run

Reboots the last run of the specified Actor and returns an object that contains all the details about the rebooted run.

This endpoint is a shortcut for Reboot Actor run on the Actor's last run. Only runs with status RUNNING can be rebooted. The run's container will be restarted, so any data not persisted in the key-value store, dataset, or request queue will be lost.

Options

  • status: Filter for the run status.
  • origin: Filter for the run origin, i.e. the means by which the run was started.