From 2eba398adccd0ba5398633e1daf920c3c70d0db7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Merc=C3=A8=20Mart=C3=ADn=20Prats?= Date: Fri, 21 Mar 2025 13:43:32 +0100 Subject: [PATCH 1/9] Improving composite annotations uploads process --- HISTORY.rst | 6 ++++++ bigml/api_handlers/sourcehandler.py | 32 ++++++++++++++++++++++++++--- bigml/bigmlconnection.py | 8 ++++---- bigml/version.py | 2 +- 4 files changed, 40 insertions(+), 8 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index e4bd9d7d..63308907 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -3,6 +3,12 @@ History ------- +9.8.2 (2025-03-21) +------------------ + +- Retrying annotations update to avoid temporary concurrency issues in + source composites updates. + 9.8.1 (2025-01-14) ------------------ diff --git a/bigml/api_handlers/sourcehandler.py b/bigml/api_handlers/sourcehandler.py index 8f3568ea..6106fe82 100644 --- a/bigml/api_handlers/sourcehandler.py +++ b/bigml/api_handlers/sourcehandler.py @@ -24,6 +24,8 @@ import sys import os import numbers +import time +import logging from urllib import parse @@ -67,8 +69,13 @@ from bigml.api_handlers.resourcehandler import ResourceHandlerMixin, LOGGER from bigml.fields import Fields +LOG_FORMAT = '%(asctime)-15s: %(message)s' +LOGGER = logging.getLogger('BigML') +CONSOLE = logging.StreamHandler() +CONSOLE.setLevel(logging.WARNING) +LOGGER.addHandler(CONSOLE) -MAX_CHANGES = 500 +MAX_CHANGES = 5 def compact_regions(regions): @@ -508,6 +515,8 @@ def update_composite_annotations(self, source, images_file, try: _ = file_list.index(filename) except ValueError: + LOGGER.error("WARNING: Could not find annotated file (%s)" + " in the composite's sources list", filename) continue for key in annotation.keys(): if key == "file": @@ -550,16 +559,33 @@ def update_composite_annotations(self, source, images_file, "value": value, "components": [source_id]}) except Exception: + LOGGER.error("WARNING: Problem adding annotation to %s (%s)", + field, values) pass # we need to limit the amount of changes per update batches_number = int(len(changes) / MAX_CHANGES) for offset in range(0, batches_number + 1): - new_batch = changes[offset * MAX_CHANGES: (offset + 1) * MAX_CHANGES] + new_batch = changes[ + offset * MAX_CHANGES: (offset + 1) * MAX_CHANGES] if new_batch: source = self.update_source(source, {"row_values": new_batch}) - self.ok(source) + if source["error"] is not None: + # retrying in case update is temporarily unavailable + time.sleep(1) + source = self.get_source(source) + self.ok(source) + source = self.update_source(source, + {"row_values": new_batch}) + if source["error"] is not None: + LOGGER.error("WARNING: Some annotations were not" + " updated (%s)", + new_batch) + if not self.ok(source): + raise Exception( + f"Failed to update {len(new_batch)} annotations.") + time.sleep(0.1) return source diff --git a/bigml/bigmlconnection.py b/bigml/bigmlconnection.py index a5a796c5..c1b337f0 100644 --- a/bigml/bigmlconnection.py +++ b/bigml/bigmlconnection.py @@ -406,7 +406,7 @@ def _create(self, url, body, verify=None, organization=None): error = json_load(response.content) LOGGER.error(self.error_message(error, method='create')) elif code != HTTP_ACCEPTED: - LOGGER.error("Unexpected error (%s)", code) + LOGGER.error("CREATE Unexpected error (%s)", code) code = HTTP_INTERNAL_SERVER_ERROR except ValueError as exc: LOGGER.error("Malformed response: %s", str(exc)) @@ -489,7 +489,7 @@ def _get(self, url, query_string='', LOGGER.error(self.error_message(error, method='get', resource_id=resource_id)) else: - LOGGER.error("Unexpected error (%s)", code) + LOGGER.error("GET Unexpected error (%s)", code) code = HTTP_INTERNAL_SERVER_ERROR except ValueError as exc: @@ -582,7 +582,7 @@ def _list(self, url, query_string='', organization=None): HTTP_TOO_MANY_REQUESTS]: error = json_load(response.content) else: - LOGGER.error("Unexpected error (%s)", code) + LOGGER.error("LIST Unexpected error (%s)", code) code = HTTP_INTERNAL_SERVER_ERROR except ValueError as exc: LOGGER.error("Malformed response: %s", str(exc)) @@ -662,7 +662,7 @@ def _update(self, url, body, organization=None, resource_id=None): LOGGER.error(self.error_message(error, method='update', resource_id=resource_id)) else: - LOGGER.error("Unexpected error (%s)", code) + LOGGER.error("UPDATE Unexpected error (%s)", code) code = HTTP_INTERNAL_SERVER_ERROR except ValueError: LOGGER.error("Malformed response") diff --git a/bigml/version.py b/bigml/version.py index d33e46a3..977225b8 100644 --- a/bigml/version.py +++ b/bigml/version.py @@ -1 +1 @@ -__version__ = '9.8.1' +__version__ = '9.8.2' From 7763ddff816ccdb6c7820ea6da92a5f68759977a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Merc=C3=A8=20Mart=C3=ADn=20Prats?= Date: Fri, 21 Mar 2025 18:23:31 +0100 Subject: [PATCH 2/9] Adding test for annotations upload --- bigml/api_handlers/sourcehandler.py | 5 +++- bigml/tests/create_dataset_steps.py | 13 ++++++++++ bigml/tests/test_22_source_args.py | 36 ++++++++++++++++++++++++++++ data/images/annotations_compact.json | 2 ++ data/images/metadata_compact.json | 5 ++++ 5 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 data/images/annotations_compact.json create mode 100644 data/images/metadata_compact.json diff --git a/bigml/api_handlers/sourcehandler.py b/bigml/api_handlers/sourcehandler.py index 6106fe82..e2e711ea 100644 --- a/bigml/api_handlers/sourcehandler.py +++ b/bigml/api_handlers/sourcehandler.py @@ -548,9 +548,12 @@ def update_composite_annotations(self, source, images_file, "components": source_ids}) elif optype == "regions": for value, source_id in values: + if isinstance(value, dict): + # dictionary should contain the bigml-coco format + value = compact_regions(value) changes.append( {"field": field, - "value": compact_regions(value), + "value": value, "components": [source_id]}) else: for value, source_id in values: diff --git a/bigml/tests/create_dataset_steps.py b/bigml/tests/create_dataset_steps.py index a04d854a..b341ba51 100644 --- a/bigml/tests/create_dataset_steps.py +++ b/bigml/tests/create_dataset_steps.py @@ -222,3 +222,16 @@ def clone_dataset(step, dataset): def the_cloned_dataset_is(step, dataset): """Checking the dataset is a clone""" eq_(world.dataset["origin"], dataset) + + +def check_annotations(step, annotations_field, annotations_num): + """Checking the dataset contains a number of annotations""" + annotations_num = int(annotations_num) + field = world.dataset["fields"][annotations_field] + if field["optype"] == "regions": + count = field["summary"]["regions"]["sum"] + else: + count = 0 + for _, num in field["summary"]["categories"]: + count += num + eq_(count, annotations_num) diff --git a/bigml/tests/test_22_source_args.py b/bigml/tests/test_22_source_args.py index 478a0959..8fe3567e 100644 --- a/bigml/tests/test_22_source_args.py +++ b/bigml/tests/test_22_source_args.py @@ -25,6 +25,7 @@ from .world import world, setup_module, teardown_module, show_doc, \ show_method from . import create_source_steps as source_create +from . import create_dataset_steps as dataset_create class TestUploadSource: @@ -125,3 +126,38 @@ def test_scenario3(self): source_create.the_source_is_finished( self, example["source_wait"]) source_create.the_cloned_source_origin_is(self, source) + + def test_scenario4(self): + """ + Scenario: Successfully adding annotatations to composite source: + Given I create an annotated images data source uploading a "" file + And I wait until the source is ready less than secs + And I create a dataset + And I wait until the dataset is ready less than secs + Then the new dataset has annotations in the field + """ + headers = ["data", "source_wait", "dataset_wait", "annotations_num", + "annotations_field"] + examples = [ + ['data/images/metadata.json', '500', '500', '12', + '100002'], + ['data/images/metadata_compact.json', '500', '500', '3', + '100003']] + show_doc(self.test_scenario4) + for example in examples: + example = dict(zip(headers, example)) + show_method(self, self.bigml["method"], example) + source_create.i_create_annotated_source( + self, + example["data"], + args={"image_analysis": {"enabled": False, + "extracted_features": []}}) + source_create.the_source_is_finished( + self, example["source_wait"]) + dataset_create.i_create_a_dataset(self) + dataset_create.the_dataset_is_finished_in_less_than( + self, example["dataset_wait"]) + dataset_create.check_annotations(self, + example["annotations_field"], + example["annotations_num"]) + diff --git a/data/images/annotations_compact.json b/data/images/annotations_compact.json new file mode 100644 index 00000000..294de440 --- /dev/null +++ b/data/images/annotations_compact.json @@ -0,0 +1,2 @@ +[{"file": "f1/fruits1f.png", "my_regions": "[[\"region1\" 0.2 0.2 0.4 0.4]]"}, + {"file": "f1/fruits1.png", "my_regions": "[[\"region2\" 0.3 0.3 0.5 0.5] [\"region1\" 0.6 0.6 0.8 0.8]]"}] diff --git a/data/images/metadata_compact.json b/data/images/metadata_compact.json new file mode 100644 index 00000000..45db412f --- /dev/null +++ b/data/images/metadata_compact.json @@ -0,0 +1,5 @@ +{"description": "Fruit images to test colour distributions with regions", + "images_file": "./fruits_hist.zip", + "new_fields": [{"name": "my_regions", "optype": "regions"}], + "source_id": null, + "annotations": "./annotations_compact.json"} From 6ec7ec44622caba400ca7afb432054cda847b97f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Merc=C3=A8=20Mart=C3=ADn=20Prats?= Date: Fri, 21 Mar 2025 18:30:43 +0100 Subject: [PATCH 3/9] Bump setuptools to 70.0.0 --- setup.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index adcd3b08..c7858b6c 100644 --- a/setup.py +++ b/setup.py @@ -50,7 +50,8 @@ download_url="https://github.com/bigmlcom/python", license="http://www.apache.org/licenses/LICENSE-2.0", setup_requires = ['pytest'], - install_requires = ["setuptools==69.0.0", "unidecode", "bigml-chronos>=0.4.3", "requests", + install_requires = ["setuptools==70.0.0", "unidecode", + "bigml-chronos>=0.4.3", "requests", "requests-toolbelt", "msgpack", "numpy>=1.22", "scipy", "javascript"], extras_require={"images": IMAGES_DEPENDENCIES, From fa6ed76528544802199eef360ed184d10d5b4570 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Merc=C3=A8=20Mart=C3=ADn=20Prats?= Date: Fri, 21 Mar 2025 19:19:34 +0100 Subject: [PATCH 4/9] Adding more retries to annotations update function --- bigml/api_handlers/sourcehandler.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/bigml/api_handlers/sourcehandler.py b/bigml/api_handlers/sourcehandler.py index e2e711ea..24d24733 100644 --- a/bigml/api_handlers/sourcehandler.py +++ b/bigml/api_handlers/sourcehandler.py @@ -76,7 +76,7 @@ LOGGER.addHandler(CONSOLE) MAX_CHANGES = 5 - +MAX_RETRIES = 5 def compact_regions(regions): """Returns the list of regions in the compact value used for updates """ @@ -573,18 +573,20 @@ def update_composite_annotations(self, source, images_file, offset * MAX_CHANGES: (offset + 1) * MAX_CHANGES] if new_batch: source = self.update_source(source, - {"row_values": new_batch}) - if source["error"] is not None: + {"row_values": new_batch})+ + counter = 0 + while source["error"] is not None and counter < MAX_RETRIES: # retrying in case update is temporarily unavailable - time.sleep(1) + counter += 1 + time.sleep(counter) source = self.get_source(source) self.ok(source) source = self.update_source(source, {"row_values": new_batch}) - if source["error"] is not None: - LOGGER.error("WARNING: Some annotations were not" - " updated (%s)", - new_batch) + if source["error"] is not None: + LOGGER.error("WARNING: Some annotations were not" + " updated (%s)", + new_batch) if not self.ok(source): raise Exception( f"Failed to update {len(new_batch)} annotations.") From db2f057e86f684a70696de4f98276b792052868f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Merc=C3=A8=20Mart=C3=ADn=20Prats?= Date: Fri, 21 Mar 2025 19:21:11 +0100 Subject: [PATCH 5/9] Removing typo --- bigml/api_handlers/sourcehandler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bigml/api_handlers/sourcehandler.py b/bigml/api_handlers/sourcehandler.py index 24d24733..a0747ac3 100644 --- a/bigml/api_handlers/sourcehandler.py +++ b/bigml/api_handlers/sourcehandler.py @@ -573,7 +573,7 @@ def update_composite_annotations(self, source, images_file, offset * MAX_CHANGES: (offset + 1) * MAX_CHANGES] if new_batch: source = self.update_source(source, - {"row_values": new_batch})+ + {"row_values": new_batch}) counter = 0 while source["error"] is not None and counter < MAX_RETRIES: # retrying in case update is temporarily unavailable From a17f88f95321261b2fab59ebe6dab58fd505b8c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Merc=C3=A8=20Mart=C3=ADn=20Prats?= Date: Fri, 21 Mar 2025 19:40:25 +0100 Subject: [PATCH 6/9] Improving error message for annotations updates --- bigml/api_handlers/sourcehandler.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bigml/api_handlers/sourcehandler.py b/bigml/api_handlers/sourcehandler.py index a0747ac3..71863b34 100644 --- a/bigml/api_handlers/sourcehandler.py +++ b/bigml/api_handlers/sourcehandler.py @@ -584,9 +584,10 @@ def update_composite_annotations(self, source, images_file, source = self.update_source(source, {"row_values": new_batch}) if source["error"] is not None: - LOGGER.error("WARNING: Some annotations were not" - " updated (%s)", - new_batch) + err_str = json.dumps(source["error"]) + v_str = json.dumps(new_batch) + LOGGER.error("WARNING: Some annotations were not updated " + f" (error: {err_str}, values: {v_str})") if not self.ok(source): raise Exception( f"Failed to update {len(new_batch)} annotations.") From 893e412be494fe5520318cf76034ef455374b518 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Merc=C3=A8=20Mart=C3=ADn=20Prats?= Date: Sat, 22 Mar 2025 01:25:41 +0100 Subject: [PATCH 7/9] Ensuring updates are finished before testing --- bigml/tests/create_association_steps.py | 1 + bigml/tests/create_cluster_steps.py | 1 + bigml/tests/create_configuration_steps.py | 1 + bigml/tests/create_correlation_steps.py | 1 + bigml/tests/create_dataset_steps.py | 1 + bigml/tests/create_execution_steps.py | 1 + bigml/tests/create_lda_steps.py | 1 + bigml/tests/create_linear_steps.py | 1 + bigml/tests/create_model_steps.py | 1 + bigml/tests/create_pca_steps.py | 1 + bigml/tests/create_project_steps.py | 1 + bigml/tests/create_sample_steps.py | 1 + bigml/tests/create_script_steps.py | 1 + bigml/tests/create_source_steps.py | 1 + bigml/tests/create_statistical_tst_steps.py | 1 + bigml/tests/create_time_series_steps.py | 1 + 16 files changed, 16 insertions(+) diff --git a/bigml/tests/create_association_steps.py b/bigml/tests/create_association_steps.py index b54cd9be..ab222f50 100644 --- a/bigml/tests/create_association_steps.py +++ b/bigml/tests/create_association_steps.py @@ -79,6 +79,7 @@ def i_update_association_name(step, name): {'name': name}) world.status = resource['code'] eq_(world.status, HTTP_ACCEPTED) + world.api.ok(resource) world.location = resource['location'] world.association = resource['object'] diff --git a/bigml/tests/create_cluster_steps.py b/bigml/tests/create_cluster_steps.py index f6c9e002..cf1f0731 100644 --- a/bigml/tests/create_cluster_steps.py +++ b/bigml/tests/create_cluster_steps.py @@ -93,6 +93,7 @@ def make_the_cluster_shared(step): {'shared': True}) world.status = resource['code'] eq_(world.status, HTTP_ACCEPTED) + world.api.ok(resource) world.location = resource['location'] world.cluster = resource['object'] diff --git a/bigml/tests/create_configuration_steps.py b/bigml/tests/create_configuration_steps.py index 5116986d..d3070082 100644 --- a/bigml/tests/create_configuration_steps.py +++ b/bigml/tests/create_configuration_steps.py @@ -39,6 +39,7 @@ def i_update_configuration(step, changes): world.configuration["resource"], changes) world.status = resource['code'] eq_(world.status, HTTP_ACCEPTED) + world.api.ok(resource) world.location = resource['location'] world.configuration = resource['object'] diff --git a/bigml/tests/create_correlation_steps.py b/bigml/tests/create_correlation_steps.py index c5421c6b..ede2c47a 100644 --- a/bigml/tests/create_correlation_steps.py +++ b/bigml/tests/create_correlation_steps.py @@ -43,6 +43,7 @@ def i_update_correlation_name(step, name): {'name': name}) world.status = resource['code'] eq_(world.status, HTTP_ACCEPTED) + world.api.ok(resource) world.location = resource['location'] world.correlation = resource['object'] diff --git a/bigml/tests/create_dataset_steps.py b/bigml/tests/create_dataset_steps.py index b341ba51..e62b07a6 100644 --- a/bigml/tests/create_dataset_steps.py +++ b/bigml/tests/create_dataset_steps.py @@ -89,6 +89,7 @@ def make_the_dataset_public(step): {'private': False}) world.status = resource['code'] eq_(world.status, HTTP_ACCEPTED) + world.api.ok(resource) world.location = resource['location'] world.dataset = resource['object'] diff --git a/bigml/tests/create_execution_steps.py b/bigml/tests/create_execution_steps.py index 6d4d69a6..d8716501 100644 --- a/bigml/tests/create_execution_steps.py +++ b/bigml/tests/create_execution_steps.py @@ -78,6 +78,7 @@ def i_update_an_execution(step, param, param_value): {param: param_value}) world.status = resource['code'] eq_(world.status, HTTP_ACCEPTED) + world.api.ok(resource) world.location = resource['location'] world.execution = resource['object'] diff --git a/bigml/tests/create_lda_steps.py b/bigml/tests/create_lda_steps.py index cd06ac96..60bdc1d7 100644 --- a/bigml/tests/create_lda_steps.py +++ b/bigml/tests/create_lda_steps.py @@ -72,6 +72,7 @@ def i_update_topic_model_name(step, name): {'name': name}) world.status = resource['code'] eq_(world.status, HTTP_ACCEPTED) + world.api.ok(resource) world.location = resource['location'] world.topic_model = resource['object'] diff --git a/bigml/tests/create_linear_steps.py b/bigml/tests/create_linear_steps.py index 88fae1b9..5e4106d4 100644 --- a/bigml/tests/create_linear_steps.py +++ b/bigml/tests/create_linear_steps.py @@ -79,6 +79,7 @@ def i_update_linear_regression_name(step, name): {'name': name}) world.status = resource['code'] eq_(world.status, HTTP_ACCEPTED) + world.api.ok(resource) world.location = resource['location'] world.linear_regression = resource['object'] diff --git a/bigml/tests/create_model_steps.py b/bigml/tests/create_model_steps.py index 811daf30..219e891b 100644 --- a/bigml/tests/create_model_steps.py +++ b/bigml/tests/create_model_steps.py @@ -410,6 +410,7 @@ def i_update_optiml_name(step, name): {'name': name}) world.status = resource['code'] eq_(world.status, HTTP_ACCEPTED) + world.api.ok(resource) world.location = resource['location'] world.optiml = resource['object'] diff --git a/bigml/tests/create_pca_steps.py b/bigml/tests/create_pca_steps.py index c5a8ff09..e4b6da59 100644 --- a/bigml/tests/create_pca_steps.py +++ b/bigml/tests/create_pca_steps.py @@ -65,6 +65,7 @@ def i_update_pca_name(step, name): {'name': name}) world.status = resource['code'] eq_(world.status, HTTP_ACCEPTED) + world.api.ok(resource) world.location = resource['location'] world.pca = resource['object'] diff --git a/bigml/tests/create_project_steps.py b/bigml/tests/create_project_steps.py index 3d997bfe..604c187f 100644 --- a/bigml/tests/create_project_steps.py +++ b/bigml/tests/create_project_steps.py @@ -44,6 +44,7 @@ def i_update_project_name_with(step, name=""): {"name": name}) world.status = resource['code'] eq_(world.status, HTTP_ACCEPTED) + world.api.ok(resource) world.project = resource['object'] diff --git a/bigml/tests/create_sample_steps.py b/bigml/tests/create_sample_steps.py index 8f451f4b..0f7de276 100644 --- a/bigml/tests/create_sample_steps.py +++ b/bigml/tests/create_sample_steps.py @@ -44,6 +44,7 @@ def i_update_sample_name(step, name): {'name': name}) world.status = resource['code'] eq_(world.status, HTTP_ACCEPTED) + world.api.ok(resource) world.location = resource['location'] world.sample = resource['object'] diff --git a/bigml/tests/create_script_steps.py b/bigml/tests/create_script_steps.py index cb7ab4ed..d6c68b78 100644 --- a/bigml/tests/create_script_steps.py +++ b/bigml/tests/create_script_steps.py @@ -63,6 +63,7 @@ def i_update_a_script(step, param, param_value): {param: param_value}) world.status = resource['code'] eq_(world.status, HTTP_ACCEPTED) + world.api.ok(resource) world.location = resource['location'] world.script = resource['object'] diff --git a/bigml/tests/create_source_steps.py b/bigml/tests/create_source_steps.py index 3eac296a..2709121c 100644 --- a/bigml/tests/create_source_steps.py +++ b/bigml/tests/create_source_steps.py @@ -210,6 +210,7 @@ def i_update_source_with(step, data="{}"): resource = world.api.update_source(world.source.get('resource'), json.loads(data)) world.status = resource['code'] eq_(world.status, HTTP_ACCEPTED) + world.api.ok(resource) def source_has_args(step, args="{}"): diff --git a/bigml/tests/create_statistical_tst_steps.py b/bigml/tests/create_statistical_tst_steps.py index 44e76dd4..29c0a132 100644 --- a/bigml/tests/create_statistical_tst_steps.py +++ b/bigml/tests/create_statistical_tst_steps.py @@ -45,6 +45,7 @@ def i_update_tst_name(step, name): world.statistical_test['resource'], {'name': name}) world.status = resource['code'] eq_(world.status, HTTP_ACCEPTED) + world.api.ok(resource) world.location = resource['location'] world.statistical_test = resource['object'] diff --git a/bigml/tests/create_time_series_steps.py b/bigml/tests/create_time_series_steps.py index d12fc2c8..bfeb40e7 100644 --- a/bigml/tests/create_time_series_steps.py +++ b/bigml/tests/create_time_series_steps.py @@ -66,6 +66,7 @@ def i_update_time_series_name(step, name): {'name': name}) world.status = resource['code'] eq_(world.status, HTTP_ACCEPTED) + world.api.ok(resource) world.location = resource['location'] world.time_series = resource['object'] From c6c36021f1c4e17f00c2de1a4951a41b4a345184 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Merc=C3=A8=20Mart=C3=ADn=20Prats?= Date: Wed, 26 Mar 2025 13:01:23 +0100 Subject: [PATCH 8/9] Reverting update changes --- bigml/tests/create_association_steps.py | 1 - bigml/tests/create_cluster_steps.py | 1 - bigml/tests/create_configuration_steps.py | 1 - bigml/tests/create_correlation_steps.py | 1 - bigml/tests/create_dataset_steps.py | 1 - bigml/tests/create_execution_steps.py | 1 - bigml/tests/create_lda_steps.py | 1 - bigml/tests/create_linear_steps.py | 1 - bigml/tests/create_model_steps.py | 1 - bigml/tests/create_pca_steps.py | 1 - bigml/tests/create_project_steps.py | 1 - bigml/tests/create_sample_steps.py | 1 - bigml/tests/create_script_steps.py | 1 - bigml/tests/create_source_steps.py | 1 - bigml/tests/create_statistical_tst_steps.py | 1 - bigml/tests/create_time_series_steps.py | 1 - 16 files changed, 16 deletions(-) diff --git a/bigml/tests/create_association_steps.py b/bigml/tests/create_association_steps.py index ab222f50..b54cd9be 100644 --- a/bigml/tests/create_association_steps.py +++ b/bigml/tests/create_association_steps.py @@ -79,7 +79,6 @@ def i_update_association_name(step, name): {'name': name}) world.status = resource['code'] eq_(world.status, HTTP_ACCEPTED) - world.api.ok(resource) world.location = resource['location'] world.association = resource['object'] diff --git a/bigml/tests/create_cluster_steps.py b/bigml/tests/create_cluster_steps.py index cf1f0731..f6c9e002 100644 --- a/bigml/tests/create_cluster_steps.py +++ b/bigml/tests/create_cluster_steps.py @@ -93,7 +93,6 @@ def make_the_cluster_shared(step): {'shared': True}) world.status = resource['code'] eq_(world.status, HTTP_ACCEPTED) - world.api.ok(resource) world.location = resource['location'] world.cluster = resource['object'] diff --git a/bigml/tests/create_configuration_steps.py b/bigml/tests/create_configuration_steps.py index d3070082..5116986d 100644 --- a/bigml/tests/create_configuration_steps.py +++ b/bigml/tests/create_configuration_steps.py @@ -39,7 +39,6 @@ def i_update_configuration(step, changes): world.configuration["resource"], changes) world.status = resource['code'] eq_(world.status, HTTP_ACCEPTED) - world.api.ok(resource) world.location = resource['location'] world.configuration = resource['object'] diff --git a/bigml/tests/create_correlation_steps.py b/bigml/tests/create_correlation_steps.py index ede2c47a..c5421c6b 100644 --- a/bigml/tests/create_correlation_steps.py +++ b/bigml/tests/create_correlation_steps.py @@ -43,7 +43,6 @@ def i_update_correlation_name(step, name): {'name': name}) world.status = resource['code'] eq_(world.status, HTTP_ACCEPTED) - world.api.ok(resource) world.location = resource['location'] world.correlation = resource['object'] diff --git a/bigml/tests/create_dataset_steps.py b/bigml/tests/create_dataset_steps.py index e62b07a6..b341ba51 100644 --- a/bigml/tests/create_dataset_steps.py +++ b/bigml/tests/create_dataset_steps.py @@ -89,7 +89,6 @@ def make_the_dataset_public(step): {'private': False}) world.status = resource['code'] eq_(world.status, HTTP_ACCEPTED) - world.api.ok(resource) world.location = resource['location'] world.dataset = resource['object'] diff --git a/bigml/tests/create_execution_steps.py b/bigml/tests/create_execution_steps.py index d8716501..6d4d69a6 100644 --- a/bigml/tests/create_execution_steps.py +++ b/bigml/tests/create_execution_steps.py @@ -78,7 +78,6 @@ def i_update_an_execution(step, param, param_value): {param: param_value}) world.status = resource['code'] eq_(world.status, HTTP_ACCEPTED) - world.api.ok(resource) world.location = resource['location'] world.execution = resource['object'] diff --git a/bigml/tests/create_lda_steps.py b/bigml/tests/create_lda_steps.py index 60bdc1d7..cd06ac96 100644 --- a/bigml/tests/create_lda_steps.py +++ b/bigml/tests/create_lda_steps.py @@ -72,7 +72,6 @@ def i_update_topic_model_name(step, name): {'name': name}) world.status = resource['code'] eq_(world.status, HTTP_ACCEPTED) - world.api.ok(resource) world.location = resource['location'] world.topic_model = resource['object'] diff --git a/bigml/tests/create_linear_steps.py b/bigml/tests/create_linear_steps.py index 5e4106d4..88fae1b9 100644 --- a/bigml/tests/create_linear_steps.py +++ b/bigml/tests/create_linear_steps.py @@ -79,7 +79,6 @@ def i_update_linear_regression_name(step, name): {'name': name}) world.status = resource['code'] eq_(world.status, HTTP_ACCEPTED) - world.api.ok(resource) world.location = resource['location'] world.linear_regression = resource['object'] diff --git a/bigml/tests/create_model_steps.py b/bigml/tests/create_model_steps.py index 219e891b..811daf30 100644 --- a/bigml/tests/create_model_steps.py +++ b/bigml/tests/create_model_steps.py @@ -410,7 +410,6 @@ def i_update_optiml_name(step, name): {'name': name}) world.status = resource['code'] eq_(world.status, HTTP_ACCEPTED) - world.api.ok(resource) world.location = resource['location'] world.optiml = resource['object'] diff --git a/bigml/tests/create_pca_steps.py b/bigml/tests/create_pca_steps.py index e4b6da59..c5a8ff09 100644 --- a/bigml/tests/create_pca_steps.py +++ b/bigml/tests/create_pca_steps.py @@ -65,7 +65,6 @@ def i_update_pca_name(step, name): {'name': name}) world.status = resource['code'] eq_(world.status, HTTP_ACCEPTED) - world.api.ok(resource) world.location = resource['location'] world.pca = resource['object'] diff --git a/bigml/tests/create_project_steps.py b/bigml/tests/create_project_steps.py index 604c187f..3d997bfe 100644 --- a/bigml/tests/create_project_steps.py +++ b/bigml/tests/create_project_steps.py @@ -44,7 +44,6 @@ def i_update_project_name_with(step, name=""): {"name": name}) world.status = resource['code'] eq_(world.status, HTTP_ACCEPTED) - world.api.ok(resource) world.project = resource['object'] diff --git a/bigml/tests/create_sample_steps.py b/bigml/tests/create_sample_steps.py index 0f7de276..8f451f4b 100644 --- a/bigml/tests/create_sample_steps.py +++ b/bigml/tests/create_sample_steps.py @@ -44,7 +44,6 @@ def i_update_sample_name(step, name): {'name': name}) world.status = resource['code'] eq_(world.status, HTTP_ACCEPTED) - world.api.ok(resource) world.location = resource['location'] world.sample = resource['object'] diff --git a/bigml/tests/create_script_steps.py b/bigml/tests/create_script_steps.py index d6c68b78..cb7ab4ed 100644 --- a/bigml/tests/create_script_steps.py +++ b/bigml/tests/create_script_steps.py @@ -63,7 +63,6 @@ def i_update_a_script(step, param, param_value): {param: param_value}) world.status = resource['code'] eq_(world.status, HTTP_ACCEPTED) - world.api.ok(resource) world.location = resource['location'] world.script = resource['object'] diff --git a/bigml/tests/create_source_steps.py b/bigml/tests/create_source_steps.py index 2709121c..3eac296a 100644 --- a/bigml/tests/create_source_steps.py +++ b/bigml/tests/create_source_steps.py @@ -210,7 +210,6 @@ def i_update_source_with(step, data="{}"): resource = world.api.update_source(world.source.get('resource'), json.loads(data)) world.status = resource['code'] eq_(world.status, HTTP_ACCEPTED) - world.api.ok(resource) def source_has_args(step, args="{}"): diff --git a/bigml/tests/create_statistical_tst_steps.py b/bigml/tests/create_statistical_tst_steps.py index 29c0a132..44e76dd4 100644 --- a/bigml/tests/create_statistical_tst_steps.py +++ b/bigml/tests/create_statistical_tst_steps.py @@ -45,7 +45,6 @@ def i_update_tst_name(step, name): world.statistical_test['resource'], {'name': name}) world.status = resource['code'] eq_(world.status, HTTP_ACCEPTED) - world.api.ok(resource) world.location = resource['location'] world.statistical_test = resource['object'] diff --git a/bigml/tests/create_time_series_steps.py b/bigml/tests/create_time_series_steps.py index bfeb40e7..d12fc2c8 100644 --- a/bigml/tests/create_time_series_steps.py +++ b/bigml/tests/create_time_series_steps.py @@ -66,7 +66,6 @@ def i_update_time_series_name(step, name): {'name': name}) world.status = resource['code'] eq_(world.status, HTTP_ACCEPTED) - world.api.ok(resource) world.location = resource['location'] world.time_series = resource['object'] From 06859b48ffd0b51f42a6362bf6d14f57c7a72236 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Merc=C3=A8=20Mart=C3=ADn=20Prats?= Date: Wed, 26 Mar 2025 20:37:41 +0100 Subject: [PATCH 9/9] Adding small delay in tests --- bigml/tests/read_resource_steps.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bigml/tests/read_resource_steps.py b/bigml/tests/read_resource_steps.py index d406b8d6..bf702e04 100644 --- a/bigml/tests/read_resource_steps.py +++ b/bigml/tests/read_resource_steps.py @@ -14,6 +14,7 @@ # License for the specific language governing permissions and limitations # under the License. +import time from datetime import datetime @@ -46,6 +47,7 @@ def wait_until_status_code_is(code1, code2, secs, resource_info): if status['code'] == int(code2): world.errors.append(resource_info) eq_(status['code'], int(code1)) + time.sleep(0.1) # added to avoid synch mongo issues return i_get_the_resource(resource_info)