Skip to content

Commit

Permalink
ensure consistent format of parameter names
Browse files Browse the repository at this point in the history
  • Loading branch information
heinpa committed Sep 5, 2024
1 parent 57e9533 commit 9e106af
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
16 changes: 8 additions & 8 deletions qanary-component-MT-Python-HelsinkiNLP/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
)

Expand All @@ -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!")
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion qanary-component-MT-Python-LibreTranslate/pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 9e106af

Please sign in to comment.