From f27b5d354d0c07155caa501ca4daef267cc8af7a Mon Sep 17 00:00:00 2001 From: Mustafa Gezen Date: Wed, 1 Feb 2023 22:50:15 +0000 Subject: [PATCH] Add start indicators to Temporal workers and misc small fixes --- apollo/rhworker/__main__.py | 2 +- apollo/rpmworker/__main__.py | 2 ++ build/macros/fastapi.bzl | 2 +- common/info.py | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/apollo/rhworker/__main__.py b/apollo/rhworker/__main__.py index 254b74c..a46f362 100644 --- a/apollo/rhworker/__main__.py +++ b/apollo/rhworker/__main__.py @@ -43,7 +43,7 @@ async def run(): @click.command() def main(): Info("apollorhworker", "apollo2") - Logger() + Logger().info("Starting apollo-rhworker") asyncio.run(run()) diff --git a/apollo/rpmworker/__main__.py b/apollo/rpmworker/__main__.py index 7e0e0b2..d4958f9 100644 --- a/apollo/rpmworker/__main__.py +++ b/apollo/rpmworker/__main__.py @@ -15,6 +15,7 @@ from apollo.rpmworker.temporal import TASK_QUEUE from common.database import Database from common.info import Info from common.temporal import Temporal +from common.logger import Logger async def run(): @@ -44,6 +45,7 @@ async def run(): @click.command() def main(): Info("apollorpmworker", "apollo2") + Logger().info("Starting apollo-rpmworker") asyncio.run(run()) diff --git a/build/macros/fastapi.bzl b/build/macros/fastapi.bzl index f9eed8f..a6298aa 100644 --- a/build/macros/fastapi.bzl +++ b/build/macros/fastapi.bzl @@ -22,7 +22,7 @@ def fastapi_binary(name, image_name, path, port, deps = [], tags = [], **kwargs) name = "{}.image".format(name), srcs = ["@pypi_hypercorn//:rules_python_wheel_entry_point_hypercorn.py"], main = "@pypi_hypercorn//:rules_python_wheel_entry_point_hypercorn.py", - args = ["{}:app".format(path), "--bind 127.0.0.1:{}".format(port)], + args = ["{}:app".format(path)], visibility = ["//:__subpackages__"], deps = deps + [ ":{}_lib".format(name), diff --git a/common/info.py b/common/info.py index 5013759..bbdca33 100644 --- a/common/info.py +++ b/common/info.py @@ -48,7 +48,7 @@ class Info: def temporal_host(self): if is_k8s(): - return "workflow-temporal-frontend.workflow.svc.cluster.local:7233" + return os.environ.get("TEMPORAL_HOSTPORT", "workflow-temporal-frontend.workflow.svc.cluster.local:7233") else: return os.environ.get("TEMPORAL_HOSTPORT", "localhost:7233")