Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-185-NullPool-logging-messages-appear-during-execution 
[created] 57555fe91


NullPool logging messages appear during execution


Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/57555fe9
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/57555fe9
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/57555fe9

Branch: refs/heads/ARIA-185-NullPool-logging-messages-appear-during-execution
Commit: 57555fe9141b3b8efe39c3161815e9d5809ed2f0
Parents: 3d22d36
Author: max-orlov <ma...@gigaspaces.com>
Authored: Mon May 22 18:28:12 2017 +0300
Committer: max-orlov <ma...@gigaspaces.com>
Committed: Mon May 22 18:28:12 2017 +0300

----------------------------------------------------------------------
 aria/orchestrator/context/common.py                    | 5 ++++-
 aria/orchestrator/execution_plugin/ctx_proxy/server.py | 6 ++++++
 aria/orchestrator/workflows/executor/process.py        | 1 +
 3 files changed, 11 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/57555fe9/aria/orchestrator/context/common.py
----------------------------------------------------------------------
diff --git a/aria/orchestrator/context/common.py 
b/aria/orchestrator/context/common.py
index 0854a27..3918408 100644
--- a/aria/orchestrator/context/common.py
+++ b/aria/orchestrator/context/common.py
@@ -16,7 +16,6 @@
 """
 A common context for both workflow and operation
 """
-
 import logging
 from contextlib import contextmanager
 from functools import partial
@@ -195,3 +194,7 @@ class BaseContext(object):
         variables.setdefault('ctx', self)
         resource_template = jinja2.Template(resource_content)
         return resource_template.render(variables)
+
+    def _teardown_db_resources(self):
+        self.model.log._session.remove()
+        self.model.log._engine.dispose()

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/57555fe9/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 52a5312..ef25491 100644
--- a/aria/orchestrator/execution_plugin/ctx_proxy/server.py
+++ b/aria/orchestrator/execution_plugin/ctx_proxy/server.py
@@ -125,6 +125,12 @@ class CtxProxy(object):
                 'type': 'error',
                 'payload': payload
             })
+        finally:
+            # Since this runs in a daemon thread, we need to close the session 
each time we process
+            # a request (a new session would be supplied by SQLAlchemy 
scoped_session).
+            # log mapi is chosen randomly.
+            self.ctx.model.log._session.remove()
+
         return result
 
     def __enter__(self):

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/57555fe9/aria/orchestrator/workflows/executor/process.py
----------------------------------------------------------------------
diff --git a/aria/orchestrator/workflows/executor/process.py 
b/aria/orchestrator/workflows/executor/process.py
index 824c4e1..1060aed 100644
--- a/aria/orchestrator/workflows/executor/process.py
+++ b/aria/orchestrator/workflows/executor/process.py
@@ -395,6 +395,7 @@ def _main():
                              new_instances=instrument.new_instances)
         finally:
             instrument.expunge_session()
+            ctx._teardown_db_resources()
 
 if __name__ == '__main__':
     _main()

Reply via email to