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

Copy Markdown View Source

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

Summary

Functions

Abort last run of an Actor task

Get last run of an Actor task

Get log of an Actor task's last run

Metamorph last run of an Actor task

Reboot last run of an Actor task

Types

get_200_json_resp()

@type get_200_json_resp() :: %{data: ApifyClient.Schemas.Run.t()}

Functions

abort(actor_task_id, opts \\ [])

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

Abort last run of an Actor task

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

This endpoint is a shortcut for Abort Actor run on the Actor task'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_task_id, opts \\ [])

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

Get last run of an Actor task

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 task or any of its default storages. All the endpoints require an authentication token.

The base path represents the last actor task run object is:

/v2/actor-tasks/{actorTaskId}/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 task 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_task_id, opts \\ [])

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

Get log of an Actor task's last run

Retrieves last Actor task run's logs.

This endpoint is a shortcut for getting last Actor task 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_task_id, opts \\ [])

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

Metamorph last run of an Actor task

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

This endpoint is a shortcut for Metamorph Actor run on the Actor task'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_task_id, opts \\ [])

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

Reboot last run of an Actor task

Reboots the last run of the specified Actor task 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 task'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.