From 1733f48bba1f873d4b3a2ed8d13373de36a8d559 Mon Sep 17 00:00:00 2001 From: Pavel Tisnovsky Date: Mon, 20 Jan 2025 13:39:16 +0100 Subject: [PATCH 1/3] Fixed sources --- ols/src/cache/redis_cache.py | 6 ++++-- tests/e2e/utils/cluster.py | 4 ++-- tests/mock_classes/mock_llm_chain.py | 6 +++--- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/ols/src/cache/redis_cache.py b/ols/src/cache/redis_cache.py index 7e319f0d..06343303 100644 --- a/ols/src/cache/redis_cache.py +++ b/ols/src/cache/redis_cache.py @@ -8,9 +8,11 @@ from redis.backoff import ExponentialBackoff from redis.exceptions import ( BusyLoadingError, - ConnectionError, # noqa: A004 RedisError, ) +from redis.exceptions import ( + ConnectionError as RedisConnectionError, +) from redis.retry import Retry from ols.app.models.config import RedisConfig @@ -52,7 +54,7 @@ def initialize_redis(self, config: RedisConfig) -> None: retry_on_error: Optional[list[type[RedisError]]] = None if config.retry_on_error: - retry_on_error = [BusyLoadingError, ConnectionError] + retry_on_error = [BusyLoadingError, RedisConnectionError] # initialize Redis client # pylint: disable=W0201 diff --git a/tests/e2e/utils/cluster.py b/tests/e2e/utils/cluster.py index 2f4b9795..51e6ca89 100644 --- a/tests/e2e/utils/cluster.py +++ b/tests/e2e/utils/cluster.py @@ -9,7 +9,7 @@ def run_oc( - args: list[str], input=None, ignore_existing_resource=False # noqa: A002 + args: list[str], command=None, ignore_existing_resource=False # noqa: A002 ) -> subprocess.CompletedProcess: """Run a command in the OpenShift cluster.""" try: @@ -18,7 +18,7 @@ def run_oc( capture_output=True, text=True, check=True, - input=input, + input=command, ) return res except subprocess.CalledProcessError as e: diff --git a/tests/mock_classes/mock_llm_chain.py b/tests/mock_classes/mock_llm_chain.py index cc55b182..cb30efeb 100644 --- a/tests/mock_classes/mock_llm_chain.py +++ b/tests/mock_classes/mock_llm_chain.py @@ -27,11 +27,11 @@ def __init__(self, *args, **kwargs): def __call__(self, *args, **kwargs): return retval - def invoke(self, input, config=None, **kwargs): # noqa: A002 + def invoke(self, input_data, config=None, **kwargs): """Perform invocation of the LLM chain.""" if retval is not None: return retval - input["text"] = input["query"] - return input + input_data["text"] = input_data["query"] + return input_data return MockLLMChain From fe6c71a40a5a3573c5194618763941518bd8908b Mon Sep 17 00:00:00 2001 From: Pavel Tisnovsky Date: Mon, 20 Jan 2025 13:39:20 +0100 Subject: [PATCH 2/3] Enable Pylinter rule W0622 on CI --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 081390e4..840526d0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -163,4 +163,4 @@ packages = ["ols"] [tool.pylint."MESSAGES CONTROL"] good-names = ["e"] -disable = ["C0103", "C0301", "C0302", "E0602", "E0611", "E1101", "R0902", "R0903", "R0913", "R0914", "W0102", "W0212", "W0511", "W0613", "W0621", "W0622", "W0707", "W0718", "W0719", "R0801", "R0917"] +disable = ["C0103", "C0301", "C0302", "E0602", "E0611", "E1101", "R0902", "R0903", "R0913", "R0914", "W0102", "W0212", "W0511", "W0613", "W0621", "W0707", "W0718", "W0719", "R0801", "R0917"] From b8b9b99907a661d6763b8ea2067ed2938ac2756b Mon Sep 17 00:00:00 2001 From: Pavel Tisnovsky Date: Mon, 20 Jan 2025 13:39:39 +0100 Subject: [PATCH 3/3] More fixes --- tests/e2e/utils/cluster.py | 2 +- tests/e2e/utils/ols_installer.py | 2 +- tests/mock_classes/mock_llm_chain.py | 8 +++++--- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/tests/e2e/utils/cluster.py b/tests/e2e/utils/cluster.py index 51e6ca89..d692982c 100644 --- a/tests/e2e/utils/cluster.py +++ b/tests/e2e/utils/cluster.py @@ -9,7 +9,7 @@ def run_oc( - args: list[str], command=None, ignore_existing_resource=False # noqa: A002 + args: list[str], command=None, ignore_existing_resource=False ) -> subprocess.CompletedProcess: """Run a command in the OpenShift cluster.""" try: diff --git a/tests/e2e/utils/ols_installer.py b/tests/e2e/utils/ols_installer.py index a28d7a98..86623896 100644 --- a/tests/e2e/utils/ols_installer.py +++ b/tests/e2e/utils/ols_installer.py @@ -66,7 +66,7 @@ def update_ols_config() -> None: updated_configmap = yaml.dump(configmap) cluster_utils.run_oc(["delete", "configmap", "olsconfig"]) - cluster_utils.run_oc(["apply", "-f", "-"], input=updated_configmap) + cluster_utils.run_oc(["apply", "-f", "-"], command=updated_configmap) def replace_ols_image(ols_image: str) -> None: diff --git a/tests/mock_classes/mock_llm_chain.py b/tests/mock_classes/mock_llm_chain.py index cb30efeb..f5bc0d10 100644 --- a/tests/mock_classes/mock_llm_chain.py +++ b/tests/mock_classes/mock_llm_chain.py @@ -27,11 +27,13 @@ def __init__(self, *args, **kwargs): def __call__(self, *args, **kwargs): return retval - def invoke(self, input_data, config=None, **kwargs): + def invoke( + self, input, config=None, **kwargs # noqa: A002 pylint: disable=W0622 + ): """Perform invocation of the LLM chain.""" if retval is not None: return retval - input_data["text"] = input_data["query"] - return input_data + input["text"] = input["query"] + return input return MockLLMChain