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/03/22 17:20:02 UTC
incubator-ariatosca git commit:
ARIA-130-Passing-inputs-from-the-workflow-to-the-operation-changes-the-inputs
Repository: incubator-ariatosca
Updated Branches:
refs/heads/ARIA-130-Passing-inputs-from-the-workflow-to-the-operation-changes-the-inputs [created] 080328c04
ARIA-130-Passing-inputs-from-the-workflow-to-the-operation-changes-the-inputs
Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/080328c0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/080328c0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/080328c0
Branch: refs/heads/ARIA-130-Passing-inputs-from-the-workflow-to-the-operation-changes-the-inputs
Commit: 080328c047e1faee24a02b6f86c29d251357edff
Parents: 9841ca4
Author: max-orlov <ma...@gigaspaces.com>
Authored: Wed Mar 22 19:19:53 2017 +0200
Committer: max-orlov <ma...@gigaspaces.com>
Committed: Wed Mar 22 19:19:53 2017 +0200
----------------------------------------------------------------------
aria/modeling/relationship.py | 9 ++++-----
aria/modeling/service_common.py | 8 ++++++++
aria/orchestrator/workflows/api/task.py | 9 +++++----
tests/orchestrator/context/test_operation.py | 6 ++----
.../workflows/executor/test_process_executor_extension.py | 4 ++--
.../executor/test_process_executor_tracked_changes.py | 4 ++--
6 files changed, 23 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/080328c0/aria/modeling/relationship.py
----------------------------------------------------------------------
diff --git a/aria/modeling/relationship.py b/aria/modeling/relationship.py
index bed1599..ef2bcdd 100644
--- a/aria/modeling/relationship.py
+++ b/aria/modeling/relationship.py
@@ -305,11 +305,10 @@ def many_to_many(model_class,
secondary_table = '{0}_{1}'.format(this_table, other_table)
- if other_property is None:
- other_property = formatting.pluralize(this_table)
- if prefix is not None:
- secondary_table = '{0}_{1}'.format(prefix, secondary_table)
- other_property = '{0}_{1}'.format(prefix, other_property)
+ if prefix is not None:
+ secondary_table = '{0}_{1}'.format(prefix, secondary_table)
+ if other_property is None:
+ other_property = '{0}_{1}'.format(prefix, this_table)
backref_kwargs = backref_kwargs or {}
backref_kwargs.setdefault('uselist', True)
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/080328c0/aria/modeling/service_common.py
----------------------------------------------------------------------
diff --git a/aria/modeling/service_common.py b/aria/modeling/service_common.py
index dfe4674..3f49645 100644
--- a/aria/modeling/service_common.py
+++ b/aria/modeling/service_common.py
@@ -202,6 +202,14 @@ class TypeBase(InstanceModelMixin):
types.append(raw_child)
child._append_raw_children(types)
+ @property
+ def hierarchy(self):
+ """
+ Return the type hierarchy.
+ :return:
+ """
+ return [self] + (self.parent.hierarchy if self.parent else [])
+
class MetadataBase(TemplateModelMixin):
"""
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/080328c0/aria/orchestrator/workflows/api/task.py
----------------------------------------------------------------------
diff --git a/aria/orchestrator/workflows/api/task.py b/aria/orchestrator/workflows/api/task.py
index 9522d7a..009b81c 100644
--- a/aria/orchestrator/workflows/api/task.py
+++ b/aria/orchestrator/workflows/api/task.py
@@ -16,6 +16,7 @@
"""
Provides the tasks to be entered into the task graph
"""
+import copy
from ....modeling import models
from ....utils.collections import OrderedDict
@@ -91,10 +92,10 @@ class OperationTask(BaseTask):
self.runs_on = runs_on
# Wrap inputs
- if inputs:
- for k, v in inputs.iteritems():
- if not isinstance(v, models.Parameter):
- inputs[k] = models.Parameter.wrap(k, v)
+ inputs = copy.deepcopy(inputs) if inputs else {}
+ for k, v in inputs.iteritems():
+ if not isinstance(v, models.Parameter):
+ inputs[k] = models.Parameter.wrap(k, v)
# TODO: Suggestion: these extra inputs could be stored as a separate entry in the task
# model, because they are different from the operation inputs. If we do this, then the two
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/080328c0/tests/orchestrator/context/test_operation.py
----------------------------------------------------------------------
diff --git a/tests/orchestrator/context/test_operation.py b/tests/orchestrator/context/test_operation.py
index 05c9656..f8a79c5 100644
--- a/tests/orchestrator/context/test_operation.py
+++ b/tests/orchestrator/context/test_operation.py
@@ -363,13 +363,11 @@ def _assert_loggins(ctx, inputs):
assert all(l.execution == execution for l in logs)
assert all(l in logs and l.task == task for l in task.logs)
- op_start_log = [l for l in logs if
- inputs['op_start'].value in l.msg and l.level.lower() == 'info']
+ op_start_log = [l for l in logs if inputs['op_start'] in l.msg and l.level.lower() == 'info']
assert len(op_start_log) == 1
op_start_log = op_start_log[0]
- op_end_log = [l for l in logs
- if inputs['op_end'].value in l.msg and l.level.lower() == 'debug']
+ op_end_log = [l for l in logs if inputs['op_end'] in l.msg and l.level.lower() == 'debug']
assert len(op_end_log) == 1
op_end_log = op_end_log[0]
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/080328c0/tests/orchestrator/workflows/executor/test_process_executor_extension.py
----------------------------------------------------------------------
diff --git a/tests/orchestrator/workflows/executor/test_process_executor_extension.py b/tests/orchestrator/workflows/executor/test_process_executor_extension.py
index 1c4cda6..0988fae 100644
--- a/tests/orchestrator/workflows/executor/test_process_executor_extension.py
+++ b/tests/orchestrator/workflows/executor/test_process_executor_extension.py
@@ -55,8 +55,8 @@ def test_decorate_extension(context, executor):
eng = engine.Engine(executor=executor, workflow_context=context, tasks_graph=graph)
eng.execute()
out = get_node(context).runtime_properties['out']
- assert out['wrapper_inputs'] == dict((k, v.value) for k, v in inputs.iteritems())
- assert out['function_inputs'] == dict((k, v.value) for k, v in inputs.iteritems())
+ assert out['wrapper_inputs'] == inputs
+ assert out['function_inputs'] == inputs
@extension.process_executor
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/080328c0/tests/orchestrator/workflows/executor/test_process_executor_tracked_changes.py
----------------------------------------------------------------------
diff --git a/tests/orchestrator/workflows/executor/test_process_executor_tracked_changes.py b/tests/orchestrator/workflows/executor/test_process_executor_tracked_changes.py
index a3957c3..5512189 100644
--- a/tests/orchestrator/workflows/executor/test_process_executor_tracked_changes.py
+++ b/tests/orchestrator/workflows/executor/test_process_executor_tracked_changes.py
@@ -73,9 +73,9 @@ def test_apply_tracked_changes_during_an_operation(context, executor):
inputs=inputs)
expected_after_update = expected_initial.copy()
- expected_after_update.update(inputs['committed'].value) # pylint: disable=no-member
+ expected_after_update.update(inputs['committed']) # pylint: disable=no-member
expected_after_change = expected_after_update.copy()
- expected_after_change.update(inputs['changed_but_refreshed'].value) # pylint: disable=no-member
+ expected_after_change.update(inputs['changed_but_refreshed']) # pylint: disable=no-member
expected_after_refresh = expected_after_update
assert out['initial'] == expected_initial