You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ariatosca.apache.org by mx...@apache.org on 2017/05/24 09:14:00 UTC
incubator-ariatosca git commit: shuffled things around [Forced
Update!]
Repository: incubator-ariatosca
Updated Branches:
refs/heads/ARIA-185-NullPool-logging-messages-appear-during-execution 41e967fe7 -> 833d31b3c (forced update)
shuffled things around
Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/833d31b3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/833d31b3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/833d31b3
Branch: refs/heads/ARIA-185-NullPool-logging-messages-appear-during-execution
Commit: 833d31b3c79e03dda8e57f71d2a4003deb93a6a1
Parents: ec8effb
Author: max-orlov <ma...@gigaspaces.com>
Authored: Wed May 24 12:07:32 2017 +0300
Committer: max-orlov <ma...@gigaspaces.com>
Committed: Wed May 24 12:13:55 2017 +0300
----------------------------------------------------------------------
.../execution_plugin/ctx_proxy/server.py | 22 ++++++++++----------
1 file changed, 11 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/833d31b3/aria/orchestrator/execution_plugin/ctx_proxy/server.py
----------------------------------------------------------------------
diff --git a/aria/orchestrator/execution_plugin/ctx_proxy/server.py b/aria/orchestrator/execution_plugin/ctx_proxy/server.py
index d59e7bf..1ce0e08 100644
--- a/aria/orchestrator/execution_plugin/ctx_proxy/server.py
+++ b/aria/orchestrator/execution_plugin/ctx_proxy/server.py
@@ -37,18 +37,17 @@ class CtxProxy(object):
self.port = _get_unused_port()
self.socket_url = 'http://localhost:{0}'.format(self.port)
self.server = None
- self.bottle_server = None
self._started = Queue.Queue(1)
self.thread = self._start_server()
self._started.get(timeout=5)
def _start_server(self):
- proxy = self
class BottleServerAdapter(bottle.ServerAdapter):
- def __init__(self, _session, *args, **kwargs):
- super(BottleServerAdapter, self).__init__(*args, **kwargs)
- self._session = _session
+ proxy = self
+
+ def close_session(self):
+ self.proxy.ctx.model.log._session.remove()
def run(self, app):
@@ -62,9 +61,11 @@ class CtxProxy(object):
def serve_forever(self, poll_interval=0.5):
try:
wsgiref.simple_server.WSGIServer.serve_forever(self, poll_interval)
- # Once shutdown is called, we need to close the session
finally:
- self.bottle_server._session.remove()
+ # Once shutdown is called, we need to close the session.
+ # If the session is not closed properly, it might raise warnings,
+ # or even lock the database.
+ self.bottle_server.close_session()
class Handler(wsgiref.simple_server.WSGIRequestHandler):
def address_string(self):
@@ -80,8 +81,8 @@ class CtxProxy(object):
app=app,
server_class=Server,
handler_class=Handler)
- proxy.server = server
- proxy._started.put(True)
+ self.proxy.server = server
+ self.proxy._started.put(True)
server.serve_forever(poll_interval=0.1)
def serve():
@@ -95,8 +96,7 @@ class CtxProxy(object):
host='localhost',
port=self.port,
quiet=True,
- server=BottleServerAdapter,
- _session=proxy.ctx.model.log._session)
+ server=BottleServerAdapter)
thread = threading.Thread(target=serve)
thread.daemon = True
thread.start()