From 2a08f646cfc84f591231f3cf40b30cee2d77d1dd Mon Sep 17 00:00:00 2001 From: anmarhindi Date: Tue, 5 Nov 2024 15:55:14 +0100 Subject: [PATCH 1/7] Remove refinery config --- config_handler.py | 3 ++- service_overview.py | 5 ----- submodules/model | 2 +- submodules/s3 | 2 +- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/config_handler.py b/config_handler.py index a1f6a38..71ea532 100644 --- a/config_handler.py +++ b/config_handler.py @@ -6,7 +6,8 @@ __config = None # meant as a const value since env variables will be removed at some point -REQUEST_URL = "http://refinery-config:80/full_config" +# REQUEST_URL = "http://refinery-config:80/full_config" +REQUEST_URL = "http:///refinery-gateway/api/v1/misc/full_config" def __get_config() -> Dict[str, Any]: diff --git a/service_overview.py b/service_overview.py index 67005b5..4ffc70b 100644 --- a/service_overview.py +++ b/service_overview.py @@ -42,11 +42,6 @@ class Service(Enum): "link": "https://github.com/code-kern-ai/refinery-authorizer", "public_repo": True, }, - Service.CONFIG: { - "name": "Config", - "link": "https://github.com/code-kern-ai/refinery-config", - "public_repo": True, - }, Service.EMBEDDER: { "name": "Embedder", "link": "https://github.com/code-kern-ai/refinery-embedder", diff --git a/submodules/model b/submodules/model index 3af110d..67a33b9 160000 --- a/submodules/model +++ b/submodules/model @@ -1 +1 @@ -Subproject commit 3af110d28d90152c62b40d6676bec40ae50fc132 +Subproject commit 67a33b99a200f18202feb7bc5222d2e3d3177972 diff --git a/submodules/s3 b/submodules/s3 index 1ad3ff5..3299fb4 160000 --- a/submodules/s3 +++ b/submodules/s3 @@ -1 +1 @@ -Subproject commit 1ad3ff584860090f4e215986f334b5e63759a55d +Subproject commit 3299fb46876e3b4cc29c0a5cef004005a87f0f19 From 2c6f161ab3bc07d46ca39fb43c0ffbfb313502f4 Mon Sep 17 00:00:00 2001 From: anmarhindi Date: Tue, 5 Nov 2024 15:59:00 +0100 Subject: [PATCH 2/7] fix url --- config_handler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config_handler.py b/config_handler.py index 71ea532..c4c7ad1 100644 --- a/config_handler.py +++ b/config_handler.py @@ -7,7 +7,7 @@ # meant as a const value since env variables will be removed at some point # REQUEST_URL = "http://refinery-config:80/full_config" -REQUEST_URL = "http:///refinery-gateway/api/v1/misc/full_config" +REQUEST_URL = "http://refinery-gateway/api/v1/misc/full_config" def __get_config() -> Dict[str, Any]: From 5dadd4ff39c83a4fa96e15bc1f9ea61d874efb28 Mon Sep 17 00:00:00 2001 From: anmarhindi Date: Tue, 5 Nov 2024 16:02:18 +0100 Subject: [PATCH 3/7] edit --- config_handler.py | 1 - 1 file changed, 1 deletion(-) diff --git a/config_handler.py b/config_handler.py index c4c7ad1..13c9656 100644 --- a/config_handler.py +++ b/config_handler.py @@ -6,7 +6,6 @@ __config = None # meant as a const value since env variables will be removed at some point -# REQUEST_URL = "http://refinery-config:80/full_config" REQUEST_URL = "http://refinery-gateway/api/v1/misc/full_config" From 4be4d3553dd8c6ced5250a03c64e53859146a5fc Mon Sep 17 00:00:00 2001 From: anmarhindi Date: Tue, 5 Nov 2024 17:31:21 +0100 Subject: [PATCH 4/7] update url --- config_handler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config_handler.py b/config_handler.py index 13c9656..d6df3b7 100644 --- a/config_handler.py +++ b/config_handler.py @@ -6,7 +6,7 @@ __config = None # meant as a const value since env variables will be removed at some point -REQUEST_URL = "http://refinery-gateway/api/v1/misc/full_config" +REQUEST_URL = "http://refinery-gateway:80/full_config" def __get_config() -> Dict[str, Any]: From 71e1041b1d88550f01b89001e5bd83b36af85b55 Mon Sep 17 00:00:00 2001 From: anmarhindi Date: Tue, 12 Nov 2024 16:48:35 +0100 Subject: [PATCH 5/7] Remove config from enum --- service_overview.py | 1 - 1 file changed, 1 deletion(-) diff --git a/service_overview.py b/service_overview.py index 4ffc70b..6b60636 100644 --- a/service_overview.py +++ b/service_overview.py @@ -8,7 +8,6 @@ class Service(Enum): AC_EXEC_ENV = "AC_EXEC_ENV" ADMIN_DASHBOARD = "ADMIN_DASHBOARD" AUTHORIZER = "AUTHORIZER" - CONFIG = "CONFIG" EMBEDDER = "EMBEDDER" ENTRY = "ENTRY" GATEWAY = "GATEWAY" From cf2037c247f60691f283119cbe24a0d9ef2bb410 Mon Sep 17 00:00:00 2001 From: JWittmeyer Date: Thu, 14 Nov 2024 11:50:13 +0100 Subject: [PATCH 6/7] Removes config as not used anymore --- app.py | 7 ---- config_handler.py | 51 ----------------------- upgrade_logic/business_objects/gateway.py | 18 ++------ 3 files changed, 3 insertions(+), 73 deletions(-) delete mode 100644 config_handler.py diff --git a/app.py b/app.py index 8925dca..0e9f191 100644 --- a/app.py +++ b/app.py @@ -3,7 +3,6 @@ from pydantic import BaseModel from submodules.model.business_objects import general import util -import config_handler from submodules.model import session app = FastAPI() @@ -74,12 +73,6 @@ def helper_function(function_name: str) -> responses.JSONResponse: ) -@app.put("/config_changed") -def config_changed() -> responses.PlainTextResponse: - config_handler.refresh_config() - return responses.PlainTextResponse(status_code=status.HTTP_200_OK) - - @app.get("/healthcheck") def healthcheck() -> responses.PlainTextResponse: text = "" diff --git a/config_handler.py b/config_handler.py deleted file mode 100644 index d6df3b7..0000000 --- a/config_handler.py +++ /dev/null @@ -1,51 +0,0 @@ -from typing import Dict, Any, Optional, Union -import requests -import time -import daemon - -__config = None - -# meant as a const value since env variables will be removed at some point -REQUEST_URL = "http://refinery-gateway:80/full_config" - - -def __get_config() -> Dict[str, Any]: - global __config - if __config: - return __config - refresh_config() - return __config - - -def refresh_config(): - response = requests.get(REQUEST_URL) - if response.status_code != 200: - raise ValueError( - f"Config service cant be reached -- response.code{response.status_code}" - ) - global __config - __config = response.json() - daemon.run(invalidate_after, 3600) # one hour - - -def get_config_value( - key: str, subkey: Optional[str] = None -) -> Union[str, Dict[str, str]]: - config = __get_config() - if key not in config: - return None - value = config[key] - - if not subkey: - return value - - if isinstance(value, dict) and subkey in value: - return value[subkey] - else: - return None - - -def invalidate_after(sec: int) -> None: - time.sleep(sec) - global __config - __config = None diff --git a/upgrade_logic/business_objects/gateway.py b/upgrade_logic/business_objects/gateway.py index 2628786..0322ced 100644 --- a/upgrade_logic/business_objects/gateway.py +++ b/upgrade_logic/business_objects/gateway.py @@ -1,7 +1,6 @@ import os import re import requests -from config_handler import get_config_value from submodules.model.business_objects import ( attribute, embedding, @@ -96,11 +95,6 @@ def gateway_1_14_0_add_cognition_strategy_complexity() -> bool: ) return False - is_managed = get_config_value("is_managed") - if not is_managed: - print("Not managed. Skipping cognition strategy complexity update.") - return False - response = requests.post( f"{cognition_url}/api/v1/strategies/internal/calculate_missing_complexities" ) @@ -191,15 +185,9 @@ def gateway_1_8_1() -> bool: def __gateway_1_8_1_add_organization_limits() -> bool: - is_managed = get_config_value("is_managed") - if is_managed: - max_rows = 50000 - max_cols = 25 - max_char_count = 100000 - else: - max_rows = get_config_value("max_rows") or 50000 - max_cols = get_config_value("max_cols") or 25 - max_char_count = get_config_value("max_char_count") or 100000 + max_rows = 50000 + max_cols = 25 + max_char_count = 100000 print( "Add default limit for organizations", From aefc233bb7bedada693a2ff33852d1f270640554 Mon Sep 17 00:00:00 2001 From: JWittmeyer Date: Thu, 14 Nov 2024 13:50:06 +0100 Subject: [PATCH 7/7] Remove REFINERY from version overview --- service_overview.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/service_overview.py b/service_overview.py index 55ba8d4..fdd820b 100644 --- a/service_overview.py +++ b/service_overview.py @@ -15,7 +15,6 @@ class Service(Enum): ML_EXEC_ENV = "ML_EXEC_ENV" MODEL_PROVIDER = "MODEL_PROVIDER" NEURAL_SEARCH = "NEURAL_SEARCH" - REFINERY = "REFINERY" TOKENIZER = "TOKENIZER" UI = "UI" UPDATER = "UPDATER" @@ -75,11 +74,6 @@ class Service(Enum): "link": "https://github.com/code-kern-ai/refinery-neural-search", "public_repo": True, }, - Service.REFINERY: { - "name": "Refinery", - "link": "https://github.com/code-kern-ai/refinery", - "public_repo": True, - }, Service.TOKENIZER: { "name": "Tokenizer", "link": "https://github.com/code-kern-ai/refinery-tokenizer",