Skip to content

Commit

Permalink
fix: udf server start error (#294)
Browse files Browse the repository at this point in the history
- add unit tests 
- bump version
- make tag
---------
Signed-off-by: Avik Basu <[email protected]>
  • Loading branch information
ab93 committed Sep 20, 2023
1 parent f55312b commit 98e376a
Show file tree
Hide file tree
Showing 5 changed files with 103 additions and 77 deletions.
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ publish:
requirements:
poetry export -f requirements.txt --output requirements.txt --without-hashes

tag:
VERSION=v$(shell poetry version -s)
@echo "Tagging version $(VERSION)"
git tag -s -a $(VERSION) -m "Release $(VERSION)"

/usr/local/bin/mkdocs:
$(PYTHON) -m pip install mkdocs==1.3.0 mkdocs_material==8.3.9

Expand Down
19 changes: 12 additions & 7 deletions numalogic/udfs/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,17 @@
)


def init_server(step: str, server_type: str):
"""Initializes and returns the server."""
pipeline_conf = load_pipeline_conf(CONF_FILE_PATH)
LOGGER.info("Pipeline config: %s", pipeline_conf)

redis_client = get_redis_client_from_conf(pipeline_conf.redis_conf)
udf = UDFFactory.get_udf_instance(step, r_client=redis_client, pl_conf=pipeline_conf)

return ServerFactory.get_server_instance(server_type, handler=udf)


def start_server():
"""Starts the pynumaflow server."""
set_logger()
Expand All @@ -26,13 +37,7 @@ def start_server():

LOGGER.info("Running %s on %s server with config path %s", step, server_type, CONF_FILE_PATH)

pipeline_conf = load_pipeline_conf(CONF_FILE_PATH)
logging.info("Pipeline config: %s", pipeline_conf)

redis_client = get_redis_client_from_conf(pipeline_conf.redis_conf)
udf = UDFFactory.get_udf_instance(step, r_client=redis_client, pl_conf=pipeline_conf)

server = ServerFactory.get_server_instance(server_type, map_handler=udf)
server = init_server(step, server_type)
server.start()


Expand Down
Loading

0 comments on commit 98e376a

Please sign in to comment.