Skip to main content

TaskClient

Sub-client for manipulating a single task.

Index

Methods

call

  • call(task_input, build, memory_mbytes, timeout_secs, webhooks, wait_secs): Dict
  • Start a task and wait for it to finish before returning the Run object.

    It waits indefinitely, unless the wait_secs argument is provided.

    https://docs.apify.com/api/v2#/reference/actor-tasks/run-collection/run-task


    Parameters

    • optionaltask_input: Dict[str, Any]

      Task input dictionary

    • optionalbuild: str

      Specifies the actor build to run. It can be either a build tag or build number. By default, the run uses the build specified in the task settings (typically latest).

    • optionalmemory_mbytes: int

      Memory limit for the run, in megabytes. By default, the run uses a memory limit specified in the task settings.

    • optionaltimeout_secs: int

      Optional timeout for the run, in seconds. By default, the run uses timeout specified in the task settings.

    • optionalwebhooks: List[Dict]

      Specifies optional webhooks associated with the actor run, which can be used to receive a notification e.g. when the actor finished or failed. Note: if you already have a webhook set up for the actor or task, you do not have to add it again here.

    • optionalwait_secs: int

      The maximum number of seconds the server waits for the task run to finish. If not provided, waits indefinitely.

    Returns Dict

delete

  • delete(): None

get

  • get(): Dict

get_input

  • get_input(): Dict

last_run

  • Retrieve the client for the last run of this task.

    Last run is retrieved based on the start time of the runs.


    Parameters

    • optionalstatus: ActorJobStatus

      Consider only runs with this status.

    • optionalorigin: MetaOrigin

      Consider only runs started with this origin.

    Returns RunClient

runs

start

  • start(task_input, build, memory_mbytes, timeout_secs, wait_for_finish, webhooks): Dict
  • Start the task and immediately return the Run object.

    https://docs.apify.com/api/v2#/reference/actor-tasks/run-collection/run-task


    Parameters

    • optionaltask_input: Dict[str, Any]

      Task input dictionary

    • optionalbuild: str

      Specifies the actor build to run. It can be either a build tag or build number. By default, the run uses the build specified in the task settings (typically latest).

    • optionalmemory_mbytes: int

      Memory limit for the run, in megabytes. By default, the run uses a memory limit specified in the task settings.

    • optionaltimeout_secs: int

      Optional timeout for the run, in seconds. By default, the run uses timeout specified in the task settings.

    • optionalwait_for_finish: int

      The maximum number of seconds the server waits for the run to finish. By default, it is 0, the maximum value is 60.

    • optionalwebhooks: List[Dict]

      Optional ad-hoc webhooks (https://docs.apify.com/webhooks/ad-hoc-webhooks) associated with the actor run which can be used to receive a notification, e.g. when the actor finished or failed. If you already have a webhook set up for the actor or task, you do not have to add it again here. Each webhook is represented by a dictionary containing these items: * `event_types`: list of `WebhookEventType` values which trigger the webhook * `request_url`: URL to which to send the webhook HTTP request * `payload_template` (optional): Optional template for the request payload

    Returns Dict

update

  • update(name, task_input, build, memory_mbytes, timeout_secs, title): Dict

  • Parameters

    • optionalname: str

      Name of the task

    • optionaltask_input: Dict

      Task input dictionary

    • optionalbuild: str

      Actor build to run. It can be either a build tag or build number. By default, the run uses the build specified in the task settings (typically latest).

    • optionalmemory_mbytes: int

      Memory limit for the run, in megabytes. By default, the run uses a memory limit specified in the task settings.

    • optionaltimeout_secs: int

      Optional timeout for the run, in seconds. By default, the run uses timeout specified in the task settings.

    • optionaltitle: str

      A human-friendly equivalent of the name

    Returns Dict

update_input

  • update_input(task_input): Dict

webhooks