[1/7] incubator-ariatosca git commit: NullPool logging messages appear during execution [Forced Update!]
Repository: incubator-ariatosca Updated Branches: refs/heads/ARIA-149-functions-in-operation-configuration c063b4097 -> 888c5cd6f (forced update) 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/0c986842 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/0c986842 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/0c986842 Branch: refs/heads/ARIA-149-functions-in-operation-configuration Commit: 0c986842d52eca823ab92442dd9d77267e369ae8 Parents: 3d22d36 Author: max-orlov Authored: Mon May 22 18:28:12 2017 +0300 Committer: max-orlov Committed: Wed May 24 12:15:13 2017 +0300 -- aria/orchestrator/context/common.py | 1 - aria/orchestrator/context/operation.py | 13 +-- .../execution_plugin/ctx_proxy/client.py| 22 ++-- .../execution_plugin/ctx_proxy/server.py| 37 +--- aria/orchestrator/workflows/executor/process.py | 2 +- .../execution_plugin/test_ctx_proxy_server.py | 4 ++- .../orchestrator/workflows/executor/__init__.py | 2 +- 7 files changed, 52 insertions(+), 29 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/0c986842/aria/orchestrator/context/common.py -- diff --git a/aria/orchestrator/context/common.py b/aria/orchestrator/context/common.py index 0854a27..c98e026 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 http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/0c986842/aria/orchestrator/context/operation.py -- diff --git a/aria/orchestrator/context/operation.py b/aria/orchestrator/context/operation.py index 68a02aa..0ce790f 100644 --- a/aria/orchestrator/context/operation.py +++ b/aria/orchestrator/context/operation.py @@ -33,6 +33,7 @@ class BaseOperationContext(BaseContext): self._task_id = task_id self._actor_id = actor_id self._thread_local = threading.local() +self._destroy_session = kwargs.pop('destroy_session', False) logger_level = kwargs.pop('logger_level', None) super(BaseOperationContext, self).__init__(**kwargs) self._register_logger(task_id=self.task.id, level=logger_level) @@ -90,13 +91,21 @@ class BaseOperationContext(BaseContext): } @classmethod -def deserialize_from_dict(cls, model_storage=None, resource_storage=None, **kwargs): +def instantiate_from_dict(cls, model_storage=None, resource_storage=None, **kwargs): if model_storage: model_storage = aria.application_model_storage(**model_storage) if resource_storage: resource_storage = aria.application_resource_storage(**resource_storage) -return cls(model_storage=model_storage, resource_storage=resource_storage, **kwargs) +return cls(model_storage=model_storage, + resource_storage=resource_storage, + destroy_session=True, + **kwargs) + +def close(self): +if self._destroy_session: +self.model.log._session.remove() +self.model.log._engine.dispose() class NodeOperationContext(BaseOperationContext): http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/0c986842/aria/orchestrator/execution_plugin/ctx_proxy/client.py -- diff --git a/aria/orchestrator/execution_plugin/ctx_proxy/client.py b/aria/orchestrator/execution_plugin/ctx_proxy/client.py index d965a5e..f7f56aa 100644 --- a/aria/orchestrator/execution_plugin/ctx_proxy/client.py +++ b/aria/orchestrator/execution_plugin/ctx_proxy/client.py @@ -34,22 +34,25 @@ class _RequestError(RuntimeError): self.ex_traceback = ex_traceback -def _http_request(socket_url, request, timeout): -response = urllib2.urlopen( -url=socket_url, -data=json.dumps(request), -timeout=timeout) +def _http_request(socket_url, request, method, timeout): +opener = urllib2.build_opener(urllib2.HTTPHandler) +request = urllib2.Request(socket_url, data=json.dumps(request)) +request.get_method = lambda: method +response = opener.open(request, timeout=timeout) + if response.code != 200: raise RuntimeError('Request failed: {0}'.format(response)) return json.loads(response.read()) -def _client_request(socket_url, args, timeout): +def _client_request
[1/5] incubator-ariatosca git commit: NullPool logging messages appear during execution [Forced Update!]
Repository: incubator-ariatosca Updated Branches: refs/heads/ARIA-180-convert-parameter-to-one-to-many 7b1a6a0a7 -> ff9dc08e6 (forced update) 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/0c986842 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/0c986842 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/0c986842 Branch: refs/heads/ARIA-180-convert-parameter-to-one-to-many Commit: 0c986842d52eca823ab92442dd9d77267e369ae8 Parents: 3d22d36 Author: max-orlov Authored: Mon May 22 18:28:12 2017 +0300 Committer: max-orlov Committed: Wed May 24 12:15:13 2017 +0300 -- aria/orchestrator/context/common.py | 1 - aria/orchestrator/context/operation.py | 13 +-- .../execution_plugin/ctx_proxy/client.py| 22 ++-- .../execution_plugin/ctx_proxy/server.py| 37 +--- aria/orchestrator/workflows/executor/process.py | 2 +- .../execution_plugin/test_ctx_proxy_server.py | 4 ++- .../orchestrator/workflows/executor/__init__.py | 2 +- 7 files changed, 52 insertions(+), 29 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/0c986842/aria/orchestrator/context/common.py -- diff --git a/aria/orchestrator/context/common.py b/aria/orchestrator/context/common.py index 0854a27..c98e026 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 http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/0c986842/aria/orchestrator/context/operation.py -- diff --git a/aria/orchestrator/context/operation.py b/aria/orchestrator/context/operation.py index 68a02aa..0ce790f 100644 --- a/aria/orchestrator/context/operation.py +++ b/aria/orchestrator/context/operation.py @@ -33,6 +33,7 @@ class BaseOperationContext(BaseContext): self._task_id = task_id self._actor_id = actor_id self._thread_local = threading.local() +self._destroy_session = kwargs.pop('destroy_session', False) logger_level = kwargs.pop('logger_level', None) super(BaseOperationContext, self).__init__(**kwargs) self._register_logger(task_id=self.task.id, level=logger_level) @@ -90,13 +91,21 @@ class BaseOperationContext(BaseContext): } @classmethod -def deserialize_from_dict(cls, model_storage=None, resource_storage=None, **kwargs): +def instantiate_from_dict(cls, model_storage=None, resource_storage=None, **kwargs): if model_storage: model_storage = aria.application_model_storage(**model_storage) if resource_storage: resource_storage = aria.application_resource_storage(**resource_storage) -return cls(model_storage=model_storage, resource_storage=resource_storage, **kwargs) +return cls(model_storage=model_storage, + resource_storage=resource_storage, + destroy_session=True, + **kwargs) + +def close(self): +if self._destroy_session: +self.model.log._session.remove() +self.model.log._engine.dispose() class NodeOperationContext(BaseOperationContext): http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/0c986842/aria/orchestrator/execution_plugin/ctx_proxy/client.py -- diff --git a/aria/orchestrator/execution_plugin/ctx_proxy/client.py b/aria/orchestrator/execution_plugin/ctx_proxy/client.py index d965a5e..f7f56aa 100644 --- a/aria/orchestrator/execution_plugin/ctx_proxy/client.py +++ b/aria/orchestrator/execution_plugin/ctx_proxy/client.py @@ -34,22 +34,25 @@ class _RequestError(RuntimeError): self.ex_traceback = ex_traceback -def _http_request(socket_url, request, timeout): -response = urllib2.urlopen( -url=socket_url, -data=json.dumps(request), -timeout=timeout) +def _http_request(socket_url, request, method, timeout): +opener = urllib2.build_opener(urllib2.HTTPHandler) +request = urllib2.Request(socket_url, data=json.dumps(request)) +request.get_method = lambda: method +response = opener.open(request, timeout=timeout) + if response.code != 200: raise RuntimeError('Request failed: {0}'.format(response)) return json.loads(response.read()) -def _client_request(socket_url, args, timeout): +def _client_request(socket_
[1/3] incubator-ariatosca git commit: NullPool logging messages appear during execution [Forced Update!]
Repository: incubator-ariatosca Updated Branches: refs/heads/ARIA-258-Convert-runtime-properties-to-attributes 24e4c7b39 -> 953620020 (forced update) 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/0c986842 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/0c986842 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/0c986842 Branch: refs/heads/ARIA-258-Convert-runtime-properties-to-attributes Commit: 0c986842d52eca823ab92442dd9d77267e369ae8 Parents: 3d22d36 Author: max-orlov Authored: Mon May 22 18:28:12 2017 +0300 Committer: max-orlov Committed: Wed May 24 12:15:13 2017 +0300 -- aria/orchestrator/context/common.py | 1 - aria/orchestrator/context/operation.py | 13 +-- .../execution_plugin/ctx_proxy/client.py| 22 ++-- .../execution_plugin/ctx_proxy/server.py| 37 +--- aria/orchestrator/workflows/executor/process.py | 2 +- .../execution_plugin/test_ctx_proxy_server.py | 4 ++- .../orchestrator/workflows/executor/__init__.py | 2 +- 7 files changed, 52 insertions(+), 29 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/0c986842/aria/orchestrator/context/common.py -- diff --git a/aria/orchestrator/context/common.py b/aria/orchestrator/context/common.py index 0854a27..c98e026 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 http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/0c986842/aria/orchestrator/context/operation.py -- diff --git a/aria/orchestrator/context/operation.py b/aria/orchestrator/context/operation.py index 68a02aa..0ce790f 100644 --- a/aria/orchestrator/context/operation.py +++ b/aria/orchestrator/context/operation.py @@ -33,6 +33,7 @@ class BaseOperationContext(BaseContext): self._task_id = task_id self._actor_id = actor_id self._thread_local = threading.local() +self._destroy_session = kwargs.pop('destroy_session', False) logger_level = kwargs.pop('logger_level', None) super(BaseOperationContext, self).__init__(**kwargs) self._register_logger(task_id=self.task.id, level=logger_level) @@ -90,13 +91,21 @@ class BaseOperationContext(BaseContext): } @classmethod -def deserialize_from_dict(cls, model_storage=None, resource_storage=None, **kwargs): +def instantiate_from_dict(cls, model_storage=None, resource_storage=None, **kwargs): if model_storage: model_storage = aria.application_model_storage(**model_storage) if resource_storage: resource_storage = aria.application_resource_storage(**resource_storage) -return cls(model_storage=model_storage, resource_storage=resource_storage, **kwargs) +return cls(model_storage=model_storage, + resource_storage=resource_storage, + destroy_session=True, + **kwargs) + +def close(self): +if self._destroy_session: +self.model.log._session.remove() +self.model.log._engine.dispose() class NodeOperationContext(BaseOperationContext): http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/0c986842/aria/orchestrator/execution_plugin/ctx_proxy/client.py -- diff --git a/aria/orchestrator/execution_plugin/ctx_proxy/client.py b/aria/orchestrator/execution_plugin/ctx_proxy/client.py index d965a5e..f7f56aa 100644 --- a/aria/orchestrator/execution_plugin/ctx_proxy/client.py +++ b/aria/orchestrator/execution_plugin/ctx_proxy/client.py @@ -34,22 +34,25 @@ class _RequestError(RuntimeError): self.ex_traceback = ex_traceback -def _http_request(socket_url, request, timeout): -response = urllib2.urlopen( -url=socket_url, -data=json.dumps(request), -timeout=timeout) +def _http_request(socket_url, request, method, timeout): +opener = urllib2.build_opener(urllib2.HTTPHandler) +request = urllib2.Request(socket_url, data=json.dumps(request)) +request.get_method = lambda: method +response = opener.open(request, timeout=timeout) + if response.code != 200: raise RuntimeError('Request failed: {0}'.format(response)) return json.loads(response.read()) -def _client_request(socket_url, args, timeout): +def _client
incubator-ariatosca git commit: NullPool logging messages appear during execution
Repository: incubator-ariatosca Updated Branches: refs/heads/master 3d22d36fc -> 0c986842d 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/0c986842 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/0c986842 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/0c986842 Branch: refs/heads/master Commit: 0c986842d52eca823ab92442dd9d77267e369ae8 Parents: 3d22d36 Author: max-orlov Authored: Mon May 22 18:28:12 2017 +0300 Committer: max-orlov Committed: Wed May 24 12:15:13 2017 +0300 -- aria/orchestrator/context/common.py | 1 - aria/orchestrator/context/operation.py | 13 +-- .../execution_plugin/ctx_proxy/client.py| 22 ++-- .../execution_plugin/ctx_proxy/server.py| 37 +--- aria/orchestrator/workflows/executor/process.py | 2 +- .../execution_plugin/test_ctx_proxy_server.py | 4 ++- .../orchestrator/workflows/executor/__init__.py | 2 +- 7 files changed, 52 insertions(+), 29 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/0c986842/aria/orchestrator/context/common.py -- diff --git a/aria/orchestrator/context/common.py b/aria/orchestrator/context/common.py index 0854a27..c98e026 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 http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/0c986842/aria/orchestrator/context/operation.py -- diff --git a/aria/orchestrator/context/operation.py b/aria/orchestrator/context/operation.py index 68a02aa..0ce790f 100644 --- a/aria/orchestrator/context/operation.py +++ b/aria/orchestrator/context/operation.py @@ -33,6 +33,7 @@ class BaseOperationContext(BaseContext): self._task_id = task_id self._actor_id = actor_id self._thread_local = threading.local() +self._destroy_session = kwargs.pop('destroy_session', False) logger_level = kwargs.pop('logger_level', None) super(BaseOperationContext, self).__init__(**kwargs) self._register_logger(task_id=self.task.id, level=logger_level) @@ -90,13 +91,21 @@ class BaseOperationContext(BaseContext): } @classmethod -def deserialize_from_dict(cls, model_storage=None, resource_storage=None, **kwargs): +def instantiate_from_dict(cls, model_storage=None, resource_storage=None, **kwargs): if model_storage: model_storage = aria.application_model_storage(**model_storage) if resource_storage: resource_storage = aria.application_resource_storage(**resource_storage) -return cls(model_storage=model_storage, resource_storage=resource_storage, **kwargs) +return cls(model_storage=model_storage, + resource_storage=resource_storage, + destroy_session=True, + **kwargs) + +def close(self): +if self._destroy_session: +self.model.log._session.remove() +self.model.log._engine.dispose() class NodeOperationContext(BaseOperationContext): http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/0c986842/aria/orchestrator/execution_plugin/ctx_proxy/client.py -- diff --git a/aria/orchestrator/execution_plugin/ctx_proxy/client.py b/aria/orchestrator/execution_plugin/ctx_proxy/client.py index d965a5e..f7f56aa 100644 --- a/aria/orchestrator/execution_plugin/ctx_proxy/client.py +++ b/aria/orchestrator/execution_plugin/ctx_proxy/client.py @@ -34,22 +34,25 @@ class _RequestError(RuntimeError): self.ex_traceback = ex_traceback -def _http_request(socket_url, request, timeout): -response = urllib2.urlopen( -url=socket_url, -data=json.dumps(request), -timeout=timeout) +def _http_request(socket_url, request, method, timeout): +opener = urllib2.build_opener(urllib2.HTTPHandler) +request = urllib2.Request(socket_url, data=json.dumps(request)) +request.get_method = lambda: method +response = opener.open(request, timeout=timeout) + if response.code != 200: raise RuntimeError('Request failed: {0}'.format(response)) return json.loads(response.read()) -def _client_request(socket_url, args, timeout): +def _client_request(socket_url, args, timeout, method='POST'): response = _http_request( socket_url=
incubator-ariatosca git commit: NullPool logging messages appear during execution [Forced Update!]
Repository: incubator-ariatosca Updated Branches: refs/heads/ARIA-185-NullPool-logging-messages-appear-during-execution 833d31b3c -> 0c986842d (forced update) 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/0c986842 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/0c986842 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/0c986842 Branch: refs/heads/ARIA-185-NullPool-logging-messages-appear-during-execution Commit: 0c986842d52eca823ab92442dd9d77267e369ae8 Parents: 3d22d36 Author: max-orlov Authored: Mon May 22 18:28:12 2017 +0300 Committer: max-orlov Committed: Wed May 24 12:15:13 2017 +0300 -- aria/orchestrator/context/common.py | 1 - aria/orchestrator/context/operation.py | 13 +-- .../execution_plugin/ctx_proxy/client.py| 22 ++-- .../execution_plugin/ctx_proxy/server.py| 37 +--- aria/orchestrator/workflows/executor/process.py | 2 +- .../execution_plugin/test_ctx_proxy_server.py | 4 ++- .../orchestrator/workflows/executor/__init__.py | 2 +- 7 files changed, 52 insertions(+), 29 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/0c986842/aria/orchestrator/context/common.py -- diff --git a/aria/orchestrator/context/common.py b/aria/orchestrator/context/common.py index 0854a27..c98e026 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 http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/0c986842/aria/orchestrator/context/operation.py -- diff --git a/aria/orchestrator/context/operation.py b/aria/orchestrator/context/operation.py index 68a02aa..0ce790f 100644 --- a/aria/orchestrator/context/operation.py +++ b/aria/orchestrator/context/operation.py @@ -33,6 +33,7 @@ class BaseOperationContext(BaseContext): self._task_id = task_id self._actor_id = actor_id self._thread_local = threading.local() +self._destroy_session = kwargs.pop('destroy_session', False) logger_level = kwargs.pop('logger_level', None) super(BaseOperationContext, self).__init__(**kwargs) self._register_logger(task_id=self.task.id, level=logger_level) @@ -90,13 +91,21 @@ class BaseOperationContext(BaseContext): } @classmethod -def deserialize_from_dict(cls, model_storage=None, resource_storage=None, **kwargs): +def instantiate_from_dict(cls, model_storage=None, resource_storage=None, **kwargs): if model_storage: model_storage = aria.application_model_storage(**model_storage) if resource_storage: resource_storage = aria.application_resource_storage(**resource_storage) -return cls(model_storage=model_storage, resource_storage=resource_storage, **kwargs) +return cls(model_storage=model_storage, + resource_storage=resource_storage, + destroy_session=True, + **kwargs) + +def close(self): +if self._destroy_session: +self.model.log._session.remove() +self.model.log._engine.dispose() class NodeOperationContext(BaseOperationContext): http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/0c986842/aria/orchestrator/execution_plugin/ctx_proxy/client.py -- diff --git a/aria/orchestrator/execution_plugin/ctx_proxy/client.py b/aria/orchestrator/execution_plugin/ctx_proxy/client.py index d965a5e..f7f56aa 100644 --- a/aria/orchestrator/execution_plugin/ctx_proxy/client.py +++ b/aria/orchestrator/execution_plugin/ctx_proxy/client.py @@ -34,22 +34,25 @@ class _RequestError(RuntimeError): self.ex_traceback = ex_traceback -def _http_request(socket_url, request, timeout): -response = urllib2.urlopen( -url=socket_url, -data=json.dumps(request), -timeout=timeout) +def _http_request(socket_url, request, method, timeout): +opener = urllib2.build_opener(urllib2.HTTPHandler) +request = urllib2.Request(socket_url, data=json.dumps(request)) +request.get_method = lambda: method +response = opener.open(request, timeout=timeout) + if response.code != 200: raise RuntimeError('Request failed: {0}'.format(response)) return json.loads(response.read()) -def _client_request(socket_url, args, time
incubator-ariatosca git commit: NullPool logging messages appear during execution
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 Authored: Mon May 22 18:28:12 2017 +0300 Committer: max-orlov 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()