From 3c590d3bdd29a5e0ea89f2471e2eb75f31bf98e9 Mon Sep 17 00:00:00 2001 From: Romain Date: Mon, 5 Feb 2024 11:07:09 -0800 Subject: [PATCH] Increase timeout to get card to reduce test failures (#1717) --- test/core/metaflow_test/__init__.py | 6 +++--- test/core/tests/card_component_refresh_test.py | 2 +- test/core/tests/card_refresh_test.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/test/core/metaflow_test/__init__.py b/test/core/metaflow_test/__init__.py index 1e12d47f187..19263df26ff 100644 --- a/test/core/metaflow_test/__init__.py +++ b/test/core/metaflow_test/__init__.py @@ -33,7 +33,7 @@ def truncate(var): return var -def retry_untill_timeout(cb_fn, *args, timeout=4, **kwargs): +def retry_until_timeout(cb_fn, *args, timeout=4, **kwargs): """ certain operations in metaflow may not be synchronous and may be running fully asynchronously. This creates a problem in writing tests that verify some behaviour at runtime. This function @@ -52,7 +52,7 @@ def retry_untill_timeout(cb_fn, *args, timeout=4, **kwargs): time.sleep(1) -def try_to_get_card(id=None, timeout=4): +def try_to_get_card(id=None, timeout=60): """ Safetly try to get the card object until a timeout value. """ @@ -63,7 +63,7 @@ def _get_card(card_id): return False return container[0] - return retry_untill_timeout(_get_card, id, timeout=timeout) + return retry_until_timeout(_get_card, id, timeout=timeout) class AssertArtifactFailed(Exception): diff --git a/test/core/tests/card_component_refresh_test.py b/test/core/tests/card_component_refresh_test.py index 68502cfec91..973c8c1f3fe 100644 --- a/test/core/tests/card_component_refresh_test.py +++ b/test/core/tests/card_component_refresh_test.py @@ -66,7 +66,7 @@ def create_random_string_array(size=10): # The `try_to_get_card` function will keep retrying to get a card until a # timeout value is reached. After which the function will throw a `TimeoutError`. _reload_tok = make_reload_token(component_1_arr, component_2_arr) - card = try_to_get_card(id="refresh_card", timeout=10) + card = try_to_get_card(id="refresh_card") assert_equals(isinstance(card, Card), True) sleep_between_refreshes = 2 # Set based on the RUNTIME_CARD_MIN_REFRESH_INTERVAL which acts as a rate-limit to what is refreshed. diff --git a/test/core/tests/card_refresh_test.py b/test/core/tests/card_refresh_test.py index f7152bc521a..ac19ec45b9b 100644 --- a/test/core/tests/card_refresh_test.py +++ b/test/core/tests/card_refresh_test.py @@ -64,7 +64,7 @@ def _array_is_a_subset(arr1, arr2): # when async processes may write cards/data in a "best-effort" manner. # The `try_to_get_card` function will keep retrying to get a card until a # timeout value is reached. After which the function will throw a `TimeoutError`. - card = try_to_get_card(id="refresh_card", timeout=4) + card = try_to_get_card(id="refresh_card") assert_equals(isinstance(card, Card), True) sleep_between_refreshes = 4 # Set based on the RUNTIME_CARD_MIN_REFRESH_INTERVAL which acts as a rate-limit to what is refreshed.