Nomralize component start()/stop()
Also fixed the /schema swagger/rest entry. It did not work
because the 3rdparty protobuf_to_dict library cannot handle
Map fields. Changed the two map fields to a single list
entry.
Change-Id: Ib25a528701b67d58d32451687724c8247da6efa5
diff --git a/web_server/web_server.py b/web_server/web_server.py
index c46ad88..c96be0f 100644
--- a/web_server/web_server.py
+++ b/web_server/web_server.py
@@ -47,11 +47,22 @@
self.shutting_down = False
@inlineCallbacks
- def run(self):
+ def start(self):
+ log.debug('starting')
yield self._open_endpoint()
+ log.info('started')
returnValue(self)
@inlineCallbacks
+ def stop(self):
+ log.debug('stopping')
+ self.shutting_down = True
+ if self.tcp_port is not None:
+ assert isinstance(self.tcp_port, Port)
+ yield self.tcp_port.socket.close()
+ log.info('stopped')
+
+ @inlineCallbacks
def _open_endpoint(self):
endpoint = endpoints.TCP4ServerEndpoint(reactor, self.port)
self.site = Site(self.app.resource())
@@ -59,13 +70,6 @@
log.info('web-server-started', port=self.port)
self.endpoint = endpoint
- @inlineCallbacks
- def shutdown(self):
- self.shutting_down = True
- if self.tcp_port is not None:
- assert isinstance(self.tcp_port, Port)
- yield self.tcp_port.socket.close()
-
def reload_generated_routes(self):
for fname in os.listdir(self.work_dir):
if fname.endswith('_gw.py'):