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/__init__.py b/src/client/__init__.py index a1e10851..2c670a41 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) @@ -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'], {}) 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' 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