Toloka documentation

create_tasks_async

toloka.client.TolokaClient.create_tasks_async | Source code

Creates tasks in Toloka asynchronously.

You can send a maximum of 100,000 requests of this kind per minute and a maximum of 2,000,000 requests per day.

Parameters Description

Parameters Type Description
tasks List[Task]

List of tasks to be created.

allow_defaults Optional[bool]

Active overlap setting:

  • True — Use the overlap that is set in the defaults.default_overlap_for_new_task_suites pool parameter.
  • False — Use the overlap that is set in the task parameters (in the overlap field).
open_pool Optional[bool]

Open the pool immediately after creating a task suite, if the pool is closed.

skip_invalid_items Optional[bool]

Task validation option:

  • True — All valid tasks are added. If a task does not pass validation, then it is not added to Toloka. All such tasks are listed in the response.
  • False — If any task does not pass validation, then operation is cancelled and no tasks are added to Toloka.
async_mode Optional[bool]

Request processing mode:

  • True — Asynchronous operation is started internally and create_tasks waits for the completion of it. It is recommended to create no more than 10,000 tasks per request in this mode.
  • False — The request is processed synchronously. A maximum of 5000 tasks can be added in a single request in this mode.

Examples:

training_tasks = [
    toloka.task.Task(input_values={'image': 'link1'}, pool_id='1'),
    toloka.task.Task(input_values={'image': 'link2'}, pool_id='1')
]
tasks_op = toloka_client.create_tasks_async(training_tasks)
toloka_client.wait_operation(tasks_op)