Repository: incubator-ariatosca Updated Branches: refs/heads/ARIA-185-NullPool-logging-messages-appear-during-execution 57cebb998 -> c1868c2b4 (forced update)
minor fixes Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/c1868c2b Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/c1868c2b Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/c1868c2b Branch: refs/heads/ARIA-185-NullPool-logging-messages-appear-during-execution Commit: c1868c2b489f5c0830ce24d891a1c4c926d048a4 Parents: 8ce1ddd Author: max-orlov <[email protected]> Authored: Tue May 23 18:49:19 2017 +0300 Committer: max-orlov <[email protected]> Committed: Tue May 23 19:00:28 2017 +0300 ---------------------------------------------------------------------- aria/orchestrator/execution_plugin/ctx_proxy/client.py | 12 ++++++------ aria/orchestrator/execution_plugin/ctx_proxy/server.py | 5 +++-- .../execution_plugin/test_ctx_proxy_server.py | 1 + tests/orchestrator/workflows/executor/__init__.py | 2 +- 4 files changed, 11 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/c1868c2b/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 f58c727..fbfff57 100644 --- a/aria/orchestrator/execution_plugin/ctx_proxy/client.py +++ b/aria/orchestrator/execution_plugin/ctx_proxy/client.py @@ -45,7 +45,7 @@ def _http_request(socket_url, request, method, timeout): return json.loads(response.read()) -def _client_request(socket_url, args, method, timeout): +def _client_request(socket_url, args, timeout, method='POST'): response = _http_request( socket_url=socket_url, request={'args': args}, @@ -90,15 +90,15 @@ def _process_args(json_prefix, args): def _close_session(socket_url, timeout): - return _client_request(socket_url, [], 'DELETE', timeout) + return _client_request(socket_url, [], timeout, 'DELETE') def main(args=None): try: args = _parse_args(args) - response = _client_request(args.socket_url, + response = _client_request( + args.socket_url, args=_process_args(args.json_arg_prefix, args.args), - method='POST', timeout=args.timeout) if args.json_output: response = json.dumps(response) @@ -107,11 +107,11 @@ def main(args=None): response = '' response = str(response) sys.stdout.write(response) - except BaseException: + except BaseException as origial_e: try: _close_session(args.socket_url, args.timeout) except BaseException: - pass + raise origial_e if __name__ == '__main__': main() http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/c1868c2b/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 7296065..6e5b0e3 100644 --- a/aria/orchestrator/execution_plugin/ctx_proxy/server.py +++ b/aria/orchestrator/execution_plugin/ctx_proxy/server.py @@ -105,7 +105,7 @@ class CtxProxy(object): request = bottle.request.body.read() # pylint: disable=no-member response = handler(request) return bottle.LocalResponse( - body=json.dumps(response or {}, cls=modeling.utils.ModelJSONEncoder), + body=json.dumps(response, cls=modeling.utils.ModelJSONEncoder), status=200, headers={'content-type': 'application/json'} ) @@ -114,7 +114,8 @@ class CtxProxy(object): # 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 arbitrarily. - return self.ctx.model.log._session.remove() + self.ctx.model.log._session.remove() + return {} def _process(self, request): try: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/c1868c2b/tests/orchestrator/execution_plugin/test_ctx_proxy_server.py ---------------------------------------------------------------------- diff --git a/tests/orchestrator/execution_plugin/test_ctx_proxy_server.py b/tests/orchestrator/execution_plugin/test_ctx_proxy_server.py index 98ceff9..c94bae7 100644 --- a/tests/orchestrator/execution_plugin/test_ctx_proxy_server.py +++ b/tests/orchestrator/execution_plugin/test_ctx_proxy_server.py @@ -165,6 +165,7 @@ class TestCtxProxy(object): @pytest.fixture def server(self, ctx): result = ctx_proxy.server.CtxProxy(ctx) + result._close_session = lambda *args, **kwargs: {} yield result result.close() http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/c1868c2b/tests/orchestrator/workflows/executor/__init__.py ---------------------------------------------------------------------- diff --git a/tests/orchestrator/workflows/executor/__init__.py b/tests/orchestrator/workflows/executor/__init__.py index 1a462ca..375c44e 100644 --- a/tests/orchestrator/workflows/executor/__init__.py +++ b/tests/orchestrator/workflows/executor/__init__.py @@ -73,4 +73,4 @@ class MockContext(object): if kwargs: return cls(storage=aria.application_model_storage(**kwargs)) else: - return cls() \ No newline at end of file + return cls()
