Skip to main content

RunClientAsync

Async sub-client for manipulating a single Actor run.

Index

Methods

abort

  • async abort(*, gracefully): dict

charge

  • async charge(event_name, count, idempotency_key): None

dataset

delete

  • async delete(): None

get

  • async get(): dict | None

get_status_message_watcher

  • Get StatusMessageWatcher instance that can be used to redirect status and status messages to logs.

    StatusMessageWatcher can be explicitly started and stopped or used as a context manager.


    Parameters

    • optionalto_logger: logging.Logger | None = None

      Logger used for logging the status and status messages. If not provided, a new logger is created.

    • optionalcheck_period: timedelta = timedelta(seconds=1)

      The period with which the status message will be polled.

    Returns StatusMessageWatcherAsync

get_streamed_log

  • Get StreamedLog instance that can be used to redirect logs.

    StreamedLog can be explicitly started and stopped or used as a context manager.


    Parameters

    • optionalto_logger: logging.Logger | None = None

      Logger used for logging the redirected messages. If not provided, a new logger is created

    • optionalkeyword-onlyfrom_start: bool = True

      If True, all logs from the start of the actor run will be redirected. If False, only newly arrived logs will be redirected. This can be useful for redirecting only a small portion of relevant logs for long-running actors in stand-by.

    Returns StreamedLogAsync

key_value_store

log

metamorph

  • async metamorph(*, target_actor_id, target_actor_build, run_input, content_type): dict

  • Parameters

    • keyword-onlytarget_actor_id: str

      ID of the target Actor that the run should be transformed into.

    • optionalkeyword-onlytarget_actor_build: str | None = None

      The 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 the latest build).

    • optionalkeyword-onlyrun_input: Any = None

      The input to pass to the new run.

    • optionalkeyword-onlycontent_type: str | None = None

      The content type of the input.

    Returns dict

reboot

  • async reboot(): dict

request_queue

resurrect

  • async resurrect(*, build, memory_mbytes, timeout_secs, max_items, max_total_charge_usd): dict
  • Resurrect a finished Actor run.

    Only finished runs, i.e. runs with status FINISHED, FAILED, ABORTED and TIMED-OUT can be resurrected. Run status will be updated to RUNNING and its container will be restarted with the same default storages.

    https://docs.apify.com/api/v2#/reference/actor-runs/resurrect-run/resurrect-run


    Parameters

    • optionalkeyword-onlybuild: str | None = None

      Which Actor build the resurrected run should use. It can be either a build tag or build number. By default, the resurrected run uses the same build as before.

    • optionalkeyword-onlymemory_mbytes: int | None = None

      New memory limit for the resurrected run, in megabytes. By default, the resurrected run uses the same memory limit as before.

    • optionalkeyword-onlytimeout_secs: int | None = None

      New timeout for the resurrected run, in seconds. By default, the resurrected run uses the same timeout as before.

    • optionalkeyword-onlymax_items: int | None = None

      Maximum number of items that the resurrected pay-per-result run will return. By default, the resurrected run uses the same limit as before. Limit can be only increased.

    • optionalkeyword-onlymax_total_charge_usd: Decimal | None = None

      Maximum cost for the resurrected pay-per-event run in USD. By default, the resurrected run uses the same limit as before. Limit can be only increased.

    Returns dict

update

  • async update(*, status_message, is_status_message_terminal, general_access): dict

wait_for_finish

  • async wait_for_finish(*, wait_secs): dict | None
  • Wait synchronously until the run finishes or the server times out.


    Parameters

    • optionalkeyword-onlywait_secs: int | None = None

      How long does the client wait for run to finish. None for indefinite.

    Returns dict | None