MCPcopy Create free account
hub / github.com/comaps/comaps / __init__

Method __init__

tools/python/test_server/server/testserver.py:97–121  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

95class TestServer:
96
97 def __init__(self):
98
99 self.may_serve = False
100
101 pid = os.getpid()
102 logging.info(f"Init server. Pid: {pid}")
103
104 self.server = None
105
106 killer = SiblingKiller(PORT, PING_TIMEOUT)
107 killer.kill_siblings()
108 if killer.allow_serving():
109 try:
110 self.init_server()
111 logging.info(f"Started server with pid: {pid}")
112 self.may_serve = True
113
114 except socket.error:
115 logging.info("Failed to start the server: Port is in use")
116 except Exception as e:
117 logging.debug(e)
118 logging.info("Failed to start serving for unknown reason")
119 traceback.print_exc()
120 else:
121 logging.info(f"Not allowed to start serving for process: {pid}")
122
123 def init_server(self):
124

Callers 1

__init__Method · 0.45

Calls 4

kill_siblingsMethod · 0.95
allow_servingMethod · 0.95
init_serverMethod · 0.95
SiblingKillerClass · 0.90

Tested by

no test coverage detected