Toloka / toloka-kit

Toloka-Kit is a Python library for working with Toloka API.
https://toloka.ai
Other
199 stars 34 forks source link

[BUG] ValidationApiError in collab example for SANDBOX #229

Open A-n-d-r-e-w-y opened 12 months ago

A-n-d-r-e-w-y commented 12 months ago

Observed behavior

I got error while run tutorial in collab https://colab.research.google.com/github/Toloka/toloka-kit/blob/main/examples/3.audio_analysis/audio_collection/audio_collection.ipynb I choice "SANDBOX" and click all cells. All cells are success before uploading tasks:

tasks = [ toloka.Task(input_values={'text': text}, pool_id=new_pool.id) for text in dataset['text'].values[:20] ]

toloka_client.create_tasks(tasks, allow_defaults=True)

new_pool = toloka_client.open_pool(new_pool.id)

Expected behavior

22.08.23 all works and all tasks were uploaded to pool

Python Version

3.8

Toloka-Kit Version

0.1.26

Other Packages Versions

No response

Example code

https://colab.research.google.com/github/Toloka/toloka-kit/blob/main/examples/3.audio_analysis/audio_collection/audio_collection.ipynb

SANDBOX is used

Relevant log output

ValidationApiError                        Traceback (most recent call last)
<ipython-input-24-3500c0c72b11> in <cell line: 6>()
      4 ]
      5 
----> 6 toloka_client.create_tasks(tasks, allow_defaults=True)
      7 
      8 new_pool = toloka_client.open_pool(new_pool.id)

3 frames
create_tasks_expanded_by_parameters_b78c00ecf9034a73a33a8233fe58069a in create_tasks_expanded_by_parameters(self, tasks, allow_defaults, open_pool, skip_invalid_items, operation_id, async_mode)
      2 
      3     parameters = CreateTasksParameters(allow_defaults=allow_defaults, open_pool=open_pool, skip_invalid_items=skip_invalid_items, operation_id=operation_id, async_mode=async_mode)
----> 4     return func(self, tasks, parameters)

/usr/local/lib/python3.10/dist-packages/toloka/client/__init__.py in _sync_via_async(self, objects, parameters, url, result_type, operation_type, output_id_field, get_method)
    374         # but no objects are created
    375         if not pools:
--> 376             raise ValidationApiError(
    377                 code='VALIDATION_ERROR',
    378                 message='Validation failed',

ValidationApiError: ValidationApiError(status_code=None, request_id=None, code='VALIDATION_ERROR', message='Validation failed', payload={})
Pocoder commented 12 months ago

@A-n-d-r-e-w-y Hello! I could not reproduce the problem. Please, upgrade version of toloka-kit from 0.1.26 to 1.1.4 and repeat all notebook steps from the start. If the problem will still be there text me.

A-n-d-r-e-w-y commented 11 months ago

Hello! I think problem that in SANDBOX mode requester has some limit to create tasks. It's not obviously!!! And i get message when turn off async mode:

toloka.client.exceptions.ApiError: ApiError(status_code=400, request_id='1692879848820059-739373765838409776', code='TASKS_CREATION_DOES_NOT_FIT_QUOTA', message='Tasks creation does not fit quota', payload=None) By default async mode is used to upload tasks and async mode don't show any message(

What does mean "Tasks creation does not fit quota" ? What is limit to create tasks for SANDBOX mode and can I delete my old projects with tasks from SANDBOX to create new tasks?

Pocoder commented 11 months ago

How many tasks do you try to create (more than 10k/5k)? You can find limits in create_tasks/create_tasks_async method docstring and here: https://toloka.ai/docs/api/api-reference/#overview--using-toloka-sdk