From d6e3ea864d19319c88f19c8c8db0f7c95cb52cec Mon Sep 17 00:00:00 2001 From: Dariusz Suchojad Date: Fri, 8 Nov 2024 18:57:27 +0100 Subject: [PATCH 1/2] GH #755 - Adding type hints. --- code/zato-common/src/zato/common/aux_server/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/zato-common/src/zato/common/aux_server/base.py b/code/zato-common/src/zato/common/aux_server/base.py index ab6bc8ee7..5c027d4d3 100644 --- a/code/zato-common/src/zato/common/aux_server/base.py +++ b/code/zato-common/src/zato/common/aux_server/base.py @@ -99,7 +99,7 @@ def get_odb(config:'AuxServerConfig') -> 'ODBManager': odb.pool = sql_pool_store[ZATO_ODB_POOL_NAME].pool odb.init_session(ZATO_ODB_POOL_NAME, config.main.odb, odb.pool, False) - odb.pool.ping(odb.fs_sql_config) + _ = odb.pool.ping(odb.fs_sql_config) return odb From cac2e4f746bd8775c73e3837d9f985d68597f69e Mon Sep 17 00:00:00 2001 From: Dariusz Suchojad Date: Fri, 8 Nov 2024 19:54:45 +0100 Subject: [PATCH 2/2] GH #755 - Made it possible to create servers that aren't based on repo directories. --- .../zato-common/src/zato/common/aux_server/base.py | 14 +++++++++++++- code/zato-common/src/zato/common/ipc/server.py | 2 +- code/zato-scheduler/src/zato/scheduler/main.py | 2 +- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/code/zato-common/src/zato/common/aux_server/base.py b/code/zato-common/src/zato/common/aux_server/base.py index 5c027d4d3..8c2354f4a 100644 --- a/code/zato-common/src/zato/common/aux_server/base.py +++ b/code/zato-common/src/zato/common/aux_server/base.py @@ -314,7 +314,7 @@ def after_config_hook( # ################################################################################################################################ @classmethod - def start( + def start_from_repo_location( class_, # type: type_[AuxServer] *, base_dir=None, # type: strnone @@ -373,6 +373,18 @@ def start( class_.after_config_hook(config, repo_location) # Run the server now + class_._start(config) + +# ################################################################################################################################ + + @classmethod + def start_from_config(class_:'type_[AuxServer]', config:'AuxServerConfig') -> 'None': + class_._start(config) + +# ################################################################################################################################ + + @classmethod + def _start(class_:'type_[AuxServer]', config:'AuxServerConfig') -> 'None': try: class_(config).serve_forever() except Exception: diff --git a/code/zato-common/src/zato/common/ipc/server.py b/code/zato-common/src/zato/common/ipc/server.py index 4f72a5e44..e996950b0 100644 --- a/code/zato-common/src/zato/common/ipc/server.py +++ b/code/zato-common/src/zato/common/ipc/server.py @@ -75,7 +75,7 @@ def my_callback(msg:'Bunch') -> 'str': password = 'test.password' server_type_suffix = ':test' - IPCServer.start( + IPCServer.start_from_repo_location( base_dir=base_dir, bind_host=bind_host, bind_port=bind_port, diff --git a/code/zato-scheduler/src/zato/scheduler/main.py b/code/zato-scheduler/src/zato/scheduler/main.py index 56a2b8363..55422c28c 100644 --- a/code/zato-scheduler/src/zato/scheduler/main.py +++ b/code/zato-scheduler/src/zato/scheduler/main.py @@ -27,7 +27,7 @@ # ################################################################################################################################ def main(): - SchedulerServer.start() + SchedulerServer.start_from_repo_location() # ################################################################################################################################ # ################################################################################################################################