ariatosca-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mxm...@apache.org
Subject incubator-ariatosca git commit: fixes [Forced Update!]
Date Sun, 02 Apr 2017 08:54:51 GMT
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/minor_fixes_to_script_ctx_mechanism 67aa92585 -> 84c41afde (forced update)


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/84c41afd
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/84c41afd
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/84c41afd

Branch: refs/heads/minor_fixes_to_script_ctx_mechanism
Commit: 84c41afde59f168f3fa02c7647eea4ce67f3d632
Parents: 718c78c
Author: max-orlov <maxim@gigaspaces.com>
Authored: Thu Mar 30 17:36:47 2017 +0300
Committer: max-orlov <maxim@gigaspaces.com>
Committed: Sun Apr 2 11:54:17 2017 +0300

----------------------------------------------------------------------
 aria/modeling/__init__.py                             |  2 ++
 aria/modeling/utils.py                                | 14 ++++++++++++++
 aria/orchestrator/context/common.py                   |  2 +-
 .../orchestrator/execution_plugin/ctx_proxy/server.py |  3 ++-
 aria/orchestrator/workflows/executor/process.py       |  6 ++++--
 5 files changed, 23 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/84c41afd/aria/modeling/__init__.py
----------------------------------------------------------------------
diff --git a/aria/modeling/__init__.py b/aria/modeling/__init__.py
index 4dfc39d..4ac79e7 100644
--- a/aria/modeling/__init__.py
+++ b/aria/modeling/__init__.py
@@ -19,6 +19,7 @@ from . import (
     mixins,
     types,
     models,
+    utils,
     service_template as _service_template_bases,
     service_instance as _service_instance_bases,
     service_changes as _service_changes_bases,
@@ -45,4 +46,5 @@ __all__ = (
     'types',
     'models',
     'model_bases',
+    'utils'
 )

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/84c41afd/aria/modeling/utils.py
----------------------------------------------------------------------
diff --git a/aria/modeling/utils.py b/aria/modeling/utils.py
index 44d7e10..1da780c 100644
--- a/aria/modeling/utils.py
+++ b/aria/modeling/utils.py
@@ -13,6 +13,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+from json import JSONEncoder
 from StringIO import StringIO
 
 from . import exceptions
@@ -24,6 +25,19 @@ from ..utils.console import puts
 from ..utils.conversion import convert_value_to_type
 
 
+class ModelJSONEncoder(JSONEncoder):
+    def default(self, o):
+        from .mixins import ModelMixin
+        if isinstance(o, ModelMixin):
+            if hasattr(o, 'value'):
+                dict_to_return = o.to_dict(fields=('value',))
+                return dict_to_return['value']
+            else:
+                return o.to_dict()
+        else:
+            return JSONEncoder.default(self, o)
+
+
 def create_inputs(inputs, template_inputs):
     """
     :param inputs: key-value dict

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/84c41afd/aria/orchestrator/context/common.py
----------------------------------------------------------------------
diff --git a/aria/orchestrator/context/common.py b/aria/orchestrator/context/common.py
index 06e283c..3861982 100644
--- a/aria/orchestrator/context/common.py
+++ b/aria/orchestrator/context/common.py
@@ -195,7 +195,7 @@ class BaseContext(object):
         try:
             return self.resource.service.read(entry_id=str(self.service.id), path=path)
         except exceptions.StorageError:
-            return self.resource.service.read(entry_id=str(self.service_template.id), path=path)
+            return self.resource.service_template.read(entry_id=str(self.service_template.id),
path=path)
 
     def get_resource_and_render(self, path=None, variables=None):
         """

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/84c41afd/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 817d064..52a5312 100644
--- a/aria/orchestrator/execution_plugin/ctx_proxy/server.py
+++ b/aria/orchestrator/execution_plugin/ctx_proxy/server.py
@@ -24,6 +24,7 @@ import StringIO
 import wsgiref.simple_server
 
 import bottle
+from aria import modeling
 
 from .. import exceptions
 
@@ -111,7 +112,7 @@ class CtxProxy(object):
             result = json.dumps({
                 'type': result_type,
                 'payload': payload
-            })
+            }, cls=modeling.utils.ModelJSONEncoder)
         except Exception as e:
             traceback_out = StringIO.StringIO()
             traceback.print_exc(file=traceback_out)

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/84c41afd/aria/orchestrator/workflows/executor/process.py
----------------------------------------------------------------------
diff --git a/aria/orchestrator/workflows/executor/process.py b/aria/orchestrator/workflows/executor/process.py
index 6397e88..da82bba 100644
--- a/aria/orchestrator/workflows/executor/process.py
+++ b/aria/orchestrator/workflows/executor/process.py
@@ -145,10 +145,12 @@ class ProcessExecutor(base.BaseExecutor):
             raise RuntimeError('Executor closed')
 
     def _create_arguments_dict(self, task):
+        operation_inputs = dict((k, v.value) for k, v in task.inputs.iteritems())
+        operation_inputs.update({'script_path': task.implementation})
         return {
             'task_id': task.id,
-            'implementation': task.implementation,
-            'operation_inputs': dict((k, v.value) for k, v in task.inputs.iteritems()),
+            'implementation': 'aria.orchestrator.execution_plugin.operations.run_script_locally',
+            'operation_inputs': operation_inputs,
             'port': self._server_port,
             'context': task.context.serialization_dict,
         }


Mime
View raw message