From 9e106afbe49c357cc7895b1f6ca3251e2727040e Mon Sep 17 00:00:00 2001 From: heinpa Date: Thu, 5 Sep 2024 10:57:20 +0200 Subject: [PATCH] ensure consistent format of parameter names --- qanary-component-MT-Python-HelsinkiNLP/run.py | 16 ++++++++-------- .../tests/plugins/env_vars.py | 2 +- .../tests/test_mt_helsinky_nlp.py | 2 +- .../pytest.ini | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/qanary-component-MT-Python-HelsinkiNLP/run.py b/qanary-component-MT-Python-HelsinkiNLP/run.py index b16a02327..49d8a9cc6 100644 --- a/qanary-component-MT-Python-HelsinkiNLP/run.py +++ b/qanary-component-MT-Python-HelsinkiNLP/run.py @@ -14,25 +14,25 @@ SPRING_BOOT_ADMIN_URL = os.getenv('SPRING_BOOT_ADMIN_URL') SPRING_BOOT_ADMIN_USERNAME = os.getenv('SPRING_BOOT_ADMIN_USERNAME') SPRING_BOOT_ADMIN_PASSWORD = os.getenv('SPRING_BOOT_ADMIN_PASSWORD') -SERVICE_HOST = os.getenv('SERVER_HOST') -SERVICE_PORT = os.getenv('SERVER_PORT') +SERVER_HOST = os.getenv('SERVER_HOST') +SERVER_PORT = os.getenv('SERVER_PORT') SERVICE_NAME_COMPONENT = os.getenv('SERVICE_NAME_COMPONENT') SERVICE_DESCRIPTION_COMPONENT = os.getenv('SERVICE_DESCRIPTION_COMPONENT') -URL_COMPONENT = f"{SERVICE_HOST}:{SERVICE_PORT}" +URL_COMPONENT = f"{SERVER_HOST}:{SERVER_PORT}" # define metadata that will be shown in the Spring Boot Admin server UI metadata = { "start": datetime.now().strftime("%Y-%m-%d %H:%M:%S"), "description": SERVICE_DESCRIPTION_COMPONENT, - "about": f"{SERVICE_HOST}:{SERVICE_PORT}{ABOUTENDPOINT}", + "about": f"{SERVER_HOST}:{SERVER_PORT}{ABOUTENDPOINT}", "written in": "Python" } # initialize the registration object, to be send to the Spring Boot Admin server registration = Registration( name=SERVICE_NAME_COMPONENT, - serviceUrl=f"{SERVICE_HOST}:{SERVICE_PORT}", - healthUrl=f"{SERVICE_HOST}:{SERVICE_PORT}{HEALTHENDPOINT}", + serviceUrl=f"{SERVER_HOST}:{SERVER_PORT}", + healthUrl=f"{SERVER_HOST}:{SERVER_PORT}{HEALTHENDPOINT}", metadata=metadata ) @@ -50,5 +50,5 @@ if __name__ == "__main__": # start the web service - if SERVICE_PORT == None: - raise RuntimeError("SERVICE_PORT must not be empty!") + if SERVER_PORT == None: + raise RuntimeError("SERVER_PORT must not be empty!") diff --git a/qanary-component-MT-Python-HelsinkiNLP/tests/plugins/env_vars.py b/qanary-component-MT-Python-HelsinkiNLP/tests/plugins/env_vars.py index 295510e00..acf244f6c 100644 --- a/qanary-component-MT-Python-HelsinkiNLP/tests/plugins/env_vars.py +++ b/qanary-component-MT-Python-HelsinkiNLP/tests/plugins/env_vars.py @@ -7,6 +7,6 @@ def pytest_load_initial_conftests(args, early_config, parser): os.environ["SPRING_BOOT_ADMIN_USERNAME"]="admin" os.environ["SPRING_BOOT_ADMIN_PASSWORD"]="admin" os.environ["SERVICE_HOST"]="http://webengineering.ins.hs-anhalt.de" - os.environ["SERVICE_PORT"]="41062" + os.environ["SERVER_PORT"]="41062" os.environ["SERVICE_NAME_COMPONENT"]="MT-Helsinki-NLP-Component" os.environ["SERVICE_DESCRIPTION_COMPONENT"]="MT tool that uses pre-trained models by Helsinki NLP implemented in transformers library" diff --git a/qanary-component-MT-Python-HelsinkiNLP/tests/test_mt_helsinky_nlp.py b/qanary-component-MT-Python-HelsinkiNLP/tests/test_mt_helsinky_nlp.py index 1e9de2f90..99add4a45 100644 --- a/qanary-component-MT-Python-HelsinkiNLP/tests/test_mt_helsinky_nlp.py +++ b/qanary-component-MT-Python-HelsinkiNLP/tests/test_mt_helsinky_nlp.py @@ -50,7 +50,7 @@ def test_qanary_service(self): importlib.reload(component.mt_helsinki_nlp) from component import app - logging.info("port: %s" % (os.environ["SERVICE_PORT"])) + logging.info("port: %s" % (os.environ["SERVER_PORT"])) assert os.environ["SERVICE_NAME_COMPONENT"] == "MT-Helsinki-NLP-Component" assert os.environ["SOURCE_LANGUAGE"] == self.source_language assert os.environ["TARGET_LANGUAGE"] == self.target_language diff --git a/qanary-component-MT-Python-LibreTranslate/pytest.ini b/qanary-component-MT-Python-LibreTranslate/pytest.ini index 238e5d4e4..737bf5b2f 100644 --- a/qanary-component-MT-Python-LibreTranslate/pytest.ini +++ b/qanary-component-MT-Python-LibreTranslate/pytest.ini @@ -13,5 +13,5 @@ env = SERVICE_NAME_COMPONENT=LibreTranslate TRANSLATE_ENDPOINT=http://localhost:5000/translate LANGUAGES_ENDPOINT=http://localhost:5000/languages - LIVE_TESTS_ENABLED=True + LIVE_TESTS_ENABLED=False SERVICE_DESCRIPTION_COMPONENT=Translates question to English