From 82928bcbb80afa60f9a179d1b5d70fef12bf7c3c Mon Sep 17 00:00:00 2001 From: Evgeny Tulin Date: Thu, 18 Mar 2021 17:28:17 +0300 Subject: [PATCH 1/4] fix problem with Task and TaskSuite adding ref:801cff472bfb6cdd9d319b6501e2454c37cd3d8f --- src/client/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/client/__init__.py b/src/client/__init__.py index a1e10851..fe7653de 100644 --- a/src/client/__init__.py +++ b/src/client/__init__.py @@ -134,8 +134,8 @@ def _synch_via_asynch(self, objects, parameters, url, result_type, operation_typ # Emulates synchronous operation, through asynchronous calls and reading operation logs. client_uuid_to_index = {} for i, obj in enumerate(objects): - obj.__client_uuid = uuid.uuid4().hex - client_uuid_to_index[obj.__client_uuid] = str(i) + obj._unexpected['__client_uuid'] = uuid.uuid4().hex + client_uuid_to_index[obj._unexpected['__client_uuid']] = str(i) response = self._request('post', url, json=unstructure(objects), params=unstructure(parameters)) insert_operation = structure(response, operation_type) From 4006e834e992b4920a9ca9c060705190fab5d46f Mon Sep 17 00:00:00 2001 From: Vladimir Losev Date: Fri, 19 Mar 2021 14:38:12 +0300 Subject: [PATCH 2/4] toloka-kit 0.1.5 release ref:3e21b95e74aa33052c4b8e23c99d13be2a1b0eec --- CHANGELOG.rst | 4 ++++ src/client/__version__.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 60569ab0..6b0f42fa 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,3 +1,7 @@ +0.1.5 +------------------- +Fixing issues with `create_tasks` and `create_task_suites` + 0.1.4 ------------------- * Implemented a `clone_project` method diff --git a/src/client/__version__.py b/src/client/__version__.py index a7a1e8c5..ffb12cf5 100644 --- a/src/client/__version__.py +++ b/src/client/__version__.py @@ -1,3 +1,3 @@ __title__ = 'toloka-kit' -__version__ = '0.1.4' +__version__ = '0.1.5' __license__ = 'Apache 2.0' From 0f7b353abc65e02c359b8cde51930032dabd4101 Mon Sep 17 00:00:00 2001 From: Evgeny Tulin Date: Fri, 19 Mar 2021 17:42:53 +0300 Subject: [PATCH 3/4] fix pool opening problem ref:f7f29063f37fdcfd7fb60382ad43dd33cca8d73b --- src/client/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/client/__init__.py b/src/client/__init__.py index fe7653de..2c670a41 100644 --- a/src/client/__init__.py +++ b/src/client/__init__.py @@ -146,6 +146,8 @@ def _synch_via_asynch(self, objects, parameters, url, result_type, operation_typ validation_errors = {} for log_item in self.get_operation_log(insert_operation.id): + if log_item.type not in ['TASK_CREATE', 'TASK_VALIDATE', 'TASK_SUITE_VALIDATE', 'TASK_SUITE_CREATE']: + continue index = client_uuid_to_index[log_item.input['__client_uuid']] if log_item.success: numerated_ids = pools.setdefault(log_item.input['pool_id'], {}) From 0112b9d24d5c2a7d34eb12f447c20885ee34c95d Mon Sep 17 00:00:00 2001 From: Evgeny Tulin Date: Fri, 19 Mar 2021 22:38:09 +0300 Subject: [PATCH 4/4] tests for async operation ref:f698962180f1435ca83740153d094c5186c9b279 --- tests/test_task.py | 3 ++- tests/test_task_suite.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/test_task.py b/tests/test_task.py index a5b3e47c..d18d25e4 100644 --- a/tests/test_task.py +++ b/tests/test_task.py @@ -258,7 +258,8 @@ def check_tasks(request, context): } == parse_qs(urlparse(request.url).query) imcoming_tasks = [] for t in request.json(): - t.pop('__client_uuid', '') + assert '__client_uuid' in t + t.pop('__client_uuid') imcoming_tasks.append(t) assert tasks_map == imcoming_tasks return operation_running_map diff --git a/tests/test_task_suite.py b/tests/test_task_suite.py index ab5b513e..67868e8f 100644 --- a/tests/test_task_suite.py +++ b/tests/test_task_suite.py @@ -235,7 +235,8 @@ def check_task_suites(request, context): } == parse_qs(urlparse(request.url).query) imcoming_task_suites = [] for t in request.json(): - t.pop('__client_uuid', '') + assert '__client_uuid' in t + t.pop('__client_uuid') imcoming_task_suites.append(t) assert task_suites_map == imcoming_task_suites return operation_running_map