Create pool

Create a pool in a project in Toloka.

Steps to follow

1. Import Toloka-Kit

Connect the Toloka-Kit library to your script.

import toloka.client as toloka

2. Instantiate TolokaClient

Replace the sample API key with your own one.

toloka_client = toloka.
TolokaClient
('PlaceYourRealApiKey_Here', 'PRODUCTION');

3. Specify pool parameters

First, specify the parameters you want your pool to have. In this example, we use the following pool settings:

  • the ID of the project in which the pool is created, find it out before creating the pool
  • the pool name you will see in the list and use to distinguish the pool from other ones
  • whether or not the pool can contain adult content
  • the date when the pool is going to expire and will be closed
  • the reward for the task suite specified in U.S. dollars
  • the maximum duration of the task suite completion available to Tolokers
  • whether or not the responses must be accepted automatically rather than reviewed manually
  • the overlap used for the pool

You can choose your own values or have your own set of the pool parameters. Refer to the Pool class page for more details.

from datetime import datetime


new_pool = toloka.pool.
Pool
(

project_id='83859',

private_name='First pool',

may_contain_adult_content=False,

will_expire=datetime(2030, 1, 1),

reward_per_assignment=0.05,

assignment_max_duration_seconds=60*5,

auto_accept_solutions=False,

defaults=toloka.pool.Pool.Defaults(default_overlap_for_new_task_suites=1)

)
Important

All the code manipulations at step 3 occur in your device memory. The data will only be sent to the server after calling the create_pool() method at step 4.

4. Create pool on platform

This actually creates a pool in Toloka.

new_pool = toloka_client.
create_pool
(new_pool)

5. Print created pool ID

The create_pool() request will return the Pool class object. You can use its attributes to print the information you need.

print(new_pool.id)

You should get an output with the created pool ID which looks like this.

1440972

Complete code: Create pool

import toloka.client as toloka
from datetime import datetime
toloka_client = toloka.TolokaClient('PlaceYourRealApiKey_Here', 'PRODUCTION')
new_pool = toloka.pool.Pool(
project_id='83859',
private_name='First pool',
may_contain_adult_content=False,
will_expire=datetime(2030, 1, 1),
reward_per_assignment=0.05,
assignment_max_duration_seconds=60*5,
auto_accept_solutions=False,
defaults=toloka.pool.Pool.Defaults(default_overlap_for_new_task_suites=1)
)
new_pool = toloka_client.create_pool(new_pool)
print(new_pool.id)
List of classes and methods used in this recipe

See also

Last updated: February 7, 2023

Toloka-Kit
OverviewGetting API keyQuick start
Recipes
Reference
toloka.client
toloka.async_client
toloka.autoquality [autoquality]
toloka.metrics
toloka.streaming