Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] toloka-kit==1.2.2 not compatible with tenacity==8.4.3 #245

Open
vikmary opened this issue Jun 28, 2024 · 1 comment
Open

[BUG] toloka-kit==1.2.2 not compatible with tenacity==8.4.3 #245

vikmary opened this issue Jun 28, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@vikmary
Copy link

vikmary commented Jun 28, 2024

Observed behavior

TolokaClient.get_app_items() throws an error for toloka-kit==1.2.2 and tenacity==8.4.3. [setup.py] restricts tenacity to just >=7.0.0 which is too mild. Previously tenacity==8.4.1 didn't cause such an error.

Added minimal example to reproduce.

Expected behavior

No response

Python Version

3.9

Toloka-Kit Version

1.2.2

Other Packages Versions

tenacity==8.4.3

Example code

import toloka.client

toloka_client = toloka.client.TolokaClient(<api-token>, <environment>)
items = toloka_client.get_app_items(app_project_id=<project_id>, batch_id=None, status=None)
items = [item for item in items]

Relevant log output

[2024-06-27, 00:14:55 UTC] {pod_manager.py:466} INFO - [base]   File "toloka_api.py", line 6, in <listcomp>
[2024-06-27, 00:14:55 UTC] {pod_manager.py:466} INFO - [base]     items = [item for item in items]
[2024-06-27, 00:14:55 UTC] {pod_manager.py:466} INFO - [base]   File "/usr/local/lib/python3.10/dist-packages/toloka/util/_codegen.py", line 46, in wrapped
[2024-06-27, 00:14:55 UTC] {pod_manager.py:466} INFO - [base]     yield from decorated_func(*args, **kwargs)
[2024-06-27, 00:14:55 UTC] {pod_manager.py:466} INFO - [base]   File "/usr/local/lib/python3.10/dist-packages/toloka/util/_codegen.py", line 46, in wrapped
[2024-06-27, 00:14:55 UTC] {pod_manager.py:466} INFO - [base]     yield from decorated_func(*args, **kwargs)
[2024-06-27, 00:14:55 UTC] {pod_manager.py:466} INFO - [base]   File "/usr/local/lib/python3.10/dist-packages/toloka/util/_managing_headers.py", line 112, in gen
[2024-06-27, 00:14:55 UTC] {pod_manager.py:466} INFO - [base]     item = result.__next__()
[2024-06-27, 00:14:55 UTC] {pod_manager.py:466} INFO - [base]   File "/usr/local/lib/python3.10/dist-packages/toloka/client/__init__.py", line 4289, in get_app_batches
[2024-06-27, 00:14:55 UTC] {pod_manager.py:466} INFO - [base]     yield from generator
[2024-06-27, 00:14:55 UTC] {pod_manager.py:466} INFO - [base]   File "/usr/local/lib/python3.10/dist-packages/toloka/client/__init__.py", line 410, in _find_all
[2024-06-27, 00:14:55 UTC] {pod_manager.py:466} INFO - [base]     result = find_function(request, sort=[sort_field], limit=batch_size)
[2024-06-27, 00:14:55 UTC] {pod_manager.py:466} INFO - [base]   File "/usr/local/lib/python3.10/dist-packages/toloka/util/_codegen.py", line 307, in wrapped
[2024-06-27, 00:14:55 UTC] {pod_manager.py:466} INFO - [base]     return func(*args, **kwargs)
[2024-06-27, 00:14:55 UTC] {pod_manager.py:466} INFO - [base]   File "/usr/local/lib/python3.10/dist-packages/toloka/util/_managing_headers.py", line 73, in wrapped
[2024-06-27, 00:14:55 UTC] {pod_manager.py:466} INFO - [base]     return run_in_current_context(func, *args, **kwargs)
[2024-06-27, 00:14:55 UTC] {pod_manager.py:466} INFO - [base]   File "/usr/local/lib/python3.10/dist-packages/toloka/util/_managing_headers.py", line 100, in run_in_current_context
[2024-06-27, 00:14:55 UTC] {pod_manager.py:466} INFO - [base]     result = func(*args, **kwargs)
[2024-06-27, 00:14:55 UTC] {pod_manager.py:466} INFO - [base]   File "/usr/local/lib/python3.10/dist-packages/toloka/client/__init__.py", line 4253, in find_app_batches
[2024-06-27, 00:14:55 UTC] {pod_manager.py:466} INFO - [base]     response = self._search_request('get', f'/app/v0/app-projects/{app_project_id}/batches', request, sort, limit)
[2024-06-27, 00:14:55 UTC] {pod_manager.py:466} INFO - [base]   File "/usr/local/lib/python3.10/dist-packages/toloka/client/__init__.py", line 407, in _search_request
[2024-06-27, 00:14:55 UTC] {pod_manager.py:466} INFO - [base]     return self._request(method, path, params=params)
[2024-06-27, 00:14:55 UTC] {pod_manager.py:466} INFO - [base]   File "/usr/local/lib/python3.10/dist-packages/toloka/client/__init__.py", line 399, in _request
[2024-06-27, 00:14:55 UTC] {pod_manager.py:466} INFO - [base]     return self._raw_request(method, path, **kwargs).json(parse_float=Decimal)
[2024-06-27, 00:14:55 UTC] {pod_manager.py:466} INFO - [base]   File "/usr/local/lib/python3.10/dist-packages/toloka/client/__init__.py", line 395, in _raw_request
[2024-06-27, 00:14:55 UTC] {pod_manager.py:466} INFO - [base]     response = self._do_request_with_retries(method, f'/api{path}', **kwargs)
[2024-06-27, 00:14:55 UTC] {pod_manager.py:466} INFO - [base]   File "/usr/local/lib/python3.10/dist-packages/toloka/client/__init__.py", line 361, in _do_request_with_retries
[2024-06-27, 00:14:55 UTC] {pod_manager.py:466} INFO - [base]     return wrapped(method, path, **kwargs)
[2024-06-27, 00:14:55 UTC] {pod_manager.py:466} INFO - [base]   File "/usr/local/lib/python3.10/dist-packages/tenacity/__init__.py", line 334, in wrapped_f
[2024-06-27, 00:14:55 UTC] {pod_manager.py:466} INFO - [base]     copy = self.copy()
[2024-06-27, 00:14:55 UTC] {pod_manager.py:466} INFO - [base]   File "/usr/local/lib/python3.10/dist-packages/tenacity/__init__.py", line 260, in copy
[2024-06-27, 00:14:55 UTC] {pod_manager.py:466} INFO - [base]     return self.__class__(
[2024-06-27, 00:14:57 UTC] {pod_manager.py:483} INFO - [base] TypeError: RetryingOverURLLibRetry.__init__() missing 1 required positional argument: 'base_url'
@vikmary vikmary added the bug Something isn't working label Jun 28, 2024
@machinehead
Copy link

machinehead commented Sep 18, 2024

Looks like this issue should've been fixed in toloka-kit==1.2.3 with this MR #246 ?

Hmm nevermind, I believe I might have a better solution for this issue than just pinning down tenacity < 8.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants