[Slack] Notifications from the ASF team for May 23rd, 2017 at 8:17 AM

2017-05-22 Thread Slack
Hi ARIA TOSCA,

You have a new direct message from the ASF team
(https://the-asf.slack.com/x-185534614710-186089059713/).

---

@digestai
View in the archives:
https://the-asf.slack.com/x-185534614710-186089059713/archives/D5E4SCANM/p1495515655981019

Digest.AI (8:00 AM, May 23rd)
Hi ARIA,
*Here’s your digest for May 23rd 2017*
There are 26 messages yesterday, and the most active user is jamesbognar

*#ariatosca*
 @avia: [UPDATE] continued researching the pros and cons of generic
foreign keys and polymorphic relationship. So far I got Output, Input,
and Property as separate tables (for now) with all the tests passing, so
the implementation of the polymorphic relationship will be much easier.
I'll do it tomorrow, and we'll finally be able to talk about it in the
evening.
 @emblemparade: [UPDATE] fixed all tests and created PR for ARIA-149.
who wants to review???
https://github.com/apache/incubator-ariatosca/pull/138
 note that i would very much like to further enhance it and rename the
fields in the Task API. see the email thread for more discussion of
that... the rename would be a trivial change, though, and would not
otherwise change any of the functionality introduced by this PR.



*Links shared by your team today:*



* * *

You can snooze these notifications for
an hour:
https://the-asf.slack.com/unsub/U5FFQJ2LW-5a1cb74d28-notify-mute-1h
eight hours:
https://the-asf.slack.com/unsub/U5FFQJ2LW-796e6535e1-notify-mute-8h
a day:
https://the-asf.slack.com/unsub/U5FFQJ2LW-4e6e073ada-notify-mute-1d
three days:
https://the-asf.slack.com/unsub/U5FFQJ2LW-806a2d8aa0-notify-mute-3d
or the next week:
https://the-asf.slack.com/unsub/U5FFQJ2LW-6adc840c34-notify-mute-7d.

You can also turn email notifications off:
https://the-asf.slack.com/unsub/U5FFQJ2LW-64de78982b-notify.

For more detailed preferences, see your account page:
https://the-asf.slack.com/account.


[2/2] incubator-ariatosca git commit: ARIA-149 Enhance operation configuration

2017-05-22 Thread emblemparade
ARIA-149 Enhance operation configuration

* Parse special "dependencies" configuration parameters as YAML and
  treat as Parameter models, allowing them full use of intrinsic
  functions, type coersions, and validations
* Rename various functions that process "properties" to more generically
  process "parameters" (properties, inputs, attributes, arguments, etc.)
* The "configuration" field in OperationTemplate and Operation models
  is now now a dict of Parameter models
* Added "function" and "arguments" fields to Operation model to preserve
  user data (in "implementation" and "inputs") and to clearly demarcate
  orchestration data from user data
* Some cleanup of parser code touched by this commit


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

Branch: refs/heads/ARIA-149-functions-in-operation-configuration
Commit: 13888d24794458e818e01af75482feae6b6dded3
Parents: 3d22d36
Author: Tal Liron 
Authored: Thu Apr 20 17:54:47 2017 -0500
Committer: Tal Liron 
Committed: Mon May 22 18:41:39 2017 -0500

--
 aria/cli/commands/services.py   |   2 +-
 aria/core.py|  14 +-
 aria/modeling/constraints.py|  28 +++
 aria/modeling/contraints.py |  28 ---
 aria/modeling/exceptions.py |  16 +-
 aria/modeling/service_common.py |   4 +
 aria/modeling/service_instance.py   |  69 +++---
 aria/modeling/service_template.py   |  54 ++---
 aria/modeling/utils.py  | 105 -
 .../execution_plugin/instantiation.py   | 133 +++-
 aria/orchestrator/workflow_runner.py|   2 +-
 aria/orchestrator/workflows/api/task.py |   4 +-
 aria/orchestrator/workflows/core/task.py|   1 -
 .../profiles/aria-1.0/aria-1.0.yaml |  16 +-
 .../simple_v1_0/assignments.py  |   4 +-
 .../simple_v1_0/modeling/__init__.py|  65 --
 .../simple_v1_0/modeling/artifacts.py   |   2 +-
 .../simple_v1_0/modeling/capabilities.py|  24 ++-
 .../simple_v1_0/modeling/constraints.py |   2 +-
 .../simple_v1_0/modeling/data_types.py  |  16 ++
 .../simple_v1_0/modeling/interfaces.py  |  34 ++-
 .../simple_v1_0/modeling/parameters.py  | 211 +++
 .../simple_v1_0/modeling/policies.py|   2 +
 .../simple_v1_0/modeling/properties.py  | 202 --
 .../simple_v1_0/modeling/requirements.py|  20 +-
 .../modeling/substitution_mappings.py   |   4 +
 .../simple_v1_0/templates.py|  13 +-
 .../aria_extension_tosca/simple_v1_0/types.py   |  24 +--
 tests/cli/test_services.py  |  14 +-
 tests/mock/models.py|  10 +-
 tests/mock/topology.py  |  12 +-
 tests/orchestrator/context/test_operation.py|  53 +++--
 tests/orchestrator/context/test_serialize.py|   2 +-
 tests/orchestrator/context/test_toolbelt.py |  14 +-
 .../orchestrator/execution_plugin/test_local.py |  10 +-
 tests/orchestrator/execution_plugin/test_ssh.py |  12 +-
 tests/orchestrator/test_workflow_runner.py  |   8 +-
 tests/orchestrator/workflows/api/test_task.py   |  26 +--
 .../workflows/builtin/test_execute_operation.py |   2 +-
 .../orchestrator/workflows/core/test_engine.py  |   6 +-
 .../orchestrator/workflows/core/test_events.py  |   3 +-
 tests/orchestrator/workflows/core/test_task.py  |   6 +-
 .../test_task_graph_into_execution_graph.py |   2 +-
 ...process_executor_concurrent_modifications.py |  10 +-
 .../executor/test_process_executor_extension.py |  13 +-
 .../test_process_executor_tracked_changes.py|   8 +-
 .../node-cellar/node-cellar.yaml|  24 ++-
 47 files changed, 737 insertions(+), 597 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/13888d24/aria/cli/commands/services.py
--
diff --git a/aria/cli/commands/services.py b/aria/cli/commands/services.py
index 24de7c5..476387c 100644
--- a/aria/cli/commands/services.py
+++ b/aria/cli/commands/services.py
@@ -151,7 +151,7 @@ def create(service_template_name,
 except storage_exceptions.StorageError as e:
 utils.check_overriding_storage_exceptions(e, 'service', service_name)
 raise
-except modeling_exceptions.InputsException:
+except modeling_exceptions.ParameterException:
 

[1/2] incubator-ariatosca git commit: ARIA-149 Enhance operation configuration [Forced Update!]

2017-05-22 Thread emblemparade
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-149-functions-in-operation-configuration 50646f627 -> 
13888d247 (forced update)


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/13888d24/extensions/aria_extension_tosca/simple_v1_0/modeling/properties.py
--
diff --git a/extensions/aria_extension_tosca/simple_v1_0/modeling/properties.py 
b/extensions/aria_extension_tosca/simple_v1_0/modeling/properties.py
deleted file mode 100644
index 9c3ea42..000
--- a/extensions/aria_extension_tosca/simple_v1_0/modeling/properties.py
+++ /dev/null
@@ -1,202 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License.  You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-from aria.utils.collections import merge, deepcopy_with_locators, OrderedDict
-from aria.parser.presentation import Value
-from aria.parser.validation import Issue
-
-from .data_types import coerce_value
-
-#
-# ArtifactType, DataType, CapabilityType, RelationshipType, NodeType, 
GroupType, PolicyType
-#
-
-# Works on properties, parameters, inputs, and attributes
-def get_inherited_property_definitions(context, presentation, field_name, 
for_presentation=None):
-"""
-Returns our property definitions added on top of those of our parent, if 
we have one
-(recursively).
-
-Allows overriding all aspects of parent properties except data type.
-"""
-
-# Get definitions from parent
-# If we inherit from a primitive, it does not have a parent:
-parent = presentation._get_parent(context) if hasattr(presentation, 
'_get_parent') else None
-definitions = get_inherited_property_definitions(context, parent, 
field_name,
- 
for_presentation=presentation) \
- if parent is not None 
else OrderedDict()
-
-# Add/merge our definitions
-# If we inherit from a primitive, it does not have our field
-our_definitions = getattr(presentation, field_name, None)
-if our_definitions:
-our_definitions_clone = OrderedDict()
-for name, our_definition in our_definitions.iteritems():
-our_definitions_clone[name] = 
our_definition._clone(for_presentation)
-our_definitions = our_definitions_clone
-merge_property_definitions(context, presentation, definitions, 
our_definitions, field_name)
-
-for definition in definitions.itervalues():
-definition._reset_method_cache()
-
-return definitions
-
-#
-# NodeTemplate, RelationshipTemplate, GroupTemplate, PolicyTemplate
-#
-
-def get_assigned_and_defined_property_values(context, presentation, 
field_name='property',
- field_name_plural='properties'):
-"""
-Returns the assigned property values while making sure they are defined in 
our type.
-
-The property definition's default value, if available, will be used if we 
did not assign it.
-
-Makes sure that required properties indeed end up with a value.
-"""
-
-values = OrderedDict()
-
-the_type = presentation._get_type(context)
-assignments = getattr(presentation, field_name_plural)
-get_fn_name = '_get_{0}'.format(field_name_plural)
-definitions = getattr(the_type, get_fn_name)(context) if the_type is not 
None else None
-
-# Fill in our assignments, but make sure they are defined
-if assignments:
-for name, value in assignments.iteritems():
-if (definitions is not None) and (name in definitions):
-definition = definitions[name]
-values[name] = coerce_property_value(context, value, 
definition, value.value)
-else:
-context.validation.report('assignment to undefined {0} "{1}" 
in "{2}"'
-  .format(field_name, name, 
presentation._fullname),
-  locator=value._locator, 
level=Issue.BETWEEN_TYPES)
-
-# Fill in defaults from the definitions
-if definitions:
-for name, definition in definitions.iteritems():
-if values.get(name) is None:
-values[name] = coerce_property_value(context, presentation, 
definition,
-   

[2/2] incubator-ariatosca git commit: ARIA-149 Enhance operation configuration

2017-05-22 Thread emblemparade
ARIA-149 Enhance operation configuration

* Parse special "dependencies" configuration parameters as YAML and
  treat as Parameter models, allowing them full use of intrinsic
  functions, type coersions, and validations
* Rename various functions that process "properties" to more generically
  process "parameters" (properties, inputs, attributes, arguments, etc.)
* The "configuration" field in OperationTemplate and Operation models
  is now now a dict of Parameter models
* Added "function" and "arguments" fields to Operation model to preserve
  user data (in "implementation" and "inputs") and to clearly demarcate
  orchestration data from user data
* Some cleanup of parser code touched by this commit


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

Branch: refs/heads/ARIA-149-functions-in-operation-configuration
Commit: 50646f6279d442869410e8597e2b6215fca28782
Parents: 3d22d36
Author: Tal Liron 
Authored: Thu Apr 20 17:54:47 2017 -0500
Committer: Tal Liron 
Committed: Mon May 22 18:39:19 2017 -0500

--
 aria/cli/commands/services.py   |   2 +-
 aria/core.py|  18 +-
 aria/modeling/constraints.py|  28 +++
 aria/modeling/contraints.py |  28 ---
 aria/modeling/exceptions.py |  16 +-
 aria/modeling/service_common.py |   4 +
 aria/modeling/service_instance.py   |  69 +++---
 aria/modeling/service_template.py   |  54 ++---
 aria/modeling/utils.py  | 105 -
 .../execution_plugin/instantiation.py   | 133 +++-
 aria/orchestrator/workflow_runner.py|   2 +-
 aria/orchestrator/workflows/api/task.py |   4 +-
 aria/orchestrator/workflows/core/task.py|   1 -
 .../profiles/aria-1.0/aria-1.0.yaml |  16 +-
 .../simple_v1_0/assignments.py  |   4 +-
 .../simple_v1_0/modeling/__init__.py|  65 --
 .../simple_v1_0/modeling/artifacts.py   |   2 +-
 .../simple_v1_0/modeling/capabilities.py|  24 ++-
 .../simple_v1_0/modeling/constraints.py |   2 +-
 .../simple_v1_0/modeling/data_types.py  |  16 ++
 .../simple_v1_0/modeling/interfaces.py  |  34 ++-
 .../simple_v1_0/modeling/parameters.py  | 211 +++
 .../simple_v1_0/modeling/policies.py|   2 +
 .../simple_v1_0/modeling/properties.py  | 202 --
 .../simple_v1_0/modeling/requirements.py|  20 +-
 .../modeling/substitution_mappings.py   |   4 +
 .../simple_v1_0/templates.py|  13 +-
 .../aria_extension_tosca/simple_v1_0/types.py   |  24 +--
 tests/cli/test_services.py  |  14 +-
 tests/mock/models.py|  10 +-
 tests/mock/topology.py  |  12 +-
 tests/orchestrator/context/test_operation.py|  53 +++--
 tests/orchestrator/context/test_serialize.py|   2 +-
 tests/orchestrator/context/test_toolbelt.py |  14 +-
 .../orchestrator/execution_plugin/test_local.py |  10 +-
 tests/orchestrator/execution_plugin/test_ssh.py |  12 +-
 tests/orchestrator/test_workflow_runner.py  |   8 +-
 tests/orchestrator/workflows/api/test_task.py   |  26 +--
 .../workflows/builtin/test_execute_operation.py |   2 +-
 .../orchestrator/workflows/core/test_engine.py  |   6 +-
 .../orchestrator/workflows/core/test_events.py  |   3 +-
 tests/orchestrator/workflows/core/test_task.py  |   6 +-
 .../test_task_graph_into_execution_graph.py |   2 +-
 ...process_executor_concurrent_modifications.py |  10 +-
 .../executor/test_process_executor_extension.py |  13 +-
 .../test_process_executor_tracked_changes.py|   8 +-
 .../node-cellar/node-cellar.yaml|  24 ++-
 47 files changed, 739 insertions(+), 599 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/50646f62/aria/cli/commands/services.py
--
diff --git a/aria/cli/commands/services.py b/aria/cli/commands/services.py
index 24de7c5..476387c 100644
--- a/aria/cli/commands/services.py
+++ b/aria/cli/commands/services.py
@@ -151,7 +151,7 @@ def create(service_template_name,
 except storage_exceptions.StorageError as e:
 utils.check_overriding_storage_exceptions(e, 'service', service_name)
 raise
-except modeling_exceptions.InputsException:
+except modeling_exceptions.ParameterException:
 

[1/4] incubator-ariatosca git commit: ARIA-208 Fix models relationships [Forced Update!]

2017-05-22 Thread emblemparade
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-149-functions-in-operation-configuration b1c97e244 -> 
84d8da592 (forced update)


ARIA-208 Fix models relationships


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

Branch: refs/heads/ARIA-149-functions-in-operation-configuration
Commit: 5798bbfc7d1a95965a4c44d2ebad5dad245c824a
Parents: 78d6019
Author: Ran Ziv 
Authored: Sun May 7 14:58:46 2017 +0300
Committer: Ran Ziv 
Committed: Mon May 22 15:17:21 2017 +0300

--
 aria/modeling/service_template.py | 49 --
 1 file changed, 23 insertions(+), 26 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/5798bbfc/aria/modeling/service_template.py
--
diff --git a/aria/modeling/service_template.py 
b/aria/modeling/service_template.py
index 1eb95a3..12195a1 100644
--- a/aria/modeling/service_template.py
+++ b/aria/modeling/service_template.py
@@ -211,10 +211,6 @@ class ServiceTemplateBase(TemplateModelMixin):
 return relationship.one_to_many(cls, 'service', dict_key='name')
 
 @declared_attr
-def operation_templates(cls):
-return relationship.one_to_many(cls, 'operation_template')
-
-@declared_attr
 def node_templates(cls):
 return relationship.one_to_many(cls, 'node_template', dict_key='name')
 
@@ -483,6 +479,22 @@ class NodeTemplateBase(TemplateModelMixin):
 def nodes(cls):
 return relationship.one_to_many(cls, 'node')
 
+@declared_attr
+def interface_templates(cls):
+return relationship.one_to_many(cls, 'interface_template', 
dict_key='name')
+
+@declared_attr
+def artifact_templates(cls):
+return relationship.one_to_many(cls, 'artifact_template', 
dict_key='name')
+
+@declared_attr
+def capability_templates(cls):
+return relationship.one_to_many(cls, 'capability_template', 
dict_key='name')
+
+@declared_attr
+def requirement_templates(cls):
+return relationship.one_to_many(cls, 'requirement_template', 
child_fk='node_template_fk')
+
 # endregion
 
 # region many_to_one relationships
@@ -507,22 +519,6 @@ class NodeTemplateBase(TemplateModelMixin):
 def attributes(cls):
 return relationship.many_to_many(cls, 'parameter', 
prefix='attributes', dict_key='name')
 
-@declared_attr
-def interface_templates(cls):
-return relationship.one_to_many(cls, 'interface_template', 
dict_key='name')
-
-@declared_attr
-def artifact_templates(cls):
-return relationship.one_to_many(cls, 'artifact_template', 
dict_key='name')
-
-@declared_attr
-def capability_templates(cls):
-return relationship.one_to_many(cls, 'capability_template', 
dict_key='name')
-
-@declared_attr
-def requirement_templates(cls):
-return relationship.one_to_many(cls, 'requirement_template', 
child_fk='node_template_fk')
-
 # endregion
 
 description = Column(Text)
@@ -1209,11 +1205,6 @@ class RequirementTemplateBase(TemplateModelMixin):
 def relationships(cls):
 return relationship.one_to_many(cls, 'relationship')
 
-@declared_attr
-def target_node_type(cls):
-return relationship.many_to_one(
-cls, 'type', fk='target_node_type_fk', 
back_populates=relationship.NO_BACK_POP)
-
 # endregion
 
 # region many_to_one relationships
@@ -1222,6 +1213,11 @@ class RequirementTemplateBase(TemplateModelMixin):
 def node_template(cls):
 return relationship.many_to_one(cls, 'node_template', 
fk='node_template_fk')
 
+@declared_attr
+def target_node_type(cls):
+return relationship.many_to_one(
+cls, 'type', fk='target_node_type_fk', 
back_populates=relationship.NO_BACK_POP)
+
 # endregion
 
 # region many_to_many relationships
@@ -1845,7 +1841,8 @@ class OperationTemplateBase(TemplateModelMixin):
 
 @declared_attr
 def service_template(cls):
-return relationship.many_to_one(cls, 'service_template')
+return relationship.many_to_one(cls, 'service_template',
+back_populates='workflow_templates')
 
 @declared_attr
 def interface_template(cls):



[1/2] incubator-ariatosca git commit: ARIA-149 Enhance operation configuration [Forced Update!]

2017-05-22 Thread emblemparade
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-149-functions-in-operation-configuration 84d8da592 -> 
50646f627 (forced update)


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/50646f62/extensions/aria_extension_tosca/simple_v1_0/modeling/policies.py
--
diff --git a/extensions/aria_extension_tosca/simple_v1_0/modeling/policies.py 
b/extensions/aria_extension_tosca/simple_v1_0/modeling/policies.py
index fba1972..7dd803b 100644
--- a/extensions/aria_extension_tosca/simple_v1_0/modeling/policies.py
+++ b/extensions/aria_extension_tosca/simple_v1_0/modeling/policies.py
@@ -15,6 +15,7 @@
 
 from ..presentation.types import convert_shorthand_to_full_type_name
 
+
 #
 # PolicyType
 #
@@ -49,6 +50,7 @@ def get_inherited_targets(context, presentation):
 
 return node_types, group_types
 
+
 #
 # PolicyTemplate
 #

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/50646f62/extensions/aria_extension_tosca/simple_v1_0/modeling/properties.py
--
diff --git a/extensions/aria_extension_tosca/simple_v1_0/modeling/properties.py 
b/extensions/aria_extension_tosca/simple_v1_0/modeling/properties.py
deleted file mode 100644
index 9c3ea42..000
--- a/extensions/aria_extension_tosca/simple_v1_0/modeling/properties.py
+++ /dev/null
@@ -1,202 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License.  You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-from aria.utils.collections import merge, deepcopy_with_locators, OrderedDict
-from aria.parser.presentation import Value
-from aria.parser.validation import Issue
-
-from .data_types import coerce_value
-
-#
-# ArtifactType, DataType, CapabilityType, RelationshipType, NodeType, 
GroupType, PolicyType
-#
-
-# Works on properties, parameters, inputs, and attributes
-def get_inherited_property_definitions(context, presentation, field_name, 
for_presentation=None):
-"""
-Returns our property definitions added on top of those of our parent, if 
we have one
-(recursively).
-
-Allows overriding all aspects of parent properties except data type.
-"""
-
-# Get definitions from parent
-# If we inherit from a primitive, it does not have a parent:
-parent = presentation._get_parent(context) if hasattr(presentation, 
'_get_parent') else None
-definitions = get_inherited_property_definitions(context, parent, 
field_name,
- 
for_presentation=presentation) \
- if parent is not None 
else OrderedDict()
-
-# Add/merge our definitions
-# If we inherit from a primitive, it does not have our field
-our_definitions = getattr(presentation, field_name, None)
-if our_definitions:
-our_definitions_clone = OrderedDict()
-for name, our_definition in our_definitions.iteritems():
-our_definitions_clone[name] = 
our_definition._clone(for_presentation)
-our_definitions = our_definitions_clone
-merge_property_definitions(context, presentation, definitions, 
our_definitions, field_name)
-
-for definition in definitions.itervalues():
-definition._reset_method_cache()
-
-return definitions
-
-#
-# NodeTemplate, RelationshipTemplate, GroupTemplate, PolicyTemplate
-#
-
-def get_assigned_and_defined_property_values(context, presentation, 
field_name='property',
- field_name_plural='properties'):
-"""
-Returns the assigned property values while making sure they are defined in 
our type.
-
-The property definition's default value, if available, will be used if we 
did not assign it.
-
-Makes sure that required properties indeed end up with a value.
-"""
-
-values = OrderedDict()
-
-the_type = presentation._get_type(context)
-assignments = getattr(presentation, field_name_plural)
-get_fn_name = '_get_{0}'.format(field_name_plural)
-definitions = getattr(the_type, get_fn_name)(context) if the_type is not 
None else None
-
-# Fill in our assignments, but make sure they are defined
-if assignments:
-for name, value in assignments.iteritems():

[4/4] incubator-ariatosca git commit: ARIA-149 Enhance operation configuration

2017-05-22 Thread emblemparade
ARIA-149 Enhance operation configuration

* Parse special "dependencies" configuration parameters as YAML and
treat as Parameter models, allowing them full use of intrinsic
functions, type coersions, and validations
* Rename various functions that process "properties" to more generically
process "parameters" (properties, inputs, attributes, arguments, etc.)
* The "configuration" field in OperationTemplate and Operation models
is now now a dict of Parameter models
* Added "function" and "arguments" fields to Operation model to preserve
user data (in "implementation" and "inputs") and to clearly demarcate
orchestration data from user data
* Some cleanup of parser code touched by this commit


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

Branch: refs/heads/ARIA-149-functions-in-operation-configuration
Commit: 84d8da592b3534cecbc896e7ee60704d660f4a26
Parents: 3d22d36
Author: Tal Liron 
Authored: Thu Apr 20 17:54:47 2017 -0500
Committer: Tal Liron 
Committed: Mon May 22 18:33:11 2017 -0500

--
 aria/cli/commands/services.py   |   2 +-
 aria/core.py|  18 +-
 aria/modeling/constraints.py|  28 +++
 aria/modeling/contraints.py |  28 ---
 aria/modeling/exceptions.py |  16 +-
 aria/modeling/service_common.py |   4 +
 aria/modeling/service_instance.py   |  69 +++---
 aria/modeling/service_template.py   |  54 ++---
 aria/modeling/utils.py  | 105 -
 .../execution_plugin/instantiation.py   | 133 +++-
 aria/orchestrator/workflow_runner.py|   2 +-
 aria/orchestrator/workflows/api/task.py |   4 +-
 aria/orchestrator/workflows/core/task.py|   1 -
 .../profiles/aria-1.0/aria-1.0.yaml |  16 +-
 .../simple_v1_0/assignments.py  |   4 +-
 .../simple_v1_0/modeling/__init__.py|  65 --
 .../simple_v1_0/modeling/artifacts.py   |   2 +-
 .../simple_v1_0/modeling/capabilities.py|  24 ++-
 .../simple_v1_0/modeling/constraints.py |   2 +-
 .../simple_v1_0/modeling/data_types.py  |  16 ++
 .../simple_v1_0/modeling/interfaces.py  |  34 ++-
 .../simple_v1_0/modeling/parameters.py  | 211 +++
 .../simple_v1_0/modeling/policies.py|   2 +
 .../simple_v1_0/modeling/properties.py  | 202 --
 .../simple_v1_0/modeling/requirements.py|  20 +-
 .../modeling/substitution_mappings.py   |   4 +
 .../simple_v1_0/templates.py|  13 +-
 .../aria_extension_tosca/simple_v1_0/types.py   |  24 +--
 tests/cli/test_services.py  |  14 +-
 tests/mock/models.py|  10 +-
 tests/mock/topology.py  |  12 +-
 tests/orchestrator/context/test_operation.py|  53 +++--
 tests/orchestrator/context/test_serialize.py|   2 +-
 tests/orchestrator/context/test_toolbelt.py |  14 +-
 .../orchestrator/execution_plugin/test_local.py |  10 +-
 tests/orchestrator/execution_plugin/test_ssh.py |  12 +-
 tests/orchestrator/test_workflow_runner.py  |   8 +-
 tests/orchestrator/workflows/api/test_task.py   |  26 +--
 .../workflows/builtin/test_execute_operation.py |   2 +-
 .../orchestrator/workflows/core/test_engine.py  |   6 +-
 .../orchestrator/workflows/core/test_events.py  |   3 +-
 tests/orchestrator/workflows/core/test_task.py  |   6 +-
 .../test_task_graph_into_execution_graph.py |   2 +-
 ...process_executor_concurrent_modifications.py |  10 +-
 .../executor/test_process_executor_extension.py |  13 +-
 .../test_process_executor_tracked_changes.py|   8 +-
 .../node-cellar/node-cellar.yaml|  24 ++-
 47 files changed, 739 insertions(+), 599 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/84d8da59/aria/cli/commands/services.py
--
diff --git a/aria/cli/commands/services.py b/aria/cli/commands/services.py
index 24de7c5..476387c 100644
--- a/aria/cli/commands/services.py
+++ b/aria/cli/commands/services.py
@@ -151,7 +151,7 @@ def create(service_template_name,
 except storage_exceptions.StorageError as e:
 utils.check_overriding_storage_exceptions(e, 'service', service_name)
 raise
-except modeling_exceptions.InputsException:
+except modeling_exceptions.ParameterException:
 

[2/4] incubator-ariatosca git commit: ARIA-162 Upgrade Colorama library version

2017-05-22 Thread emblemparade
ARIA-162 Upgrade Colorama library version

Upgraded the Colorama library version - This should
take care of the closed-stream error that appeared
sporadically after test runs.


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

Branch: refs/heads/ARIA-149-functions-in-operation-configuration
Commit: 3d22d36fc5c9fb780facfb8880143dda46d16f6f
Parents: 5798bbf
Author: Ran Ziv 
Authored: Mon May 22 16:44:00 2017 +0300
Committer: Ran Ziv 
Committed: Mon May 22 16:44:00 2017 +0300

--
 requirements.in  | 2 +-
 requirements.txt | 5 +
 2 files changed, 2 insertions(+), 5 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/3d22d36f/requirements.in
--
diff --git a/requirements.in b/requirements.in
index 3950140..1dd5b1f 100644
--- a/requirements.in
+++ b/requirements.in
@@ -29,7 +29,7 @@ wagon==0.6.0
 bottle>=0.12.0, <0.13
 Fabric>=1.13.0, <1.14
 click>=4.1, < 5.0
-colorama>=0.3.3, < 0.3.5
+colorama>=0.3.7, <= 0.3.9
 PrettyTable>=0.7,<0.8
 click_didyoumean==0.0.3
 backports.shutil_get_terminal_size==1.0.0

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/3d22d36f/requirements.txt
--
diff --git a/requirements.txt b/requirements.txt
index 3accaa3..f7efce9 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -27,7 +27,7 @@ cffi==1.10.0  # via cryptography
 click==4.1
 click_didyoumean==0.0.3
 clint==0.5.1
-colorama==0.3.4
+colorama==0.3.9
 cryptography==1.8.1   # via paramiko
 decorator==4.0.11 # via networkx
 enum34==1.1.6 # via cryptography
@@ -57,6 +57,3 @@ six==1.10.0   # via cryptography, packaging, 
retrying
 sqlalchemy==1.1.6
 wagon==0.6.0
 wheel==0.29.0 # via wagon
-
-# The following packages are considered to be unsafe in a requirements file:
-# setuptools# via cryptography



[3/4] incubator-ariatosca git commit: ARIA-149 Enhance operation configuration

2017-05-22 Thread emblemparade
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/84d8da59/extensions/aria_extension_tosca/simple_v1_0/modeling/policies.py
--
diff --git a/extensions/aria_extension_tosca/simple_v1_0/modeling/policies.py 
b/extensions/aria_extension_tosca/simple_v1_0/modeling/policies.py
index fba1972..7dd803b 100644
--- a/extensions/aria_extension_tosca/simple_v1_0/modeling/policies.py
+++ b/extensions/aria_extension_tosca/simple_v1_0/modeling/policies.py
@@ -15,6 +15,7 @@
 
 from ..presentation.types import convert_shorthand_to_full_type_name
 
+
 #
 # PolicyType
 #
@@ -49,6 +50,7 @@ def get_inherited_targets(context, presentation):
 
 return node_types, group_types
 
+
 #
 # PolicyTemplate
 #

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/84d8da59/extensions/aria_extension_tosca/simple_v1_0/modeling/properties.py
--
diff --git a/extensions/aria_extension_tosca/simple_v1_0/modeling/properties.py 
b/extensions/aria_extension_tosca/simple_v1_0/modeling/properties.py
deleted file mode 100644
index 9c3ea42..000
--- a/extensions/aria_extension_tosca/simple_v1_0/modeling/properties.py
+++ /dev/null
@@ -1,202 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License.  You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-from aria.utils.collections import merge, deepcopy_with_locators, OrderedDict
-from aria.parser.presentation import Value
-from aria.parser.validation import Issue
-
-from .data_types import coerce_value
-
-#
-# ArtifactType, DataType, CapabilityType, RelationshipType, NodeType, 
GroupType, PolicyType
-#
-
-# Works on properties, parameters, inputs, and attributes
-def get_inherited_property_definitions(context, presentation, field_name, 
for_presentation=None):
-"""
-Returns our property definitions added on top of those of our parent, if 
we have one
-(recursively).
-
-Allows overriding all aspects of parent properties except data type.
-"""
-
-# Get definitions from parent
-# If we inherit from a primitive, it does not have a parent:
-parent = presentation._get_parent(context) if hasattr(presentation, 
'_get_parent') else None
-definitions = get_inherited_property_definitions(context, parent, 
field_name,
- 
for_presentation=presentation) \
- if parent is not None 
else OrderedDict()
-
-# Add/merge our definitions
-# If we inherit from a primitive, it does not have our field
-our_definitions = getattr(presentation, field_name, None)
-if our_definitions:
-our_definitions_clone = OrderedDict()
-for name, our_definition in our_definitions.iteritems():
-our_definitions_clone[name] = 
our_definition._clone(for_presentation)
-our_definitions = our_definitions_clone
-merge_property_definitions(context, presentation, definitions, 
our_definitions, field_name)
-
-for definition in definitions.itervalues():
-definition._reset_method_cache()
-
-return definitions
-
-#
-# NodeTemplate, RelationshipTemplate, GroupTemplate, PolicyTemplate
-#
-
-def get_assigned_and_defined_property_values(context, presentation, 
field_name='property',
- field_name_plural='properties'):
-"""
-Returns the assigned property values while making sure they are defined in 
our type.
-
-The property definition's default value, if available, will be used if we 
did not assign it.
-
-Makes sure that required properties indeed end up with a value.
-"""
-
-values = OrderedDict()
-
-the_type = presentation._get_type(context)
-assignments = getattr(presentation, field_name_plural)
-get_fn_name = '_get_{0}'.format(field_name_plural)
-definitions = getattr(the_type, get_fn_name)(context) if the_type is not 
None else None
-
-# Fill in our assignments, but make sure they are defined
-if assignments:
-for name, value in assignments.iteritems():
-if (definitions is not None) and (name in definitions):
-definition = definitions[name]
-values[name] = 

incubator-ariatosca git commit: fix1 [Forced Update!]

2017-05-22 Thread mxmrlv
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-185-NullPool-logging-messages-appear-during-execution 
95cc3d100 -> aea7cebc8 (forced update)


fix1


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

Branch: refs/heads/ARIA-185-NullPool-logging-messages-appear-during-execution
Commit: aea7cebc8789d5b76844f87bf31f2a87af0b3429
Parents: 57555fe
Author: max-orlov 
Authored: Mon May 22 19:07:37 2017 +0300
Committer: max-orlov 
Committed: Mon May 22 22:54:39 2017 +0300

--
 aria/orchestrator/context/common.py|  4 
 aria/orchestrator/context/operation.py | 17 ++---
 .../execution_plugin/ctx_proxy/server.py   |  2 +-
 aria/orchestrator/workflows/executor/process.py|  3 +--
 .../execution_plugin/test_ctx_proxy_server.py  |  3 ++-
 tests/orchestrator/workflows/executor/__init__.py  |  6 +-
 6 files changed, 23 insertions(+), 12 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/aea7cebc/aria/orchestrator/context/common.py
--
diff --git a/aria/orchestrator/context/common.py 
b/aria/orchestrator/context/common.py
index 3918408..c98e026 100644
--- a/aria/orchestrator/context/common.py
+++ b/aria/orchestrator/context/common.py
@@ -194,7 +194,3 @@ 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/aea7cebc/aria/orchestrator/context/operation.py
--
diff --git a/aria/orchestrator/context/operation.py 
b/aria/orchestrator/context/operation.py
index 68a02aa..e0eb927 100644
--- a/aria/orchestrator/context/operation.py
+++ b/aria/orchestrator/context/operation.py
@@ -29,10 +29,11 @@ class BaseOperationContext(BaseContext):
 Context object used during operation creation and execution
 """
 
-def __init__(self, task_id, actor_id, **kwargs):
+def __init__(self, task_id, actor_id, instantiated_from_dict=False, 
**kwargs):
 self._task_id = task_id
 self._actor_id = actor_id
 self._thread_local = threading.local()
+self._instantiated_from_dict = instantiated_from_dict
 logger_level = kwargs.pop('logger_level', None)
 super(BaseOperationContext, self).__init__(**kwargs)
 self._register_logger(task_id=self.task.id, level=logger_level)
@@ -90,14 +91,24 @@ 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,
+   instantiated_from_dict=True,
+   **kwargs)
 
+def __del__(self):
+self.close()
+
+def close(self):
+if self._instantiated_from_dict:
+self.model.log._session.remove()
+self.model.log._engine.dispose()
 
 class NodeOperationContext(BaseOperationContext):
 """

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/aea7cebc/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 ef25491..e3496b9 100644
--- a/aria/orchestrator/execution_plugin/ctx_proxy/server.py
+++ b/aria/orchestrator/execution_plugin/ctx_proxy/server.py
@@ -128,7 +128,7 @@ class CtxProxy(object):
 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.
+# log mapi is chosen 

incubator-ariatosca git commit: fix1 [Forced Update!]

2017-05-22 Thread mxmrlv
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-185-NullPool-logging-messages-appear-during-execution 
1f093d06f -> 95cc3d100 (forced update)


fix1


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

Branch: refs/heads/ARIA-185-NullPool-logging-messages-appear-during-execution
Commit: 95cc3d1002889e2b83a19fc6b620bdf9d77245b0
Parents: 57555fe
Author: max-orlov 
Authored: Mon May 22 19:07:37 2017 +0300
Committer: max-orlov 
Committed: Mon May 22 22:34:36 2017 +0300

--
 aria/orchestrator/context/common.py|  4 
 aria/orchestrator/context/operation.py | 17 ++---
 .../execution_plugin/ctx_proxy/server.py   |  2 +-
 aria/orchestrator/workflows/executor/process.py|  3 +--
 .../execution_plugin/test_ctx_proxy_server.py  |  3 ++-
 tests/orchestrator/workflows/executor/__init__.py  |  6 +-
 6 files changed, 23 insertions(+), 12 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/95cc3d10/aria/orchestrator/context/common.py
--
diff --git a/aria/orchestrator/context/common.py 
b/aria/orchestrator/context/common.py
index 3918408..c98e026 100644
--- a/aria/orchestrator/context/common.py
+++ b/aria/orchestrator/context/common.py
@@ -194,7 +194,3 @@ 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/95cc3d10/aria/orchestrator/context/operation.py
--
diff --git a/aria/orchestrator/context/operation.py 
b/aria/orchestrator/context/operation.py
index 68a02aa..e0eb927 100644
--- a/aria/orchestrator/context/operation.py
+++ b/aria/orchestrator/context/operation.py
@@ -29,10 +29,11 @@ class BaseOperationContext(BaseContext):
 Context object used during operation creation and execution
 """
 
-def __init__(self, task_id, actor_id, **kwargs):
+def __init__(self, task_id, actor_id, instantiated_from_dict=False, 
**kwargs):
 self._task_id = task_id
 self._actor_id = actor_id
 self._thread_local = threading.local()
+self._instantiated_from_dict = instantiated_from_dict
 logger_level = kwargs.pop('logger_level', None)
 super(BaseOperationContext, self).__init__(**kwargs)
 self._register_logger(task_id=self.task.id, level=logger_level)
@@ -90,14 +91,24 @@ 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,
+   instantiated_from_dict=True,
+   **kwargs)
 
+def __del__(self):
+self.close()
+
+def close(self):
+if self._instantiated_from_dict:
+self.model.log._session.remove()
+self.model.log._engine.dispose()
 
 class NodeOperationContext(BaseOperationContext):
 """

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/95cc3d10/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 ef25491..e3496b9 100644
--- a/aria/orchestrator/execution_plugin/ctx_proxy/server.py
+++ b/aria/orchestrator/execution_plugin/ctx_proxy/server.py
@@ -128,7 +128,7 @@ class CtxProxy(object):
 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.
+# log mapi is chosen 

incubator-ariatosca git commit: fix1

2017-05-22 Thread mxmrlv
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-185-NullPool-logging-messages-appear-during-execution 
57555fe91 -> 1f093d06f


fix1


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

Branch: refs/heads/ARIA-185-NullPool-logging-messages-appear-during-execution
Commit: 1f093d06ff8ba3ec2d14716ae1d05530c8d0e7f9
Parents: 57555fe
Author: max-orlov 
Authored: Mon May 22 19:07:37 2017 +0300
Committer: max-orlov 
Committed: Mon May 22 19:10:13 2017 +0300

--
 aria/orchestrator/context/common.py   |  4 
 aria/orchestrator/context/operation.py| 14 +++---
 .../orchestrator/execution_plugin/ctx_proxy/server.py |  2 +-
 aria/orchestrator/workflows/executor/process.py   |  4 ++--
 .../execution_plugin/test_ctx_proxy_server.py |  3 ++-
 tests/orchestrator/workflows/executor/__init__.py |  5 +
 6 files changed, 21 insertions(+), 11 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/1f093d06/aria/orchestrator/context/common.py
--
diff --git a/aria/orchestrator/context/common.py 
b/aria/orchestrator/context/common.py
index 3918408..c98e026 100644
--- a/aria/orchestrator/context/common.py
+++ b/aria/orchestrator/context/common.py
@@ -194,7 +194,3 @@ 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/1f093d06/aria/orchestrator/context/operation.py
--
diff --git a/aria/orchestrator/context/operation.py 
b/aria/orchestrator/context/operation.py
index 68a02aa..47ebddb 100644
--- a/aria/orchestrator/context/operation.py
+++ b/aria/orchestrator/context/operation.py
@@ -29,10 +29,11 @@ class BaseOperationContext(BaseContext):
 Context object used during operation creation and execution
 """
 
-def __init__(self, task_id, actor_id, **kwargs):
+def __init__(self, task_id, actor_id, instantiated_from_dict=False, 
**kwargs):
 self._task_id = task_id
 self._actor_id = actor_id
 self._thread_local = threading.local()
+self._instantiated_from_dict = instantiated_from_dict
 logger_level = kwargs.pop('logger_level', None)
 super(BaseOperationContext, self).__init__(**kwargs)
 self._register_logger(task_id=self.task.id, level=logger_level)
@@ -90,14 +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,
+   instantiated_from_dict=True,
+   **kwargs)
 
+def close(self):
+if self._instantiated_from_dict:
+self.model.log._session.remove()
+self.model.log._engine.dispose()
 
 class NodeOperationContext(BaseOperationContext):
 """

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/1f093d06/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 ef25491..e3496b9 100644
--- a/aria/orchestrator/execution_plugin/ctx_proxy/server.py
+++ b/aria/orchestrator/execution_plugin/ctx_proxy/server.py
@@ -128,7 +128,7 @@ class CtxProxy(object):
 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.
+# log mapi is chosen arbitrarily.
 

Re: [UPDATE] Work on ARIA-149: Support intrinsic functions in "dependencies" operation configuration

2017-05-22 Thread Tal Liron
I see Avia merged ARIA-180, so definitely will convert to one-to-many now.

The reason the original values are preserved are the same reason all our
original values are preserved. The idea is that we don't want to make
service instance models dependent on service template models. They are
instantiated from them, but these foreign-key fields are all nullable. The
reason is to allow freedom for orchestration policies with on-the-fly
changes the topology. For example, a special kind of scaling policy might
involve adding an Nginx load balancer node for HTTP connections. However,
what if the user did not have a node template for that kind of the node? If
we require the creation of an OperationTemplate for every Operation, we
make this awkward, because it changes the original template. So, anyway,
this has been our principle until now and I suggest we continue this for
operations, too.

Let's walk through a simple example.

   1. A service template with a simple compute node, with a single "dazzle"
   operation on a custom interface, and this "dazzle" has a single
   implementation string, "dazzle_node.sh", with a single string input:
   "duration"="forever". To keep things simple, no special configuration is
   added via dependencies.
   2. The parser will create an OperationTemplate with these values:
  1. implementation = "dazzle_node.sh"
  2. inputs = {
 1. duration = "forever"}
  3. plugin_specification = None
  4. configuration = {}
  3. During initial instantiation phase, the above values will be
   copied to Operation model as is. At this early stage, "function" and
   "arguments" are still both empty.
   4. Now during instantiation *configuration* phase, we see that this
   operation uses the default execution plugin (plugin_specification=None).
   Because this node is a host, it will be configured to be a *remote*
   operation with very specific arguments. Also, we decided that for all
   plugins inputs get sent as *extra* arguments. So, here are all final
   values for Operation:
  1. implementation = "dazzle_node.sh"
  2. inputs = {
 1. duration = "forever"}
  3. configuration = {}
  4. plugin = None
  5. function = "aria.orchestrator.execution_
  plugin.operations.run_script_with_ssh"
  6. arguments = {
  1. process = {}
 2. script_path = "create_node.sh"
 3. use_sudo = False
 4. hide_output = []
 5. fabric_env = {user: DEFAULT_USER, password: DEFAULT_PASSWORD,
 key: None, key_filename: None}
 6. duration = forever}

So, you can see here that if we change "implementation" to be
"aria.orchestrator.execution_plugin.operations.run_script_with_ssh" (like
we did before), the implementation is hidden in one of the arguments
(script_path), which would be very tricky for users to discover. That's an
implementation detail of the execution plugin, not something you want to
rely on. Also, if we merge everything into inputs, the original distinction
between what is an input and what is an implementation detail is lost.

The fields in this suggested scheme have distinct and clear meanings:

   1. "implementation" and "inputs" are directly from the TOSCA spec. They
   are preserved and never change.
   2. "configuration" is an extra optional ARIA extension dict allowing
   users to configure how the plugin will execute the operation.
   3. "function" and "arguments" are internal implementation details of the
   ARIA orchestrator. In a nicely straightforward sense they become a Python
   function with kwargs.

How this clears things up!

On Sun, May 21, 2017 at 7:18 AM, Ran Ziv  wrote:

> +1 for examples, or perhaps a link to specific code sections.
>
> From what I did understand though, before we talk about additional changes,
> I'm not at all sure I'm in favor of the current ones.
>
> First, the many-to-many relationship sounds in contrast to what Avia is
> currently working on with (changing Parameters relationship type)
>
> Second, so what you're saying is that now Operation models will have both
> "implementation" and "function", and both "inputs" and "arguments"? This
> seems very confusing.
> I'm both not convinced the original values are needed at that stage (can we
> have an actual use case?), but even if they are, do we really need to keep
> all four on the same model?
> How about having the original values on the OperationTemplate, and the
> "coerced values" (for lack of a better term..) on the Operation model?
>
>
>
> On Sun, May 21, 2017 at 11:45 AM, Arthur Berezin 
> wrote:
>
> > On Sat, May 20, 2017 at 3:47 AM Tal Liron  wrote:
> >
> > > Phew! Everything seems to work now: functions are parsed and evaluated
> > > properly. But there are some changes that require explaining.
> > >
> > > The "configuration" field in OperationTemplate and Operation models is
> > now
> > > a many-to-many with Parameter. This allows the 

incubator-ariatosca git commit: NullPool logging messages appear during execution

2017-05-22 Thread mxmrlv
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()



[3/4] incubator-ariatosca git commit: added documentation and testing

2017-05-22 Thread mxmrlv
added documentation and testing


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

Branch: refs/heads/ARIA-258-Convert-runtime-properties-to-attributes
Commit: 4e8510573d27377d88c9e7811153c2e1c96a9144
Parents: 82d9616
Author: max-orlov 
Authored: Mon May 22 16:46:50 2017 +0300
Committer: max-orlov 
Committed: Mon May 22 16:46:50 2017 +0300

--
 aria/orchestrator/context/common.py  | 169 ++
 tests/orchestrator/context/test_operation.py |  48 --
 2 files changed, 147 insertions(+), 70 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/4e851057/aria/orchestrator/context/common.py
--
diff --git a/aria/orchestrator/context/common.py 
b/aria/orchestrator/context/common.py
index 07596f6..a5c01fa 100644
--- a/aria/orchestrator/context/common.py
+++ b/aria/orchestrator/context/common.py
@@ -203,69 +203,132 @@ class BaseContext(object):
 
 
 class _InstrumentedCollection(object):
-def _get_instrumented_collection(self, key, value):
+
+def __init__(self,
+ model,
+ parent,
+ field_name=None,
+ item_cls=None,
+ seq=None,
+ is_top_level=True,
+ **kwargs):
+self._model = model
+self._parent = parent
+self._field_name = field_name
+self._item_cls = item_cls
+self._is_top_level = is_top_level
+self._load(seq, **kwargs)
+
+def _load(self, seq, **kwargs):
+"""
+Instantiates the object from existing seq.
+
+:param seq: the original sequence to load from  
+:return: 
+"""
+raise NotImplementedError
+
+def _set_field(self, collection, key, value):
+"""
+enables updating the current change in the ancestors 
+:param collection: the collection to change
+:param key: the key for the specific field
+:param value: the new value
+:return: 
+"""
+raise NotImplementedError
+
+def _set(self, key, value):
+"""
+set the changes for the current object (not in the db)
+
+:param key: 
+:param value: 
+:return: 
+"""
+raise NotImplementedError
+
+def _instrument(self, key, value):
+"""
+Instruments any collection to track changes (and ease of access)
+:param key: 
+:param value: 
+:return: 
+"""
 if isinstance(value, _InstrumentedCollection):
 return value
 elif isinstance(value, dict):
-return _InstrumentedDict(self._model, self, key, seq=value)
+instrumentation_cls = _InstrumentedDict
 elif isinstance(value, list):
-return _InstrumentedList(self._model, self, key, seq=value)
+instrumentation_cls = _InstrumentedList
+else:
+return value
 
-return value
+return instrumentation_cls(self._model, self, key, self._item_cls, 
value, False)
 
 def _raw_value(self, value):
-if self._item_cls and isinstance(value, self._item_cls):
+"""
+Get the raw value. 
+:param value: 
+:return: 
+"""
+if self._is_top_level and isinstance(value, self._item_cls):
 return value.value
 return value
 
 def _encapsulate_value(self, key, value):
+"""
+Create a new item cls if needed.
+:param key: 
+:param value: 
+:return: 
+"""
 if isinstance(value, self._item_cls):
 return value
 # If it is not wrapped
 return self._item_cls.wrap(key, value)
 
 def __setitem__(self, key, value):
+"""
+Update the values in both the local and the db locations.  
+:param key: 
+:param value: 
+:return: 
+"""
 self._set(key, value)
-if self._item_cls:
-# We are at the top level
+mapi = getattr(self._model, self._item_cls.__modelname__)
+if self._is_top_level:
 field = getattr(self._parent, self._field_name)
-mapi = getattr(self._model, self._item_cls.__modelname__)
-
+# We are at the top level
 if key in field:
 # Is this a existing field
-value = self._set_parent(field, key, value)
+value = self._set_field(field, key, value)
 

[4/4] incubator-ariatosca git commit: created new module and linting

2017-05-22 Thread mxmrlv
created new module and linting


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

Branch: refs/heads/ARIA-258-Convert-runtime-properties-to-attributes
Commit: 0b1a306f6905fbe838e96108f65d47cf075efdbb
Parents: 4e85105
Author: max-orlov 
Authored: Mon May 22 17:52:02 2017 +0300
Committer: max-orlov 
Committed: Mon May 22 17:52:02 2017 +0300

--
 aria/orchestrator/context/common.py | 144 ++-
 .../context/test_attribute_suggaring.py | 253 +++
 tests/orchestrator/context/test_operation.py| 236 -
 3 files changed, 331 insertions(+), 302 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/0b1a306f/aria/orchestrator/context/common.py
--
diff --git a/aria/orchestrator/context/common.py 
b/aria/orchestrator/context/common.py
index a5c01fa..8b83883 100644
--- a/aria/orchestrator/context/common.py
+++ b/aria/orchestrator/context/common.py
@@ -16,9 +16,7 @@
 """
 A common context for both workflow and operation
 """
-import copy
 import logging
-import collections
 from contextlib import contextmanager
 from functools import partial
 
@@ -219,41 +217,38 @@ class _InstrumentedCollection(object):
 self._is_top_level = is_top_level
 self._load(seq, **kwargs)
 
+@property
+def _raw(self):
+raise NotImplementedError
+
 def _load(self, seq, **kwargs):
 """
 Instantiates the object from existing seq.
-
-:param seq: the original sequence to load from  
-:return: 
-"""
-raise NotImplementedError
 
-def _set_field(self, collection, key, value):
-"""
-enables updating the current change in the ancestors 
-:param collection: the collection to change
-:param key: the key for the specific field
-:param value: the new value
-:return: 
+:param seq: the original sequence to load from
+:return:
 """
 raise NotImplementedError
 
 def _set(self, key, value):
 """
 set the changes for the current object (not in the db)
-
-:param key: 
-:param value: 
-:return: 
+
+:param key:
+:param value:
+:return:
 """
 raise NotImplementedError
 
+def _del(self, collection, key):
+raise NotImplementedError
+
 def _instrument(self, key, value):
 """
 Instruments any collection to track changes (and ease of access)
-:param key: 
-:param value: 
-:return: 
+:param key:
+:param value:
+:return:
 """
 if isinstance(value, _InstrumentedCollection):
 return value
@@ -268,9 +263,9 @@ class _InstrumentedCollection(object):
 
 def _raw_value(self, value):
 """
-Get the raw value. 
-:param value: 
-:return: 
+Get the raw value.
+:param value:
+:return:
 """
 if self._is_top_level and isinstance(value, self._item_cls):
 return value.value
@@ -279,9 +274,9 @@ class _InstrumentedCollection(object):
 def _encapsulate_value(self, key, value):
 """
 Create a new item cls if needed.
-:param key: 
-:param value: 
-:return: 
+:param key:
+:param value:
+:return:
 """
 if isinstance(value, self._item_cls):
 return value
@@ -290,30 +285,53 @@ class _InstrumentedCollection(object):
 
 def __setitem__(self, key, value):
 """
-Update the values in both the local and the db locations.  
-:param key: 
-:param value: 
-:return: 
+Update the values in both the local and the db locations.
+:param key:
+:param value:
+:return:
 """
 self._set(key, value)
-mapi = getattr(self._model, self._item_cls.__modelname__)
 if self._is_top_level:
-field = getattr(self._parent, self._field_name)
 # We are at the top level
-if key in field:
-# Is this a existing field
-value = self._set_field(field, key, value)
-else:
-value = self._set_field(field, key, 
self._encapsulate_value(key, value))
+field = getattr(self._parent, self._field_name)
+mapi = getattr(self._model, self._item_cls.__modelname__)
+value = 

[2/4] incubator-ariatosca git commit: added list support

2017-05-22 Thread mxmrlv
added list support


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

Branch: refs/heads/ARIA-258-Convert-runtime-properties-to-attributes
Commit: 82d9616661d1c6797e1d5561a5379b97b0070942
Parents: b2014b9
Author: max-orlov 
Authored: Mon May 22 15:21:53 2017 +0300
Committer: max-orlov 
Committed: Mon May 22 15:21:53 2017 +0300

--
 aria/orchestrator/context/common.py  | 128 --
 tests/orchestrator/context/test_operation.py |  44 ++--
 2 files changed, 125 insertions(+), 47 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/82d96166/aria/orchestrator/context/common.py
--
diff --git a/aria/orchestrator/context/common.py 
b/aria/orchestrator/context/common.py
index d85f284..07596f6 100644
--- a/aria/orchestrator/context/common.py
+++ b/aria/orchestrator/context/common.py
@@ -202,7 +202,49 @@ class BaseContext(object):
 self.model.log._engine.dispose()
 
 
-class _InstrumentedDict(dict):
+class _InstrumentedCollection(object):
+def _get_instrumented_collection(self, key, value):
+if isinstance(value, _InstrumentedCollection):
+return value
+elif isinstance(value, dict):
+return _InstrumentedDict(self._model, self, key, seq=value)
+elif isinstance(value, list):
+return _InstrumentedList(self._model, self, key, seq=value)
+
+return value
+
+def _raw_value(self, value):
+if self._item_cls and isinstance(value, self._item_cls):
+return value.value
+return value
+
+def _encapsulate_value(self, key, value):
+if isinstance(value, self._item_cls):
+return value
+# If it is not wrapped
+return self._item_cls.wrap(key, value)
+
+def __setitem__(self, key, value):
+self._set(key, value)
+if self._item_cls:
+# We are at the top level
+field = getattr(self._parent, self._field_name)
+mapi = getattr(self._model, self._item_cls.__modelname__)
+
+if key in field:
+# Is this a existing field
+value = self._set_parent(field, key, value)
+else:
+value = self._set_parent(field, key, 
self._encapsulate_value(key, value))
+
+mapi.update(value)
+else:
+self._set(key, value)
+# We are not at the top level
+self._parent[self._field_name] = self
+
+
+class _InstrumentedDict(_InstrumentedCollection, dict):
 def __init__(self, model, parent, field_name=None, item_cls=None, 
seq=None, **kwargs):
 self._model = model
 self._parent = parent
@@ -223,12 +265,7 @@ class _InstrumentedDict(dict):
 self[key] = value
 
 def __getitem__(self, key):
-value = dict.__getitem__(self, key)
-if isinstance(value, _InstrumentedDict):
-return value
-elif isinstance(value, dict):
-return _InstrumentedDict(self._model, self, key, seq=value)
-return value
+return self._get_instrumented_collection(key, dict.__getitem__(self, 
key))
 
 def values(self):
 return [self[key] for key in self.keys()]
@@ -240,40 +277,55 @@ class _InstrumentedDict(dict):
 return (key for key in self.keys())
 
 def _set(self, key, value):
-if self._item_cls and isinstance(value, self._item_cls):
-value = value.value
-dict.__setitem__(self, key, value)
+dict.__setitem__(self, key, self._raw_value(value))
 
-def __setitem__(self, key, value):
-self._set(key, value)
-def _set_parent(value):
-if key in field and isinstance(field[key], self._item_cls):
-if isinstance(field[key], dict):
-field[key].clear()
-field[key].value = value
-else:
-field[key] = value
-return field[key]
+def _set_parent(self, field, key, value):
+if key in field and isinstance(field[key], self._item_cls):
+if isinstance(field[key], dict):
+field[key].clear()
+field[key].value = value
+else:
+field[key] = value
+return field[key]
+
+
+class _InstrumentedList(list, _InstrumentedCollection):
+def __init__(self, model, parent, field_name=None, item_cls=None, 
seq=None, **kwargs):
+self._model = model
+self._parent = parent
+self._field_name = 

[1/4] incubator-ariatosca git commit: fixed dict

2017-05-22 Thread mxmrlv
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-258-Convert-runtime-properties-to-attributes ff3d9647d -> 
0b1a306f6


fixed dict


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

Branch: refs/heads/ARIA-258-Convert-runtime-properties-to-attributes
Commit: b2014b9341398a431703c1ff7cde3722b72c53bc
Parents: ff3d964
Author: max-orlov 
Authored: Mon May 22 14:28:44 2017 +0300
Committer: max-orlov 
Committed: Mon May 22 14:28:44 2017 +0300

--
 aria/orchestrator/context/common.py  | 181 +++---
 tests/orchestrator/context/test_operation.py |  78 ++
 2 files changed, 108 insertions(+), 151 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/b2014b93/aria/orchestrator/context/common.py
--
diff --git a/aria/orchestrator/context/common.py 
b/aria/orchestrator/context/common.py
index e1dbf5f..d85f284 100644
--- a/aria/orchestrator/context/common.py
+++ b/aria/orchestrator/context/common.py
@@ -202,146 +202,78 @@ class BaseContext(object):
 self.model.log._engine.dispose()
 
 
-class _InstrumentedCollection(dict):
-def __init__(self, parent, model, actor=None, field_name=None, 
nested_key=None, **kwargs):
-super(_InstrumentedCollection, self).__init__(**kwargs)
-
-self._parent = parent
+class _InstrumentedDict(dict):
+def __init__(self, model, parent, field_name=None, item_cls=None, 
seq=None, **kwargs):
 self._model = model
-self._item_cls = self._model.parameter.model_cls
-self._nested_key = nested_key
-
-# Actor is not None only at the top level, where it should be updated
-self._actor = actor
+self._parent = parent
 self._field_name = field_name
-if self._actor:
-# Only the root parent has an _actor
-self._init_from_parent()
-
-def __getitem__(self, key):
-if self._nested_key is None:
-value = self._parent[key].value
-elif isinstance(self, dict):
-value = dict.__getitem__(self, key)
-else:
-raise BaseException()
-
-if isinstance(value, (list, _InstrumentedList)):
-return _InstrumentedList(self, self._model, nested_key=key, 
_list=value)
-elif isinstance(value, dict):
-return _InstrumentedDict(self, self._model, nested_key=key, 
**value)
-else:
-return value
-
-def _set(self, i, y):
-self._insert(i, y)
-if self._nested_key is None:
-nested_key = i
-if not isinstance(y, self._item_cls):
-y = self._item_cls.wrap(i, y)
-self._model.parameter.put(y)
-else:
-nested_key = self._nested_key
-
-self._update_parent(nested_key, i, y)
-return y
-
-def _init_from_parent(self):
-for key, value in self._parent.items():
-self._insert(key, value)
-
-def _insert(self, key, value):
-value = value.value if isinstance(value, self._item_cls) else value
-super(_InstrumentedCollection, self).__setitem__(key, value)
-
-def _update_parent(self, nested_key, key, value):
-if isinstance(self._parent, _InstrumentedCollection):
-self._parent._update_from_child(nested_key, {key: value})
-else:
-if self._nested_key is not None:
-self._parent[nested_key] = {key: value}
-else:
-self._parent[key] = value
-
-def _update_from_child(self, nested_key, value):
-self[nested_key] = value
-if isinstance(value, self._item_cls):
-# We are the the top level
-getattr(self._actor, self._field_name)[nested_key] = value
-self._model.parameter.update(value)
+self._item_cls = item_cls
+self._load(seq, **kwargs)
 
-def _update_actor(self, key, value):
-raise NotImplementedError
+def _load(self, seq=None, **kwargs):
+seq = dict((key, value.value if isinstance(value, self._item_cls) else 
value)
+   for key, value in (seq or {}).items())
+super(_InstrumentedDict, self).__init__(seq, **kwargs)
 
-def __setitem__(self, key, value):
-value = self._set(key, value)
-
-if self._actor:
-self._update_actor(key, value)
-
-if isinstance(value, self._item_cls):
-self._model.parameter.update(value)
-
-
-class 

[incubator-ariatosca] Git Push Summary

2017-05-22 Thread ran
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-162-colorama-open-file-error [deleted] 3d22d36fc


incubator-ariatosca git commit: ARIA-162 Upgrade Colorama library version

2017-05-22 Thread ran
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/master 5798bbfc7 -> 3d22d36fc


ARIA-162 Upgrade Colorama library version

Upgraded the Colorama library version - This should
take care of the closed-stream error that appeared
sporadically after test runs.


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

Branch: refs/heads/master
Commit: 3d22d36fc5c9fb780facfb8880143dda46d16f6f
Parents: 5798bbf
Author: Ran Ziv 
Authored: Mon May 22 16:44:00 2017 +0300
Committer: Ran Ziv 
Committed: Mon May 22 16:44:00 2017 +0300

--
 requirements.in  | 2 +-
 requirements.txt | 5 +
 2 files changed, 2 insertions(+), 5 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/3d22d36f/requirements.in
--
diff --git a/requirements.in b/requirements.in
index 3950140..1dd5b1f 100644
--- a/requirements.in
+++ b/requirements.in
@@ -29,7 +29,7 @@ wagon==0.6.0
 bottle>=0.12.0, <0.13
 Fabric>=1.13.0, <1.14
 click>=4.1, < 5.0
-colorama>=0.3.3, < 0.3.5
+colorama>=0.3.7, <= 0.3.9
 PrettyTable>=0.7,<0.8
 click_didyoumean==0.0.3
 backports.shutil_get_terminal_size==1.0.0

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/3d22d36f/requirements.txt
--
diff --git a/requirements.txt b/requirements.txt
index 3accaa3..f7efce9 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -27,7 +27,7 @@ cffi==1.10.0  # via cryptography
 click==4.1
 click_didyoumean==0.0.3
 clint==0.5.1
-colorama==0.3.4
+colorama==0.3.9
 cryptography==1.8.1   # via paramiko
 decorator==4.0.11 # via networkx
 enum34==1.1.6 # via cryptography
@@ -57,6 +57,3 @@ six==1.10.0   # via cryptography, packaging, 
retrying
 sqlalchemy==1.1.6
 wagon==0.6.0
 wheel==0.29.0 # via wagon
-
-# The following packages are considered to be unsafe in a requirements file:
-# setuptools# via cryptography



incubator-ariatosca git commit: Add property model [Forced Update!]

2017-05-22 Thread avia
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-180-convert-parameter-to-one-to-many 86db8307f -> de48d9989 
(forced update)


Add property model


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

Branch: refs/heads/ARIA-180-convert-parameter-to-one-to-many
Commit: de48d9989fc3083e1dd83d6619274f3c434727a2
Parents: 23afaf0
Author: Avia Efrat 
Authored: Mon May 22 12:05:30 2017 +0300
Committer: Avia Efrat 
Committed: Mon May 22 16:51:52 2017 +0300

--
 aria/modeling/models.py |  16 +-
 aria/modeling/service_common.py | 200 ++-
 aria/modeling/service_instance.py   |  24 +--
 aria/modeling/service_template.py   |  24 +--
 .../simple_v1_0/modeling/__init__.py|  22 +-
 tests/cli/test_service_templates.py |   2 +-
 tests/mock/models.py|  13 +-
 tests/modeling/test_models.py   |   4 +-
 8 files changed, 259 insertions(+), 46 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/de48d998/aria/modeling/models.py
--
diff --git a/aria/modeling/models.py b/aria/modeling/models.py
index d7b417b..6d43327 100644
--- a/aria/modeling/models.py
+++ b/aria/modeling/models.py
@@ -73,8 +73,9 @@ __all__ = (
 
 # Common service models
 'Parameter',
-'Input'
-'Output'
+'Input',
+'Output',
+'Property',
 'Type',
 'Metadata',
 
@@ -214,13 +215,19 @@ class Parameter(aria_declarative_base, 
service_common.ParameterBase):
 
 class Input(aria_declarative_base, service_common.InputBase):
 # Temporarily, until we will separate the Parameter model into Input, 
Output, Property and
-# Attribute, Parameter will represent only Property and Attribute.
+# Attribute, Parameter will represent only Attribute.
 pass
 
 
 class Output(aria_declarative_base, service_common.OutputBase):
 # Temporarily, until we will separate the Parameter model into Input, 
Output, Property and
-# Attribute, Parameter will represent only Property and Attribute.
+# Attribute, Parameter will represent only Attribute.
+pass
+
+
+class Property(aria_declarative_base, service_common.PropertyBase):
+# Temporarily, until we will separate the Parameter model into Input, 
Output, Property and
+# Attribute, Parameter will represent only Attribute.
 pass
 
 
@@ -293,6 +300,7 @@ models_to_register = [
 Parameter,
 Input,
 Output,
+Property,
 Type,
 Metadata,
 

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/de48d998/aria/modeling/service_common.py
--
diff --git a/aria/modeling/service_common.py b/aria/modeling/service_common.py
index 0652a5a..534e466 100644
--- a/aria/modeling/service_common.py
+++ b/aria/modeling/service_common.py
@@ -228,7 +228,7 @@ class ParameterBase(TemplateModelMixin, 
caching.HasCachedMethods):
 description=description)
 
 
-# TODO dry this code. currently it is a copy of ParameterBase
+# TODO dry this code. currently it is almost a copy of ParameterBase
 class OutputBase(TemplateModelMixin, caching.HasCachedMethods):
 """
 Represents a typed value. The value can contain nested intrinsic functions.
@@ -532,7 +532,7 @@ class TypeBase(InstanceModelMixin):
 return [self] + (self.parent.hierarchy if self.parent else [])
 
 
-# TODO dry this code. currently it is a copy of ParameterBase
+# TODO dry this code. currently it is almost a copy of ParameterBase
 class InputBase(TemplateModelMixin, caching.HasCachedMethods):
 """
 Represents a typed value. The value can contain nested intrinsic functions.
@@ -729,6 +729,202 @@ class InputBase(TemplateModelMixin, 
caching.HasCachedMethods):
 description=description)
 
 
+# TODO dry this code. currently it is almost a copy of ParameterBase
+class PropertyBase(TemplateModelMixin, caching.HasCachedMethods):
+"""
+Represents a typed value. The value can contain nested intrinsic functions.
+
+This model can be used as the ``container_holder`` argument for 
:func:`functions.evaluate`.
+
+:ivar name: Name
+:vartype name: basestring
+:ivar type_name: Type name
+:vartype type_name: basestring
+:ivar value: Value
+:ivar description: Description
+:vartype description: basestring
+"""
+
+__tablename__ = 'property'
+
+

incubator-ariatosca git commit: ARIA-162 Upgrade Colorama library version

2017-05-22 Thread ran
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-162-colorama-open-file-error [created] 3d22d36fc


ARIA-162 Upgrade Colorama library version

Upgraded the Colorama library version - This should
take care of the closed-stream error that appeared
sporadically after test runs.


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

Branch: refs/heads/ARIA-162-colorama-open-file-error
Commit: 3d22d36fc5c9fb780facfb8880143dda46d16f6f
Parents: 5798bbf
Author: Ran Ziv 
Authored: Mon May 22 16:44:00 2017 +0300
Committer: Ran Ziv 
Committed: Mon May 22 16:44:00 2017 +0300

--
 requirements.in  | 2 +-
 requirements.txt | 5 +
 2 files changed, 2 insertions(+), 5 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/3d22d36f/requirements.in
--
diff --git a/requirements.in b/requirements.in
index 3950140..1dd5b1f 100644
--- a/requirements.in
+++ b/requirements.in
@@ -29,7 +29,7 @@ wagon==0.6.0
 bottle>=0.12.0, <0.13
 Fabric>=1.13.0, <1.14
 click>=4.1, < 5.0
-colorama>=0.3.3, < 0.3.5
+colorama>=0.3.7, <= 0.3.9
 PrettyTable>=0.7,<0.8
 click_didyoumean==0.0.3
 backports.shutil_get_terminal_size==1.0.0

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/3d22d36f/requirements.txt
--
diff --git a/requirements.txt b/requirements.txt
index 3accaa3..f7efce9 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -27,7 +27,7 @@ cffi==1.10.0  # via cryptography
 click==4.1
 click_didyoumean==0.0.3
 clint==0.5.1
-colorama==0.3.4
+colorama==0.3.9
 cryptography==1.8.1   # via paramiko
 decorator==4.0.11 # via networkx
 enum34==1.1.6 # via cryptography
@@ -57,6 +57,3 @@ six==1.10.0   # via cryptography, packaging, 
retrying
 sqlalchemy==1.1.6
 wagon==0.6.0
 wheel==0.29.0 # via wagon
-
-# The following packages are considered to be unsafe in a requirements file:
-# setuptools# via cryptography



[incubator-ariatosca] Git Push Summary

2017-05-22 Thread ran
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-208-Missing-back-refrences-for-models [deleted] 5798bbfc7


[01/19] incubator-ariatosca git commit: ARIA-156 Better handle exceptions in the process executor [Forced Update!]

2017-05-22 Thread ran
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-208-Missing-back-refrences-for-models d1628c395 -> 5798bbfc7 
(forced update)


ARIA-156 Better handle exceptions in the process executor

Previously, if an exception was raised during the starting of a task,
the task's process was permanently blocked on receiving a message.

The reason was that the exception caused the 'listener thread' to
not send a response to the task's process, as the exception was not
handled inside the 'with' block of the listener thread.

The first change I introduced was to wrap the yielding of the message and
the response inside a try-except-finally block, so the exception will be
handled within the 'with' scope, and to ensure a response is sent to the
task's process.

The second change is to move the sending of the 'task started' message in
the task's process to a place where encountering an exception will be
handled via sending a 'task failed' message back to the listener thread.


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

Branch: refs/heads/ARIA-208-Missing-back-refrences-for-models
Commit: 1cb3086f38bc35a6a5e588aa5e340cb4fa5cacf5
Parents: 8553977
Author: Avia Efrat 
Authored: Sun May 7 11:42:58 2017 +0300
Committer: Avia Efrat 
Committed: Sun May 7 14:44:01 2017 +0300

--
 aria/orchestrator/workflows/executor/process.py | 11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/1cb3086f/aria/orchestrator/workflows/executor/process.py
--
diff --git a/aria/orchestrator/workflows/executor/process.py 
b/aria/orchestrator/workflows/executor/process.py
index 2378e0a..8481406 100644
--- a/aria/orchestrator/workflows/executor/process.py
+++ b/aria/orchestrator/workflows/executor/process.py
@@ -213,8 +213,13 @@ class ProcessExecutor(base.BaseExecutor):
 with contextlib.closing(self._server_socket.accept()[0]) as connection:
 message = _recv_message(connection)
 response = {}
-yield message, response
-_send_message(connection, response)
+try:
+yield message, response
+except BaseException as e:
+response['exception'] = exceptions.wrap_if_needed(e)
+raise
+finally:
+_send_message(connection, response)
 
 def _handle_task_started_request(self, task_id, **kwargs):
 self._task_started(self._tasks[task_id])
@@ -378,7 +383,6 @@ def _main():
 task_id = arguments['task_id']
 port = arguments['port']
 messenger = _Messenger(task_id=task_id, port=port)
-messenger.started()
 
 implementation = arguments['implementation']
 operation_inputs = arguments['operation_inputs']
@@ -390,6 +394,7 @@ def _main():
 
 with instrumentation.track_changes() as instrument:
 try:
+messenger.started()
 ctx = 
context_dict['context_cls'].deserialize_from_dict(**context_dict['context'])
 _patch_session(ctx=ctx, messenger=messenger, instrument=instrument)
 task_func = imports.load_attribute(implementation)



[06/19] incubator-ariatosca git commit: ARIA-165 Make node name suffix UUIDs become more readable

2017-05-22 Thread ran
ARIA-165 Make node name suffix UUIDs become more readable


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

Branch: refs/heads/ARIA-208-Missing-back-refrences-for-models
Commit: 1febf80dee57b837d2ed937bcdaa080bdc3bd822
Parents: b11fbc9
Author: max-orlov 
Authored: Mon May 8 15:25:37 2017 +0300
Committer: max-orlov 
Committed: Tue May 9 11:24:07 2017 +0300

--
 aria/modeling/service_template.py | 8 ++--
 aria/parser/modeling/context.py   | 5 -
 2 files changed, 6 insertions(+), 7 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/1febf80d/aria/modeling/service_template.py
--
diff --git a/aria/modeling/service_template.py 
b/aria/modeling/service_template.py
index 7fab4fc..f721b64 100644
--- a/aria/modeling/service_template.py
+++ b/aria/modeling/service_template.py
@@ -549,9 +549,13 @@ class NodeTemplateBase(TemplateModelMixin):
 ('requirement_templates', 
formatting.as_raw_list(self.requirement_templates
 
 def instantiate(self, container):
-context = ConsumptionContext.get_thread_local()
 from . import models
-name = context.modeling.generate_node_id(self.name)
+if self.nodes:
+highest_name_suffix = max(int(n.name.rsplit('_', 1)[-1]) for n in 
self.nodes)
+suffix = highest_name_suffix + 1
+else:
+suffix = 1
+name = '{name}_{index}'.format(name=self.name, index=suffix)
 node = models.Node(name=name,
type=self.type,

description=deepcopy_with_locators(self.description),

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/1febf80d/aria/parser/modeling/context.py
--
diff --git a/aria/parser/modeling/context.py b/aria/parser/modeling/context.py
index dff5991..4a53641 100644
--- a/aria/parser/modeling/context.py
+++ b/aria/parser/modeling/context.py
@@ -67,11 +67,6 @@ class ModelingContext(object):
 if self.instance is not None:
 model_storage.service.put(self.instance)
 
-def generate_node_id(self, template_name):
-return self.node_id_format.format(
-template=template_name,
-id=self.generate_id())
-
 def generate_id(self):
 if self.id_type == IdType.LOCAL_SERIAL:
 return self._serial_id_counter.next()



[14/19] incubator-ariatosca git commit: ARIA-139 Support attributes

2017-05-22 Thread ran
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/60ea3ebb/extensions/aria_extension_tosca/simple_v1_0/definitions.py
--
diff --git a/extensions/aria_extension_tosca/simple_v1_0/definitions.py 
b/extensions/aria_extension_tosca/simple_v1_0/definitions.py
index b60a797..8564249 100644
--- a/extensions/aria_extension_tosca/simple_v1_0/definitions.py
+++ b/extensions/aria_extension_tosca/simple_v1_0/definitions.py
@@ -15,7 +15,7 @@
 
 from aria.utils.collections import FrozenDict
 from aria.utils.caching import cachedmethod
-from aria.parser import dsl_specification
+from aria.parser import implements_specification
 from aria.parser.presentation import (has_fields, short_form_field, 
allow_unknown_fields,
   primitive_field, primitive_list_field, 
object_field,
   object_list_field, object_dict_field,
@@ -35,7 +35,7 @@ from .modeling.interfaces import 
(get_and_override_input_definitions_from_type,
   
get_and_override_operation_definitions_from_type)
 
 @has_fields
-@dsl_specification('3.5.8', 'tosca-simple-1.0')
+@implements_specification('3.5.8', 'tosca-simple-1.0')
 class PropertyDefinition(ExtensiblePresentation):
 """
 A property definition defines a named, typed value and related data that 
can be associated with
@@ -86,7 +86,7 @@ class PropertyDefinition(ExtensiblePresentation):
 
 @primitive_field(str, default='supported', allowed=('supported', 
'unsupported', 'experimental',
 'deprecated'))
-@dsl_specification(section='3.5.8.3', spec='tosca-simple-1.0')
+@implements_specification(section='3.5.8.3', spec='tosca-simple-1.0')
 def status(self):
 """
 The optional status of the property relative to the specification or 
implementation.
@@ -121,7 +121,7 @@ class PropertyDefinition(ExtensiblePresentation):
 return get_property_constraints(context, self)
 
 @has_fields
-@dsl_specification('3.5.10', 'tosca-simple-1.0')
+@implements_specification('3.5.10', 'tosca-simple-1.0')
 class AttributeDefinition(ExtensiblePresentation):
 """
 An attribute definition defines a named, typed value that can be 
associated with an entity
@@ -190,7 +190,7 @@ class AttributeDefinition(ExtensiblePresentation):
 return get_data_type(context, self, 'type')
 
 @has_fields
-@dsl_specification('3.5.12', 'tosca-simple-1.0')
+@implements_specification('3.5.12', 'tosca-simple-1.0')
 class ParameterDefinition(PropertyDefinition):
 """
 A parameter definition is essentially a TOSCA property definition; 
however, it also allows a
@@ -225,7 +225,7 @@ class ParameterDefinition(PropertyDefinition):
 
 @short_form_field('implementation')
 @has_fields
-@dsl_specification('3.5.13-1', 'tosca-simple-1.0')
+@implements_specification('3.5.13-1', 'tosca-simple-1.0')
 class OperationDefinition(ExtensiblePresentation):
 """
 An operation definition defines a named function or procedure that can be 
bound to an
@@ -266,7 +266,7 @@ class OperationDefinition(ExtensiblePresentation):
 
 @allow_unknown_fields
 @has_fields
-@dsl_specification('3.5.14-1', 'tosca-simple-1.0')
+@implements_specification('3.5.14-1', 'tosca-simple-1.0')
 class InterfaceDefinition(ExtensiblePresentation):
 """
 An interface definition defines a named interface that can be associated 
with a Node or
@@ -352,7 +352,7 @@ class RelationshipDefinition(ExtensiblePresentation):
 
 @short_form_field('capability')
 @has_fields
-@dsl_specification('3.6.2', 'tosca-simple-1.0')
+@implements_specification('3.6.2', 'tosca-simple-1.0')
 class RequirementDefinition(ExtensiblePresentation):
 """
 The Requirement definition describes a named requirement (dependencies) of 
a TOSCA Node Type or
@@ -418,7 +418,7 @@ class RequirementDefinition(ExtensiblePresentation):
 
 @short_form_field('type')
 @has_fields
-@dsl_specification('3.6.1', 'tosca-simple-1.0')
+@implements_specification('3.6.1', 'tosca-simple-1.0')
 class CapabilityDefinition(ExtensiblePresentation):
 """
 A capability definition defines a named, typed set of data that can be 
associated with Node Type

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/60ea3ebb/extensions/aria_extension_tosca/simple_v1_0/filters.py
--
diff --git a/extensions/aria_extension_tosca/simple_v1_0/filters.py 
b/extensions/aria_extension_tosca/simple_v1_0/filters.py
index 617ce7a..838b505 100644
--- a/extensions/aria_extension_tosca/simple_v1_0/filters.py
+++ b/extensions/aria_extension_tosca/simple_v1_0/filters.py
@@ -14,7 +14,7 @@
 # limitations under the License.
 
 from aria.utils.caching import cachedmethod
-from aria.parser import dsl_specification
+from aria.parser import implements_specification
 from aria.parser.presentation 

[16/19] incubator-ariatosca git commit: ARIA-148 Enhance CLI show commands

2017-05-22 Thread ran
ARIA-148 Enhance CLI show commands

* Allow "--full" flag to provide a complete dump
* Allow "--json" and "--yaml" flags for dump in those formats
* Support for node graph and type hierarchies
* Some fixes for YAML dump for our custom types
* Also closes ARIA-186: "aria services show" command


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

Branch: refs/heads/ARIA-208-Missing-back-refrences-for-models
Commit: fdd57c47acfe63dc25c6f20bcb3785225b3f774d
Parents: 60ea3eb
Author: Tal Liron 
Authored: Thu Apr 20 17:54:47 2017 -0500
Committer: Tal Liron 
Committed: Thu May 11 12:42:40 2017 -0500

--
 aria/cli/commands/service_templates.py |  72 ++
 aria/cli/commands/services.py  |  51 ++-
 aria/cli/core/aria.py  | 203 +++-
 aria/cli/helptexts.py  |  12 +-
 aria/cli/table.py  |   3 +-
 aria/modeling/service_instance.py  |   4 +-
 aria/modeling/service_template.py  |   2 +-
 aria/modeling/types.py |   5 +
 aria/utils/collections.py  |   2 +-
 9 files changed, 260 insertions(+), 94 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/fdd57c47/aria/cli/commands/service_templates.py
--
diff --git a/aria/cli/commands/service_templates.py 
b/aria/cli/commands/service_templates.py
index e459871..0a24907 100644
--- a/aria/cli/commands/service_templates.py
+++ b/aria/cli/commands/service_templates.py
@@ -23,11 +23,13 @@ from .. import utils
 from ..core import aria
 from ...core import Core
 from ...storage import exceptions as storage_exceptions
+from ...parser import consumption
+from ...utils import (formatting, collections, console)
 
 
 DESCRIPTION_FIELD_LENGTH_LIMIT = 20
 SERVICE_TEMPLATE_COLUMNS = \
-['id', 'name', 'description', 'main_file_name', 'created_at', 'updated_at']
+('id', 'name', 'description', 'main_file_name', 'created_at', 'updated_at')
 
 
 @aria.group(name='service-templates')
@@ -43,32 +45,52 @@ def service_templates():
 @aria.argument('service-template-name')
 @aria.options.verbose()
 @aria.pass_model_storage
+@aria.options.service_template_mode_full
+@aria.options.mode_types
+@aria.options.format_json
+@aria.options.format_yaml
 @aria.pass_logger
-def show(service_template_name, model_storage, logger):
-"""Show information for a specific service templates
+def show(service_template_name, model_storage, mode_full, mode_types, 
format_json, format_yaml,
+ logger):
+"""Show information for a specific service template
 
 `SERVICE_TEMPLATE_NAME` is the name of the service template to show 
information on.
 """
-logger.info('Showing service template 
{0}...'.format(service_template_name))
 service_template = 
model_storage.service_template.get_by_name(service_template_name)
-service_template_dict = service_template.to_dict()
-service_template_dict['#services'] = len(service_template.services)
 
-column_formatters = \
-
dict(description=table.trim_formatter_generator(DESCRIPTION_FIELD_LENGTH_LIMIT))
-columns = SERVICE_TEMPLATE_COLUMNS + ['#services']
-table.print_data(columns, service_template_dict, 'Service-template:',
- column_formatters=column_formatters, col_max_width=50)
-
-if service_template_dict['description'] is not None:
-logger.info('Description:')
-
logger.info('{0}{1}'.format(service_template_dict['description'].encode('UTF-8')
 or '',
-os.linesep))
-
-if service_template.services:
-logger.info('Existing services:')
-for service in service_template.services:
-logger.info('\t{0}'.format(service.name))
+if format_json or format_yaml:
+mode_full = True
+
+if mode_full:
+consumption.ConsumptionContext()
+if format_json:
+
console.puts(formatting.json_dumps(collections.prune(service_template.as_raw)))
+elif format_yaml:
+
console.puts(formatting.yaml_dumps(collections.prune(service_template.as_raw)))
+else:
+service_template.dump()
+elif mode_types:
+consumption.ConsumptionContext()
+service_template.dump_types()
+else:
+logger.info('Showing service template 
{0}...'.format(service_template_name))
+service_template_dict = service_template.to_dict()
+service_template_dict['#services'] = len(service_template.services)
+

[15/19] incubator-ariatosca git commit: ARIA-139 Support attributes

2017-05-22 Thread ran
ARIA-139 Support attributes

* Fully implement attribute support in parser
* New intrinsic function evaluation mechanism
* Implemented more intrinsic functions, including get_attribute
* Fix to one-on-one relationship back population
* Fixes to TOSCA use case examples
* Indirectly related: re-enabled node_filter mechanism and reworked
filter constraints in order to make them serializable
* utils/type is much more robust now and consolidates all conversions
and names
* Moved dsl_specification to new utils/specification (because utils/type
uses it)


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

Branch: refs/heads/ARIA-208-Missing-back-refrences-for-models
Commit: 60ea3ebb21e762d36115db26563a93dd3cb72003
Parents: 2ee06b8
Author: Tal Liron 
Authored: Wed Apr 19 20:07:33 2017 -0500
Committer: Tal Liron 
Committed: Thu May 11 11:31:02 2017 -0500

--
 aria/core.py|   6 +-
 aria/modeling/contraints.py |  28 +
 aria/modeling/functions.py  | 104 ++-
 aria/modeling/mixins.py |   2 +-
 aria/modeling/relationship.py   |  19 +-
 aria/modeling/service_common.py | 164 -
 aria/modeling/service_instance.py   |  78 ++-
 aria/modeling/service_template.py   | 126 ++--
 aria/modeling/utils.py  |  50 +-
 .../execution_plugin/instantiation.py   |   2 +-
 aria/parser/__init__.py |   4 +-
 aria/parser/consumption/__init__.py |  11 +-
 aria/parser/consumption/modeling.py |   4 +-
 aria/parser/presentation/fields.py  |   3 +-
 aria/parser/presentation/presentation.py|   3 +-
 aria/parser/presentation/utils.py   |   3 +-
 aria/parser/specification.py|  39 +-
 aria/parser/validation/issue.py |   2 +-
 aria/utils/caching.py   |  13 +-
 aria/utils/formatting.py|  16 +-
 aria/utils/specification.py |  53 ++
 aria/utils/type.py  | 157 -
 .../block-storage-1/block-storage-1.yaml|   2 +-
 .../block-storage-2/block-storage-2.yaml|   2 +-
 .../block-storage-3/block-storage-3.yaml|   2 +-
 .../block-storage-4/block-storage-4.yaml|   2 +-
 .../block-storage-5/block-storage-5.yaml|   6 +-
 .../block-storage-6/block-storage-6.yaml|   4 +-
 .../use-cases/multi-tier-1/multi-tier-1.yaml|  14 +-
 .../simple_v1_0/__init__.py |  12 +-
 .../simple_v1_0/assignments.py  |  16 +-
 .../simple_v1_0/data_types.py   |  20 +-
 .../simple_v1_0/definitions.py  |  18 +-
 .../aria_extension_tosca/simple_v1_0/filters.py |   6 +-
 .../simple_v1_0/functions.py| 536 ---
 .../aria_extension_tosca/simple_v1_0/misc.py|  20 +-
 .../simple_v1_0/modeling/__init__.py| 185 ++---
 .../simple_v1_0/modeling/constraints.py | 144 
 .../simple_v1_0/modeling/data_types.py  |  23 +-
 .../simple_v1_0/modeling/functions.py   | 677 +++
 .../simple_v1_0/modeling/properties.py  |  17 +-
 .../presentation/field_validators.py|  13 +-
 .../simple_v1_0/presenter.py|   4 +-
 .../simple_v1_0/templates.py|  47 +-
 .../aria_extension_tosca/simple_v1_0/types.py   |  18 +-
 .../node-cellar/node-cellar.yaml|   6 +-
 46 files changed, 1644 insertions(+), 1037 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/60ea3ebb/aria/core.py
--
diff --git a/aria/core.py b/aria/core.py
index af1984a..cc943ef 100644
--- a/aria/core.py
+++ b/aria/core.py
@@ -77,10 +77,14 @@ class Core(object):
 consumption.ConsumerChain(
 context,
 (
+consumption.CoerceServiceInstanceValues,
+consumption.ValidateServiceInstance,
 consumption.SatisfyRequirements,
+consumption.CoerceServiceInstanceValues,
 consumption.ValidateCapabilities,
 consumption.FindHosts,
-consumption.ConfigureOperations
+consumption.ConfigureOperations,
+consumption.CoerceServiceInstanceValues
 

[17/19] incubator-ariatosca git commit: ARIA-171 service_template.services type inconsistency

2017-05-22 Thread ran
ARIA-171 service_template.services type inconsistency

As opposed to service_template.node_templates and service.nodes
which have a dict interface, service_template.services
had a list interface. That seemed inconsistent, so the former
interface was changed to a dict interface as well.


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

Branch: refs/heads/ARIA-208-Missing-back-refrences-for-models
Commit: 24d693d762e4a56d6bf16d8c29d76c1f2909098d
Parents: fdd57c4
Author: Avia Efrat 
Authored: Mon May 15 14:26:34 2017 +0300
Committer: Avia Efrat 
Committed: Tue May 16 00:09:49 2017 +0300

--
 aria/cli/commands/service_templates.py | 4 ++--
 aria/modeling/service_template.py  | 2 +-
 tests/cli/test_service_templates.py| 6 --
 tests/end2end/test_hello_world.py  | 2 +-
 tests/end2end/test_nodecellar.py   | 2 +-
 5 files changed, 9 insertions(+), 7 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/24d693d7/aria/cli/commands/service_templates.py
--
diff --git a/aria/cli/commands/service_templates.py 
b/aria/cli/commands/service_templates.py
index 0a24907..d139195 100644
--- a/aria/cli/commands/service_templates.py
+++ b/aria/cli/commands/service_templates.py
@@ -89,8 +89,8 @@ def show(service_template_name, model_storage, mode_full, 
mode_types, format_jso
 
 if service_template.services:
 logger.info('Existing services:')
-for service in service_template.services:
-logger.info('\t{0}'.format(service.name))
+for service_name in service_template.services:
+logger.info('\t{0}'.format(service_name))
 
 
 @service_templates.command(name='list',

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/24d693d7/aria/modeling/service_template.py
--
diff --git a/aria/modeling/service_template.py 
b/aria/modeling/service_template.py
index 7eb35bd..1eb95a3 100644
--- a/aria/modeling/service_template.py
+++ b/aria/modeling/service_template.py
@@ -208,7 +208,7 @@ class ServiceTemplateBase(TemplateModelMixin):
 
 @declared_attr
 def services(cls):
-return relationship.one_to_many(cls, 'service')
+return relationship.one_to_many(cls, 'service', dict_key='name')
 
 @declared_attr
 def operation_templates(cls):

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/24d693d7/tests/cli/test_service_templates.py
--
diff --git a/tests/cli/test_service_templates.py 
b/tests/cli/test_service_templates.py
index bc3c751..7e86896 100644
--- a/tests/cli/test_service_templates.py
+++ b/tests/cli/test_service_templates.py
@@ -65,7 +65,8 @@ class TestServiceTemplatesShow(TestCliBase):
 
 monkeypatch.setattr(_Environment, 'model_storage', mock_storage)
 st = mock_models.create_service_template()
-st.services = [mock_models.create_service(st)]
+s = mock_models.create_service(st)
+st.services = {s.name: s}
 monkeypatch.setattr(mock_storage.service_template, 'get_by_name',
 mock.MagicMock(return_value=st))
 
@@ -79,7 +80,8 @@ class TestServiceTemplatesShow(TestCliBase):
 
 monkeypatch.setattr(_Environment, 'model_storage', mock_storage)
 st = 
mock_models.create_service_template(description='test_description')
-st.services = [mock_models.create_service(st)]
+s = mock_models.create_service(st)
+st.services = {s.name: s}
 monkeypatch.setattr(mock_storage.service_template, 'get_by_name',
 mock.MagicMock(return_value=st))
 

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/24d693d7/tests/end2end/test_hello_world.py
--
diff --git a/tests/end2end/test_hello_world.py 
b/tests/end2end/test_hello_world.py
index fc5f631..71792dd 100644
--- a/tests/end2end/test_hello_world.py
+++ b/tests/end2end/test_hello_world.py
@@ -52,7 +52,7 @@ def _verify_deployed_service_in_storage(service_name, 
model_storage):
 service_templates = model_storage.service_template.list()
 assert len(service_templates) == 1
 assert len(service_templates[0].services) == 1
-service = service_templates[0].services[0]
+service = service_templates[0].services[service_name]
 assert service.name == service_name
 assert 

[08/19] incubator-ariatosca git commit: ARIA-210 Handle relative paths in CLI service-templates

2017-05-22 Thread ran
ARIA-210 Handle relative paths in CLI service-templates

This was a rather simple change, mainly involving adding absolute path
references.

The problems were only in `service-templates store` and in
`service-templates create-archive`.
`service-templates validate` was not affected.


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

Branch: refs/heads/ARIA-208-Missing-back-refrences-for-models
Commit: d0411d3de37bb31073fda605cd9b73431b685d92
Parents: 16fcca4
Author: Avia Efrat 
Authored: Mon May 8 17:45:23 2017 +0300
Committer: Avia Efrat 
Committed: Tue May 9 17:30:22 2017 +0300

--
 aria/cli/commands/service_templates.py |  4 +++-
 aria/cli/csar.py   | 18 ++
 aria/cli/service_template_utils.py |  2 +-
 tests/cli/test_service_templates.py| 22 ++
 4 files changed, 36 insertions(+), 10 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/d0411d3d/aria/cli/commands/service_templates.py
--
diff --git a/aria/cli/commands/service_templates.py 
b/aria/cli/commands/service_templates.py
index 2537012..e459871 100644
--- a/aria/cli/commands/service_templates.py
+++ b/aria/cli/commands/service_templates.py
@@ -195,7 +195,9 @@ def create_archive(service_template_path, destination, 
logger):
 `destination` is the path of the output CSAR archive file
 """
 logger.info('Creating a CSAR archive')
-csar.write(os.path.dirname(service_template_path), service_template_path, 
destination, logger)
+if not destination.endswith(csar.CSAR_FILE_EXTENSION):
+destination += csar.CSAR_FILE_EXTENSION
+csar.write(service_template_path, destination, logger)
 logger.info('CSAR archive created at {0}'.format(destination))
 
 

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/d0411d3d/aria/cli/csar.py
--
diff --git a/aria/cli/csar.py b/aria/cli/csar.py
index 5bc35ac..8f44557 100644
--- a/aria/cli/csar.py
+++ b/aria/cli/csar.py
@@ -22,7 +22,7 @@ import zipfile
 import requests
 from ruamel import yaml
 
-
+CSAR_FILE_EXTENSION = '.csar'
 META_FILE = 'TOSCA-Metadata/TOSCA.meta'
 META_FILE_VERSION_KEY = 'TOSCA-Meta-File-Version'
 META_FILE_VERSION_VALUE = '1.0'
@@ -38,17 +38,19 @@ BASE_METADATA = {
 }
 
 
-def write(source, entry, destination, logger):
-source = os.path.expanduser(source)
-destination = os.path.expanduser(destination)
-entry_definitions = os.path.join(source, entry)
+def write(service_template_path, destination, logger):
+
+service_template_path = 
os.path.abspath(os.path.expanduser(service_template_path))
+source = os.path.dirname(service_template_path)
+entry = os.path.basename(service_template_path)
+
 meta_file = os.path.join(source, META_FILE)
 if not os.path.isdir(source):
 raise ValueError('{0} is not a directory. Please specify the service 
template '
  'directory.'.format(source))
-if not os.path.isfile(entry_definitions):
+if not os.path.isfile(service_template_path):
 raise ValueError('{0} does not exists. Please specify a valid entry 
point.'
- .format(entry_definitions))
+ .format(service_template_path))
 if os.path.exists(destination):
 raise ValueError('{0} already exists. Please provide a path to where 
the CSAR should be '
  'created.'.format(destination))
@@ -175,4 +177,4 @@ def read(source, destination=None, logger=None):
 
 
 def is_csar_archive(source):
-return source.endswith('.csar')
+return source.endswith(CSAR_FILE_EXTENSION)

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/d0411d3d/aria/cli/service_template_utils.py
--
diff --git a/aria/cli/service_template_utils.py 
b/aria/cli/service_template_utils.py
index 382cce1..c953c02 100644
--- a/aria/cli/service_template_utils.py
+++ b/aria/cli/service_template_utils.py
@@ -53,7 +53,7 @@ def get(source, service_template_filename):
 return _get_service_template_file_from_archive(source, 
service_template_filename)
 else:
 # Maybe check if yaml.
-return source
+return os.path.abspath(source)
 elif len(source.split('/')) == 2:
 url = _map_to_github_url(source)
 downloaded_file = utils.download_file(url)


[09/19] incubator-ariatosca git commit: ARIA-140 Version utils

2017-05-22 Thread ran
ARIA-140 Version utils

Provided mainly to support version comparisons for plugins in order to
select the highest version of available plugins that would match a
plugin specification. In the future may be useful for other version
comparisons.


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

Branch: refs/heads/ARIA-208-Missing-back-refrences-for-models
Commit: eae44d0b0d051fd50cadf94d734bdf7a3b8d3171
Parents: d0411d3
Author: Tal Liron 
Authored: Fri Apr 14 13:39:02 2017 -0500
Committer: Tal Liron 
Committed: Tue May 9 15:37:46 2017 -0500

--
 aria/modeling/service_template.py |  17 ++--
 aria/utils/versions.py| 162 +
 tests/utils/test_versions.py  |  85 +
 3 files changed, 257 insertions(+), 7 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/eae44d0b/aria/modeling/service_template.py
--
diff --git a/aria/modeling/service_template.py 
b/aria/modeling/service_template.py
index f721b64..e3320fa 100644
--- a/aria/modeling/service_template.py
+++ b/aria/modeling/service_template.py
@@ -33,7 +33,8 @@ from sqlalchemy.ext.associationproxy import association_proxy
 from ..parser import validation
 from ..parser.consumption import ConsumptionContext
 from ..parser.reading import deepcopy_with_locators
-from ..utils import collections, formatting, console
+from ..utils import (collections, formatting, console)
+from ..utils.versions import VersionString
 from .mixins import TemplateModelMixin
 from . import (
 relationship,
@@ -2135,13 +2136,15 @@ class PluginSpecificationBase(TemplateModelMixin):
 # moved to.
 plugins = model_storage.plugin.list()
 matching_plugins = []
-for plugin in plugins:
-# TODO: we need to use a version comparator
-if (plugin.name == self.name) and \
-((self.version is None) or (plugin.package_version >= 
self.version)):
-matching_plugins.append(plugin)
+if plugins:
+for plugin in plugins:
+if (plugin.name == self.name) and \
+((self.version is None) or \
+ (VersionString(plugin.package_version) >= self.version)):
+matching_plugins.append(plugin)
 self.plugin = None
 if matching_plugins:
 # Return highest version of plugin
-self.plugin = sorted(matching_plugins, key=lambda plugin: 
plugin.package_version)[-1]
+key = lambda plugin: VersionString(plugin.package_version).key
+self.plugin = sorted(matching_plugins, key=key)[-1]
 return self.plugin is not None

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/eae44d0b/aria/utils/versions.py
--
diff --git a/aria/utils/versions.py b/aria/utils/versions.py
new file mode 100644
index 000..925f59e
--- /dev/null
+++ b/aria/utils/versions.py
@@ -0,0 +1,162 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""
+General-purpose version string handling
+"""
+
+import re
+
+
+_INF = float('inf')
+
+_NULL = (), _INF
+
+_DIGITS_RE = re.compile(r'^\d+$')
+
+_PREFIXES = {
+'dev':   0.0001,
+'alpha': 0.001,
+'beta':  0.01,
+'rc':0.1
+}
+
+
+class VersionString(unicode):
+"""
+Version string that can be compared, sorted, made unique in a set, and 
used as a unique dict
+key.
+
+The primary part of the string is one or more dot-separated natural 
numbers. Trailing zeroes
+are treated as redundant, e.g. "1.0.0" == "1.0" == "1".
+
+An optional qualifier can be added after a "-". The qualifier can be a 
natural number or a
+specially 

[10/19] incubator-ariatosca git commit: ARIA-62 Apply pylint on extensions

2017-05-22 Thread ran
ARIA-62 Apply pylint on extensions


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

Branch: refs/heads/ARIA-208-Missing-back-refrences-for-models
Commit: 0af9e638b7c75eea6eac39374b7176f9dc2c645a
Parents: eae44d0
Author: Ran Ziv 
Authored: Wed May 10 12:08:01 2017 +0300
Committer: Ran Ziv 
Committed: Wed May 10 12:08:01 2017 +0300

--
 aria/.pylintrc|  2 +-
 .../aria_extension_tosca/simple_nfv_v1_0/presenter.py |  2 +-
 .../aria_extension_tosca/simple_v1_0/assignments.py   |  2 +-
 extensions/aria_extension_tosca/simple_v1_0/functions.py  |  8 
 .../aria_extension_tosca/simple_v1_0/modeling/__init__.py | 10 ++
 extensions/aria_extension_tosca/simple_v1_0/presenter.py  |  2 +-
 tests/.pylintrc   |  2 +-
 tox.ini   |  2 +-
 8 files changed, 16 insertions(+), 14 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/0af9e638/aria/.pylintrc
--
diff --git a/aria/.pylintrc b/aria/.pylintrc
index 7da8c56..4d77556 100644
--- a/aria/.pylintrc
+++ b/aria/.pylintrc
@@ -360,7 +360,7 @@ max-locals=20
 max-returns=10
 
 # Maximum number of branch for function / method body
-max-branches=12
+max-branches=15
 
 # Maximum number of statements in function / method body
 max-statements=50

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/0af9e638/extensions/aria_extension_tosca/simple_nfv_v1_0/presenter.py
--
diff --git a/extensions/aria_extension_tosca/simple_nfv_v1_0/presenter.py 
b/extensions/aria_extension_tosca/simple_nfv_v1_0/presenter.py
index 0ce918e..cd07f42 100644
--- a/extensions/aria_extension_tosca/simple_nfv_v1_0/presenter.py
+++ b/extensions/aria_extension_tosca/simple_nfv_v1_0/presenter.py
@@ -19,7 +19,7 @@ from aria.utils.caching import cachedmethod
 from ..simple_v1_0 import ToscaSimplePresenter1_0
 
 
-class ToscaSimpleNfvPresenter1_0(ToscaSimplePresenter1_0): # pylint: 
disable=invalid-name
+class ToscaSimpleNfvPresenter1_0(ToscaSimplePresenter1_0): # pylint: 
disable=invalid-name,abstract-method
 """
 ARIA presenter for the `TOSCA Simple Profile for NFV v1.0 csd03 
`__.

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/0af9e638/extensions/aria_extension_tosca/simple_v1_0/assignments.py
--
diff --git a/extensions/aria_extension_tosca/simple_v1_0/assignments.py 
b/extensions/aria_extension_tosca/simple_v1_0/assignments.py
index 6e36ba8..9a2179a 100644
--- a/extensions/aria_extension_tosca/simple_v1_0/assignments.py
+++ b/extensions/aria_extension_tosca/simple_v1_0/assignments.py
@@ -94,7 +94,7 @@ class OperationAssignment(ExtensiblePresentation):
 if operation_definition is not None:
 if operation_definition._extensions:
 extensions.update(operation_definition._extensions)
-
+
 extensions = {}
 update_inherited_extensions(extensions, 
self._container._get_type(context))
 if self._container._extensions:

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/0af9e638/extensions/aria_extension_tosca/simple_v1_0/functions.py
--
diff --git a/extensions/aria_extension_tosca/simple_v1_0/functions.py 
b/extensions/aria_extension_tosca/simple_v1_0/functions.py
index 405aa8f..2f77420 100644
--- a/extensions/aria_extension_tosca/simple_v1_0/functions.py
+++ b/extensions/aria_extension_tosca/simple_v1_0/functions.py
@@ -176,7 +176,7 @@ class GetProperty(Function):
 
 for modelable_entity in modelable_entities:
 properties = None
-
+
 if hasattr(modelable_entity, 'requirement_templates') \
 and modelable_entity.requirement_templates \
 and (req_or_cap_name in [v.name for v in 
modelable_entity.requirement_templates]):
@@ -185,7 +185,7 @@ class GetProperty(Function):
 # First argument refers to a requirement
 # TODO: should follow to matched capability in other 
node...
 raise CannotEvaluateFunctionException()
-break
+# break
   

[19/19] incubator-ariatosca git commit: ARIA-208 Fix models relationships

2017-05-22 Thread ran
ARIA-208 Fix models relationships


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

Branch: refs/heads/ARIA-208-Missing-back-refrences-for-models
Commit: 5798bbfc7d1a95965a4c44d2ebad5dad245c824a
Parents: 78d6019
Author: Ran Ziv 
Authored: Sun May 7 14:58:46 2017 +0300
Committer: Ran Ziv 
Committed: Mon May 22 15:17:21 2017 +0300

--
 aria/modeling/service_template.py | 49 --
 1 file changed, 23 insertions(+), 26 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/5798bbfc/aria/modeling/service_template.py
--
diff --git a/aria/modeling/service_template.py 
b/aria/modeling/service_template.py
index 1eb95a3..12195a1 100644
--- a/aria/modeling/service_template.py
+++ b/aria/modeling/service_template.py
@@ -211,10 +211,6 @@ class ServiceTemplateBase(TemplateModelMixin):
 return relationship.one_to_many(cls, 'service', dict_key='name')
 
 @declared_attr
-def operation_templates(cls):
-return relationship.one_to_many(cls, 'operation_template')
-
-@declared_attr
 def node_templates(cls):
 return relationship.one_to_many(cls, 'node_template', dict_key='name')
 
@@ -483,6 +479,22 @@ class NodeTemplateBase(TemplateModelMixin):
 def nodes(cls):
 return relationship.one_to_many(cls, 'node')
 
+@declared_attr
+def interface_templates(cls):
+return relationship.one_to_many(cls, 'interface_template', 
dict_key='name')
+
+@declared_attr
+def artifact_templates(cls):
+return relationship.one_to_many(cls, 'artifact_template', 
dict_key='name')
+
+@declared_attr
+def capability_templates(cls):
+return relationship.one_to_many(cls, 'capability_template', 
dict_key='name')
+
+@declared_attr
+def requirement_templates(cls):
+return relationship.one_to_many(cls, 'requirement_template', 
child_fk='node_template_fk')
+
 # endregion
 
 # region many_to_one relationships
@@ -507,22 +519,6 @@ class NodeTemplateBase(TemplateModelMixin):
 def attributes(cls):
 return relationship.many_to_many(cls, 'parameter', 
prefix='attributes', dict_key='name')
 
-@declared_attr
-def interface_templates(cls):
-return relationship.one_to_many(cls, 'interface_template', 
dict_key='name')
-
-@declared_attr
-def artifact_templates(cls):
-return relationship.one_to_many(cls, 'artifact_template', 
dict_key='name')
-
-@declared_attr
-def capability_templates(cls):
-return relationship.one_to_many(cls, 'capability_template', 
dict_key='name')
-
-@declared_attr
-def requirement_templates(cls):
-return relationship.one_to_many(cls, 'requirement_template', 
child_fk='node_template_fk')
-
 # endregion
 
 description = Column(Text)
@@ -1209,11 +1205,6 @@ class RequirementTemplateBase(TemplateModelMixin):
 def relationships(cls):
 return relationship.one_to_many(cls, 'relationship')
 
-@declared_attr
-def target_node_type(cls):
-return relationship.many_to_one(
-cls, 'type', fk='target_node_type_fk', 
back_populates=relationship.NO_BACK_POP)
-
 # endregion
 
 # region many_to_one relationships
@@ -1222,6 +1213,11 @@ class RequirementTemplateBase(TemplateModelMixin):
 def node_template(cls):
 return relationship.many_to_one(cls, 'node_template', 
fk='node_template_fk')
 
+@declared_attr
+def target_node_type(cls):
+return relationship.many_to_one(
+cls, 'type', fk='target_node_type_fk', 
back_populates=relationship.NO_BACK_POP)
+
 # endregion
 
 # region many_to_many relationships
@@ -1845,7 +1841,8 @@ class OperationTemplateBase(TemplateModelMixin):
 
 @declared_attr
 def service_template(cls):
-return relationship.many_to_one(cls, 'service_template')
+return relationship.many_to_one(cls, 'service_template',
+back_populates='workflow_templates')
 
 @declared_attr
 def interface_template(cls):



[11/19] incubator-ariatosca git commit: ARIA-157 Failing CLI service-templates store tests on Windows

2017-05-22 Thread ran
ARIA-157 Failing CLI service-templates store tests on Windows

Three tests from `aria service-templates store` failed on Windows, but
not on Linux.

The reason for this failures was differing implementation of
os.path.dirname across the platforms.

Python implements os.path.dirname in the ntpath module. There, somewhere
down the line of calls, (a part of) the argument of dirname is tested
for membership in a string (using `in`). In these three tests, the
argument of dirname is of type MagicMock, and an error is raised since
only a string can be tested for membership in a string.

The solution was to mock the dirname calls.


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

Branch: refs/heads/ARIA-208-Missing-back-refrences-for-models
Commit: 6864d42e1748b5cd8ecc596fc1b4adc04b0cc9ba
Parents: 0af9e63
Author: Avia Efrat 
Authored: Wed May 10 17:39:49 2017 +0300
Committer: Avia Efrat 
Committed: Wed May 10 18:13:02 2017 +0300

--
 tests/cli/test_service_templates.py | 3 +++
 1 file changed, 3 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/6864d42e/tests/cli/test_service_templates.py
--
diff --git a/tests/cli/test_service_templates.py 
b/tests/cli/test_service_templates.py
index 22a8fc8..bc3c751 100644
--- a/tests/cli/test_service_templates.py
+++ b/tests/cli/test_service_templates.py
@@ -128,6 +128,7 @@ class TestServiceTemplatesStore(TestCliBase):
 
 monkeypatch.setattr(Core, 'create_service_template', mock_object)
 monkeypatch.setattr(service_template_utils, 'get', mock_object)
+monkeypatch.setattr(os.path, 'dirname', mock_object)
 self.invoke('service_templates store stubpath {name}'.format(
 name=mock_models.SERVICE_TEMPLATE_NAME))
 assert 'Service template {name} stored'.format(
@@ -152,6 +153,7 @@ class TestServiceTemplatesStore(TestCliBase):
 'create_service_template',
 raise_exception(storage_exceptions.NotFoundError,
 msg='UNIQUE constraint failed'))
+monkeypatch.setattr(os.path, 'dirname', mock_object)
 
 assert_exception_raised(
 self.invoke('service_templates store stubpath test_st'),
@@ -164,6 +166,7 @@ class TestServiceTemplatesStore(TestCliBase):
 monkeypatch.setattr(Core,
 'create_service_template',
 raise_exception(storage_exceptions.NotFoundError))
+monkeypatch.setattr(os.path, 'dirname', mock_object)
 
 assert_exception_raised(
 self.invoke('service_templates store stubpath test_st'),



[12/19] incubator-ariatosca git commit: ARIA-213 Sporadic tests failures over locked database issue

2017-05-22 Thread ran
ARIA-213 Sporadic tests failures over locked database issue

Move from 2 different sessions - one for the log, and the other for general 
model operations,
to one single session, while utilizing the keep tracking of changes mechanism 
for both logs and node/task states.


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

Branch: refs/heads/ARIA-208-Missing-back-refrences-for-models
Commit: 2ee06b8a6abe79f429458c7dbc5f9e1c31aec589
Parents: 6864d42
Author: max-orlov 
Authored: Tue May 9 17:24:31 2017 +0300
Committer: max-orlov 
Committed: Thu May 11 17:24:15 2017 +0300

--
 aria/logger.py  | 25 +
 aria/orchestrator/context/common.py | 13 +--
 .../workflows/core/events_handler.py|  4 +-
 aria/orchestrator/workflows/executor/process.py | 51 ++
 aria/storage/instrumentation.py | 97 +---
 .../orchestrator/workflows/executor/__init__.py | 21 -
 .../workflows/executor/test_executor.py | 36 ++--
 .../workflows/executor/test_process_executor.py | 13 ++-
 tests/storage/test_instrumentation.py   | 37 +++-
 9 files changed, 219 insertions(+), 78 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/2ee06b8a/aria/logger.py
--
diff --git a/aria/logger.py b/aria/logger.py
index 97d3878..bd7ed4e 100644
--- a/aria/logger.py
+++ b/aria/logger.py
@@ -114,17 +114,11 @@ def create_console_log_handler(level=logging.DEBUG, 
formatter=None):
 return console
 
 
-def create_sqla_log_handler(session, engine, log_cls, execution_id, 
level=logging.DEBUG):
+def create_sqla_log_handler(model, log_cls, execution_id, level=logging.DEBUG):
 
 # This is needed since the engine and session are entirely new we need to 
reflect the db
 # schema of the logging model into the engine and session.
-log_cls.__table__.create(bind=engine, checkfirst=True)
-
-return _SQLAlchemyHandler(session=session,
-  engine=engine,
-  log_cls=log_cls,
-  execution_id=execution_id,
-  level=level)
+return _SQLAlchemyHandler(model=model, log_cls=log_cls, 
execution_id=execution_id, level=level)
 
 
 class _DefaultConsoleFormat(logging.Formatter):
@@ -168,10 +162,9 @@ def create_file_log_handler(
 
 class _SQLAlchemyHandler(logging.Handler):
 
-def __init__(self, session, engine, log_cls, execution_id, **kwargs):
+def __init__(self, model, log_cls, execution_id, **kwargs):
 logging.Handler.__init__(self, **kwargs)
-self._session = session
-self._engine = engine
+self._model = model
 self._cls = log_cls
 self._execution_id = execution_id
 
@@ -188,15 +181,7 @@ class _SQLAlchemyHandler(logging.Handler):
 # Not mandatory.
 traceback=getattr(record, 'traceback', None)
 )
-self._session.add(log)
-
-try:
-self._session.commit()
-except BaseException:
-self._session.rollback()
-raise
-finally:
-self._session.close()
+self._model.log.put(log)
 
 
 _default_file_formatter = logging.Formatter(

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/2ee06b8a/aria/orchestrator/context/common.py
--
diff --git a/aria/orchestrator/context/common.py 
b/aria/orchestrator/context/common.py
index 64ef9a4..0854a27 100644
--- a/aria/orchestrator/context/common.py
+++ b/aria/orchestrator/context/common.py
@@ -79,13 +79,9 @@ class BaseContext(object):
 self.logger.addHandler(self._get_sqla_handler())
 
 def _get_sqla_handler(self):
-api_kwargs = {}
-if self._model._initiator:
-
api_kwargs.update(self._model._initiator(**self._model._initiator_kwargs))
-api_kwargs.update(**self._model._api_kwargs)
-return aria_logger.create_sqla_log_handler(log_cls=modeling.models.Log,
-   
execution_id=self._execution_id,
-   **api_kwargs)
+return aria_logger.create_sqla_log_handler(model=self._model,
+   log_cls=modeling.models.Log,
+   
execution_id=self._execution_id)
 
 def __repr__(self):
 

[13/19] incubator-ariatosca git commit: ARIA-139 Support attributes

2017-05-22 Thread ran
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/60ea3ebb/extensions/aria_extension_tosca/simple_v1_0/modeling/properties.py
--
diff --git a/extensions/aria_extension_tosca/simple_v1_0/modeling/properties.py 
b/extensions/aria_extension_tosca/simple_v1_0/modeling/properties.py
index f61cb99..9c3ea42 100644
--- a/extensions/aria_extension_tosca/simple_v1_0/modeling/properties.py
+++ b/extensions/aria_extension_tosca/simple_v1_0/modeling/properties.py
@@ -58,7 +58,8 @@ def get_inherited_property_definitions(context, presentation, 
field_name, for_pr
 # NodeTemplate, RelationshipTemplate, GroupTemplate, PolicyTemplate
 #
 
-def get_assigned_and_defined_property_values(context, presentation):
+def get_assigned_and_defined_property_values(context, presentation, 
field_name='property',
+ field_name_plural='properties'):
 """
 Returns the assigned property values while making sure they are defined in 
our type.
 
@@ -70,8 +71,9 @@ def get_assigned_and_defined_property_values(context, 
presentation):
 values = OrderedDict()
 
 the_type = presentation._get_type(context)
-assignments = presentation.properties
-definitions = the_type._get_properties(context) if the_type is not None 
else None
+assignments = getattr(presentation, field_name_plural)
+get_fn_name = '_get_{0}'.format(field_name_plural)
+definitions = getattr(the_type, get_fn_name)(context) if the_type is not 
None else None
 
 # Fill in our assignments, but make sure they are defined
 if assignments:
@@ -80,14 +82,14 @@ def get_assigned_and_defined_property_values(context, 
presentation):
 definition = definitions[name]
 values[name] = coerce_property_value(context, value, 
definition, value.value)
 else:
-context.validation.report('assignment to undefined property 
"%s" in "%s"'
-  % (name, presentation._fullname),
+context.validation.report('assignment to undefined {0} "{1}" 
in "{2}"'
+  .format(field_name, name, 
presentation._fullname),
   locator=value._locator, 
level=Issue.BETWEEN_TYPES)
 
 # Fill in defaults from the definitions
 if definitions:
 for name, definition in definitions.iteritems():
-if (values.get(name) is None) and (definition.default is not None):
+if values.get(name) is None:
 values[name] = coerce_property_value(context, presentation, 
definition,
  definition.default)
 
@@ -181,7 +183,8 @@ def merge_property_definitions(context, presentation, 
property_definitions,
 def coerce_property_value(context, presentation, definition, value, 
aspect=None):
 the_type = definition._get_type(context) if definition is not None else 
None
 entry_schema = definition.entry_schema if definition is not None else None
-constraints = definition._get_constraints(context) if definition is not 
None else None
+constraints = definition._get_constraints(context) \
+if ((definition is not None) and hasattr(definition, 
'_get_constraints')) else None
 value = coerce_value(context, presentation, the_type, entry_schema, 
constraints, value, aspect)
 if (the_type is not None) and hasattr(the_type, '_name'):
 type_name = the_type._name

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/60ea3ebb/extensions/aria_extension_tosca/simple_v1_0/presentation/field_validators.py
--
diff --git 
a/extensions/aria_extension_tosca/simple_v1_0/presentation/field_validators.py 
b/extensions/aria_extension_tosca/simple_v1_0/presentation/field_validators.py
index 6ff4384..d7b03ae 100644
--- 
a/extensions/aria_extension_tosca/simple_v1_0/presentation/field_validators.py
+++ 
b/extensions/aria_extension_tosca/simple_v1_0/presentation/field_validators.py
@@ -16,7 +16,7 @@
 import re
 
 from aria.utils.formatting import safe_repr
-from aria.parser import dsl_specification
+from aria.parser import implements_specification
 from aria.parser.presentation import (report_issue_for_unknown_type, 
derived_from_validator)
 from aria.parser.validation import Issue
 
@@ -28,8 +28,7 @@ from .types import get_type_by_full_or_shorthand_name, 
convert_shorthand_to_full
 # NodeTemplate, RelationshipTemplate
 #
 
-@dsl_specification('3.7.3.3', 'tosca-simple-1.0')
-@dsl_specification('3.7.4.3', 'tosca-simple-1.0')
+@implements_specification('3.7.3.3', 'tosca-simple-1.0')
 def copy_validator(template_type_name, templates_dict_name):
 """
 Makes sure that the field refers to an existing template defined in the 
root presenter.
@@ -304,8 +303,12 @@ def constraint_clause_pattern_validator(field, 

[03/19] incubator-ariatosca git commit: ARIA-215 Refactor plugin-related code into PluginManager

2017-05-22 Thread ran
ARIA-215 Refactor plugin-related code into PluginManager

Refactored plugin-related code from ProcessExecutor into PluginManager.
Additionally, renamed plugin_prefix to plugin_dir in PluginManager.


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

Branch: refs/heads/ARIA-208-Missing-back-refrences-for-models
Commit: 3e1ed14c00ea2c83fafdca8ec0e37817bea1d5e8
Parents: 45c158e
Author: Ran Ziv 
Authored: Sun May 7 16:36:39 2017 +0300
Committer: Ran Ziv 
Committed: Sun May 7 17:27:36 2017 +0300

--
 aria/orchestrator/plugin.py | 36 +++-
 aria/orchestrator/workflows/executor/process.py | 60 ++--
 aria/utils/process.py   | 47 +++
 tests/utils/test_plugin.py  |  6 +-
 4 files changed, 100 insertions(+), 49 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/3e1ed14c/aria/orchestrator/plugin.py
--
diff --git a/aria/orchestrator/plugin.py b/aria/orchestrator/plugin.py
index f99666c..8fbcf5a 100644
--- a/aria/orchestrator/plugin.py
+++ b/aria/orchestrator/plugin.py
@@ -23,6 +23,9 @@ from datetime import datetime
 import wagon
 
 from . import exceptions
+from ..utils import process as process_utils
+
+_IS_WIN = os.name == 'nt'
 
 
 class PluginManager(object):
@@ -62,11 +65,40 @@ class PluginManager(object):
 raise exceptions.PluginAlreadyExistsError(
 'Plugin {0}, version {1} already 
exists'.format(plugin.package_name,
 
plugin.package_version))
-self._install_wagon(source=source, 
prefix=self.get_plugin_prefix(plugin))
+self._install_wagon(source=source, prefix=self.get_plugin_dir(plugin))
 self._model.plugin.put(plugin)
 return plugin
 
-def get_plugin_prefix(self, plugin):
+def load_plugin(self, plugin, env=None):
+"""
+Load the plugin into an environment.
+Loading the plugin means the plugin's code and binaries paths will be 
appended to the
+environment's PATH and PYTHONPATH, thereby allowing usage of the 
plugin.
+:param plugin: The plugin to load
+:param env: The environment to load the plugin into; If `None`, 
os.environ will be used.
+"""
+env = env or os.environ
+plugin_dir = self.get_plugin_dir(plugin)
+
+# Update PATH environment variable to include plugin's bin dir
+bin_dir = 'Scripts' if _IS_WIN else 'bin'
+process_utils.append_to_path(os.path.join(plugin_dir, bin_dir), 
env=env)
+
+# Update PYTHONPATH environment variable to include plugin's 
site-packages
+# directories
+if _IS_WIN:
+pythonpath_dirs = [os.path.join(plugin_dir, 'Lib', 
'site-packages')]
+else:
+# In some linux environments, there will be both a lib and a lib64 
directory
+# with the latter, containing compiled packages.
+pythonpath_dirs = [os.path.join(
+plugin_dir, 'lib{0}'.format(b),
+'python{0}.{1}'.format(sys.version_info[0], 
sys.version_info[1]),
+'site-packages') for b in ('', '64')]
+
+process_utils.append_to_pythonpath(*pythonpath_dirs, env=env)
+
+def get_plugin_dir(self, plugin):
 return os.path.join(
 self._plugins_dir,
 '{0}-{1}'.format(plugin.package_name, plugin.package_version))

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/3e1ed14c/aria/orchestrator/workflows/executor/process.py
--
diff --git a/aria/orchestrator/workflows/executor/process.py 
b/aria/orchestrator/workflows/executor/process.py
index 8481406..f3daf04 100644
--- a/aria/orchestrator/workflows/executor/process.py
+++ b/aria/orchestrator/workflows/executor/process.py
@@ -47,13 +47,12 @@ from aria.storage import instrumentation
 from aria.extension import process_executor
 from aria.utils import (
 imports,
-exceptions
+exceptions,
+process as process_utils
 )
 from aria.modeling import types as modeling_types
 
 
-_IS_WIN = os.name == 'nt'
-
 _INT_FMT = 'I'
 _INT_SIZE = struct.calcsize(_INT_FMT)
 UPDATE_TRACKED_CHANGES_FAILED_STR = \
@@ -127,13 +126,7 @@ class ProcessExecutor(base.BaseExecutor):
 with open(arguments_json_path, 'wb') as f:
 f.write(pickle.dumps(self._create_arguments_dict(task)))
 
-env = 

[05/19] incubator-ariatosca git commit: ARIA-230 Dry execution doesn't log empty operations

2017-05-22 Thread ran
ARIA-230 Dry execution doesn't log empty operations


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

Branch: refs/heads/ARIA-208-Missing-back-refrences-for-models
Commit: b11fbc946ae6d26ad6c70a283cc6d6501c320273
Parents: 0ec2370
Author: max-orlov 
Authored: Mon May 8 17:29:29 2017 +0300
Committer: max-orlov 
Committed: Tue May 9 01:02:46 2017 +0300

--
 aria/orchestrator/workflows/executor/dry.py | 26 
 1 file changed, 13 insertions(+), 13 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/b11fbc94/aria/orchestrator/workflows/executor/dry.py
--
diff --git a/aria/orchestrator/workflows/executor/dry.py 
b/aria/orchestrator/workflows/executor/dry.py
index f6fb7a6..63ec392 100644
--- a/aria/orchestrator/workflows/executor/dry.py
+++ b/aria/orchestrator/workflows/executor/dry.py
@@ -32,20 +32,20 @@ class DryExecutor(BaseExecutor):
 task.started_at = datetime.utcnow()
 task.status = task.STARTED
 
+dry_msg = ' {name} {task.interface_name}.{task.operation_name} 
{suffix}'
+logger = task.context.logger.info if task.implementation else 
task.context.logger.debug
+
+if hasattr(task.actor, 'source_node'):
+name = '{source_node.name}->{target_node.name}'.format(
+source_node=task.actor.source_node, 
target_node=task.actor.target_node)
+else:
+name = task.actor.name
+
 if task.implementation:
-if hasattr(task.actor, 'source_node'):
-name = '{source_node.name}->{target_node.name}'.format(
-source_node=task.actor.source_node, 
target_node=task.actor.target_node)
-else:
-name = task.actor.name
-
-task.context.logger.info(
-' {name} {task.interface_name}.{task.operation_name} 
started...'
-.format(name=name, task=task))
-
-task.context.logger.info(
-' {name} {task.interface_name}.{task.operation_name} 
successful'
-.format(name=name, task=task))
+logger(dry_msg.format(name=name, task=task, suffix='started...'))
+logger(dry_msg.format(name=name, task=task, suffix='successful'))
+else:
+logger(dry_msg.format(name=name, task=task, suffix='has no 
implementation'))
 
 # updating the task manually instead of calling 
self._task_succeeded(task),
 # to avoid any side effects raising that event might cause



[07/19] incubator-ariatosca git commit: ARIA-160 Tests fail spordically over parameter binding

2017-05-22 Thread ran
ARIA-160 Tests fail spordically over parameter binding


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

Branch: refs/heads/ARIA-208-Missing-back-refrences-for-models
Commit: 16fcca45f60f81261757c9fee8f61782c479e30e
Parents: 1febf80
Author: max-orlov 
Authored: Mon May 8 14:46:58 2017 +0300
Committer: max-orlov 
Committed: Tue May 9 14:07:24 2017 +0300

--
 aria/orchestrator/workflows/core/engine.py   |   3 +-
 tests/helpers.py |  23 +++--
 tests/orchestrator/context/test_operation.py | 107 --
 tests/orchestrator/context/test_toolbelt.py  |  40 
 tests/storage/__init__.py|   3 +-
 5 files changed, 92 insertions(+), 84 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/16fcca45/aria/orchestrator/workflows/core/engine.py
--
diff --git a/aria/orchestrator/workflows/core/engine.py 
b/aria/orchestrator/workflows/core/engine.py
index fd0dd6d..561265c 100644
--- a/aria/orchestrator/workflows/core/engine.py
+++ b/aria/orchestrator/workflows/core/engine.py
@@ -42,10 +42,9 @@ class Engine(logger.LoggerMixin):
 super(Engine, self).__init__(**kwargs)
 self._workflow_context = workflow_context
 self._execution_graph = networkx.DiGraph()
-self._executor = executor
 translation.build_execution_graph(task_graph=tasks_graph,
   
execution_graph=self._execution_graph,
-  default_executor=self._executor)
+  default_executor=executor)
 
 def execute(self):
 """

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/16fcca45/tests/helpers.py
--
diff --git a/tests/helpers.py b/tests/helpers.py
index 423e63f..3c3efc9 100644
--- a/tests/helpers.py
+++ b/tests/helpers.py
@@ -14,7 +14,6 @@
 # limitations under the License.
 
 import os
-import tempfile
 import json
 
 from . import ROOT_DIR
@@ -34,16 +33,19 @@ def get_service_template_uri(*args):
 
 
 class FilesystemDataHolder(object):
-_tmpfile = tempfile.NamedTemporaryFile('w')
+
+def __init__(self, path, reset=False):
+self._path = path
+if reset or not os.path.exists(self._path) or open(self._path).read() 
== '':
+self._dump({})
 
 def _load(self):
-return json.load(open(self._tmpfile.name))
+with open(self._path) as f:
+return json.load(f)
 
 def _dump(self, value):
-return json.dump(value, open(self._tmpfile.name, 'w'))
-
-def __init__(self):
-self.clear()
+with open(self._path, 'w') as f:
+return json.dump(value, f)
 
 def __setitem__(self, key, value):
 dict_ = self._load()
@@ -56,9 +58,6 @@ class FilesystemDataHolder(object):
 def __iter__(self):
 return iter(self._load())
 
-def clear(self):
-self._dump({})
-
 def get(self, item, default=None):
 return self._load().get(item, default)
 
@@ -67,3 +66,7 @@ class FilesystemDataHolder(object):
 return_value = dict_.setdefault(key, value)
 self._dump(dict_)
 return return_value
+
+@property
+def path(self):
+return self._path

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/16fcca45/tests/orchestrator/context/test_operation.py
--
diff --git a/tests/orchestrator/context/test_operation.py 
b/tests/orchestrator/context/test_operation.py
index 3180d89..cdeb5fa 100644
--- a/tests/orchestrator/context/test_operation.py
+++ b/tests/orchestrator/context/test_operation.py
@@ -38,7 +38,6 @@ from . import (
 execute,
 )
 
-global_test_holder = helpers.FilesystemDataHolder()
 
 @pytest.fixture
 def ctx(tmpdir):
@@ -68,11 +67,18 @@ def thread_executor():
 ex.close()
 
 
-def test_node_operation_task_execution(ctx, thread_executor):
+@pytest.fixture
+def dataholder(tmpdir):
+dataholder_path = str(tmpdir.join('dataholder'))
+holder = helpers.FilesystemDataHolder(dataholder_path)
+return holder
+
+
+def test_node_operation_task_execution(ctx, thread_executor, dataholder):
 interface_name = 'Standard'
 operation_name = 'create'
 
-inputs = {'putput': True}
+inputs = {'putput': True, 'holder_path': dataholder.path}
 node = 

[04/19] incubator-ariatosca git commit: ARIA-214 Dry execution changes the state of non implemented operations

2017-05-22 Thread ran
ARIA-214 Dry execution changes the state of non implemented operations


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

Branch: refs/heads/ARIA-208-Missing-back-refrences-for-models
Commit: 0ec237071ebdeb28cd2feabbc1b51854543d398d
Parents: 3e1ed14
Author: max-orlov 
Authored: Sun May 7 16:12:56 2017 +0300
Committer: max-orlov 
Committed: Sun May 7 22:29:53 2017 +0300

--
 aria/orchestrator/workflows/core/task.py|  3 ---
 aria/orchestrator/workflows/core/translation.py |  6 +
 aria/orchestrator/workflows/executor/base.py| 19 --
 aria/orchestrator/workflows/executor/celery.py  |  2 +-
 aria/orchestrator/workflows/executor/dry.py | 26 ++--
 aria/orchestrator/workflows/executor/process.py |  2 +-
 aria/orchestrator/workflows/executor/thread.py  |  2 +-
 tests/orchestrator/workflows/core/test_task.py  |  7 ++
 .../workflows/executor/test_process_executor.py | 18 +-
 9 files changed, 31 insertions(+), 54 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/0ec23707/aria/orchestrator/workflows/core/task.py
--
diff --git a/aria/orchestrator/workflows/core/task.py 
b/aria/orchestrator/workflows/core/task.py
index 78159c4..b3dfb3c 100644
--- a/aria/orchestrator/workflows/core/task.py
+++ b/aria/orchestrator/workflows/core/task.py
@@ -163,9 +163,6 @@ class OperationTask(BaseTask):
 self._task_id = task_model.id
 self._update_fields = None
 
-def execute(self):
-super(OperationTask, self).execute()
-
 @contextmanager
 def _update(self):
 """

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/0ec23707/aria/orchestrator/workflows/core/translation.py
--
diff --git a/aria/orchestrator/workflows/core/translation.py 
b/aria/orchestrator/workflows/core/translation.py
index 0bbce90..fec108b 100644
--- a/aria/orchestrator/workflows/core/translation.py
+++ b/aria/orchestrator/workflows/core/translation.py
@@ -48,11 +48,7 @@ def build_execution_graph(
 execution_graph, dependencies, default=[start_task])
 
 if isinstance(api_task, api.task.OperationTask):
-if api_task.implementation:
-operation_task = core_task.OperationTask(api_task, 
executor=default_executor)
-else:
-operation_task = core_task.OperationTask(api_task,
- 
executor=base.EmptyOperationExecutor())
+operation_task = core_task.OperationTask(api_task, 
executor=default_executor)
 _add_task_and_dependencies(execution_graph, operation_task, 
operation_dependencies)
 elif isinstance(api_task, api.task.WorkflowTask):
 # Build the graph recursively while adding start and end markers

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/0ec23707/aria/orchestrator/workflows/executor/base.py
--
diff --git a/aria/orchestrator/workflows/executor/base.py 
b/aria/orchestrator/workflows/executor/base.py
index a225837..c543278 100644
--- a/aria/orchestrator/workflows/executor/base.py
+++ b/aria/orchestrator/workflows/executor/base.py
@@ -25,13 +25,22 @@ class BaseExecutor(logger.LoggerMixin):
 """
 Base class for executors for running tasks
 """
+def _execute(self, task):
+raise NotImplementedError
 
 def execute(self, task):
 """
 Execute a task
 :param task: task to execute
 """
-raise NotImplementedError
+if task.implementation:
+self._execute(task)
+else:
+# In this case the task is missing an implementation. This task 
still gets to an
+# executor, but since there is nothing to run, we by default 
simply skip the execution
+# itself.
+self._task_started(task)
+self._task_succeeded(task)
 
 def close(self):
 """
@@ -52,12 +61,6 @@ class BaseExecutor(logger.LoggerMixin):
 events.on_success_task_signal.send(task)
 
 
-class StubTaskExecutor(BaseExecutor):
+class StubTaskExecutor(BaseExecutor):  
 # pylint: disable=abstract-method
 def execute(self, task):
 task.status = task.SUCCESS
-
-
-class EmptyOperationExecutor(BaseExecutor):
-def execute(self, task):
-  

incubator-ariatosca git commit: ARIA-208 Fix models relationships [Forced Update!]

2017-05-22 Thread ran
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-208-Missing-back-refrences-for-models 890a2a4a2 -> d1628c395 
(forced update)


ARIA-208 Fix models relationships


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

Branch: refs/heads/ARIA-208-Missing-back-refrences-for-models
Commit: d1628c39558c57f8889e8fef57a4b6a28ff32e77
Parents: 8553977
Author: Ran Ziv 
Authored: Sun May 7 14:58:46 2017 +0300
Committer: Ran Ziv 
Committed: Mon May 22 15:14:47 2017 +0300

--
 aria/modeling/service_template.py | 49 --
 1 file changed, 23 insertions(+), 26 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/d1628c39/aria/modeling/service_template.py
--
diff --git a/aria/modeling/service_template.py 
b/aria/modeling/service_template.py
index 7fab4fc..644b8f4 100644
--- a/aria/modeling/service_template.py
+++ b/aria/modeling/service_template.py
@@ -210,10 +210,6 @@ class ServiceTemplateBase(TemplateModelMixin):
 return relationship.one_to_many(cls, 'service')
 
 @declared_attr
-def operation_templates(cls):
-return relationship.one_to_many(cls, 'operation_template')
-
-@declared_attr
 def node_templates(cls):
 return relationship.one_to_many(cls, 'node_template', dict_key='name')
 
@@ -482,6 +478,22 @@ class NodeTemplateBase(TemplateModelMixin):
 def nodes(cls):
 return relationship.one_to_many(cls, 'node')
 
+@declared_attr
+def interface_templates(cls):
+return relationship.one_to_many(cls, 'interface_template', 
dict_key='name')
+
+@declared_attr
+def artifact_templates(cls):
+return relationship.one_to_many(cls, 'artifact_template', 
dict_key='name')
+
+@declared_attr
+def capability_templates(cls):
+return relationship.one_to_many(cls, 'capability_template', 
dict_key='name')
+
+@declared_attr
+def requirement_templates(cls):
+return relationship.one_to_many(cls, 'requirement_template', 
child_fk='node_template_fk')
+
 # endregion
 
 # region many_to_one relationships
@@ -502,22 +514,6 @@ class NodeTemplateBase(TemplateModelMixin):
 def properties(cls):
 return relationship.many_to_many(cls, 'parameter', 
prefix='properties', dict_key='name')
 
-@declared_attr
-def interface_templates(cls):
-return relationship.one_to_many(cls, 'interface_template', 
dict_key='name')
-
-@declared_attr
-def artifact_templates(cls):
-return relationship.one_to_many(cls, 'artifact_template', 
dict_key='name')
-
-@declared_attr
-def capability_templates(cls):
-return relationship.one_to_many(cls, 'capability_template', 
dict_key='name')
-
-@declared_attr
-def requirement_templates(cls):
-return relationship.one_to_many(cls, 'requirement_template', 
child_fk='node_template_fk')
-
 # endregion
 
 description = Column(Text)
@@ -1190,11 +1186,6 @@ class RequirementTemplateBase(TemplateModelMixin):
 def relationships(cls):
 return relationship.one_to_many(cls, 'relationship')
 
-@declared_attr
-def target_node_type(cls):
-return relationship.many_to_one(
-cls, 'type', fk='target_node_type_fk', 
back_populates=relationship.NO_BACK_POP)
-
 # endregion
 
 # region many_to_one relationships
@@ -1203,6 +1194,11 @@ class RequirementTemplateBase(TemplateModelMixin):
 def node_template(cls):
 return relationship.many_to_one(cls, 'node_template', 
fk='node_template_fk')
 
+@declared_attr
+def target_node_type(cls):
+return relationship.many_to_one(
+cls, 'type', fk='target_node_type_fk', 
back_populates=relationship.NO_BACK_POP)
+
 # endregion
 
 # region many_to_many relationships
@@ -1826,7 +1822,8 @@ class OperationTemplateBase(TemplateModelMixin):
 
 @declared_attr
 def service_template(cls):
-return relationship.many_to_one(cls, 'service_template')
+return relationship.many_to_one(cls, 'service_template',
+back_populates='workflow_templates')
 
 @declared_attr
 def interface_template(cls):



incubator-ariatosca git commit: Add property model [Forced Update!]

2017-05-22 Thread avia
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-180-convert-parameter-to-one-to-many fa2cc1cff -> 86db8307f 
(forced update)


Add property model


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

Branch: refs/heads/ARIA-180-convert-parameter-to-one-to-many
Commit: 86db8307f0e67e00042a8be15db106faf751e60f
Parents: 23afaf0
Author: Avia Efrat 
Authored: Mon May 22 12:05:30 2017 +0300
Committer: Avia Efrat 
Committed: Mon May 22 14:26:56 2017 +0300

--
 aria/modeling/models.py |  16 +-
 aria/modeling/service_common.py | 202 ++-
 aria/modeling/service_instance.py   |  24 +--
 aria/modeling/service_template.py   |  24 +--
 .../simple_v1_0/modeling/__init__.py|  22 +-
 tests/cli/test_service_templates.py |   2 +-
 tests/mock/models.py|  13 +-
 tests/modeling/test_models.py   |   4 +-
 8 files changed, 260 insertions(+), 47 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/86db8307/aria/modeling/models.py
--
diff --git a/aria/modeling/models.py b/aria/modeling/models.py
index d7b417b..6d43327 100644
--- a/aria/modeling/models.py
+++ b/aria/modeling/models.py
@@ -73,8 +73,9 @@ __all__ = (
 
 # Common service models
 'Parameter',
-'Input'
-'Output'
+'Input',
+'Output',
+'Property',
 'Type',
 'Metadata',
 
@@ -214,13 +215,19 @@ class Parameter(aria_declarative_base, 
service_common.ParameterBase):
 
 class Input(aria_declarative_base, service_common.InputBase):
 # Temporarily, until we will separate the Parameter model into Input, 
Output, Property and
-# Attribute, Parameter will represent only Property and Attribute.
+# Attribute, Parameter will represent only Attribute.
 pass
 
 
 class Output(aria_declarative_base, service_common.OutputBase):
 # Temporarily, until we will separate the Parameter model into Input, 
Output, Property and
-# Attribute, Parameter will represent only Property and Attribute.
+# Attribute, Parameter will represent only Attribute.
+pass
+
+
+class Property(aria_declarative_base, service_common.PropertyBase):
+# Temporarily, until we will separate the Parameter model into Input, 
Output, Property and
+# Attribute, Parameter will represent only Attribute.
 pass
 
 
@@ -293,6 +300,7 @@ models_to_register = [
 Parameter,
 Input,
 Output,
+Property,
 Type,
 Metadata,
 

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/86db8307/aria/modeling/service_common.py
--
diff --git a/aria/modeling/service_common.py b/aria/modeling/service_common.py
index 0652a5a..0f4998a 100644
--- a/aria/modeling/service_common.py
+++ b/aria/modeling/service_common.py
@@ -228,7 +228,7 @@ class ParameterBase(TemplateModelMixin, 
caching.HasCachedMethods):
 description=description)
 
 
-# TODO dry this code. currently it is a copy of ParameterBase
+# TODO dry this code. currently it is almost a copy of ParameterBase
 class OutputBase(TemplateModelMixin, caching.HasCachedMethods):
 """
 Represents a typed value. The value can contain nested intrinsic functions.
@@ -532,7 +532,7 @@ class TypeBase(InstanceModelMixin):
 return [self] + (self.parent.hierarchy if self.parent else [])
 
 
-# TODO dry this code. currently it is a copy of ParameterBase
+# TODO dry this code. currently it is almost a copy of ParameterBase
 class InputBase(TemplateModelMixin, caching.HasCachedMethods):
 """
 Represents a typed value. The value can contain nested intrinsic functions.
@@ -729,6 +729,202 @@ class InputBase(TemplateModelMixin, 
caching.HasCachedMethods):
 description=description)
 
 
+# TODO dry this code. currently it is almost a copy of ParameterBase
+class PropertyBase(TemplateModelMixin, caching.HasCachedMethods):
+"""
+Represents a typed value. The value can contain nested intrinsic functions.
+
+This model can be used as the ``container_holder`` argument for 
:func:`functions.evaluate`.
+
+:ivar name: Name
+:vartype name: basestring
+:ivar type_name: Type name
+:vartype type_name: basestring
+:ivar value: Value
+:ivar description: Description
+:vartype description: basestring
+"""
+
+__tablename__ = 'property'
+
+

[3/4] incubator-ariatosca git commit: Add input model

2017-05-22 Thread avia
Add input model


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

Branch: refs/heads/ARIA-180-convert-parameter-to-one-to-many
Commit: 23afaf026c25e58bd0c13b0d677da391564f7633
Parents: 7e1d7eb
Author: Avia Efrat 
Authored: Sun May 21 20:10:50 2017 +0300
Committer: Avia Efrat 
Committed: Mon May 22 14:06:27 2017 +0300

--
 aria/modeling/models.py |  11 +-
 aria/modeling/orchestration.py  |   8 +-
 aria/modeling/relationship.py   |   6 +-
 aria/modeling/service_common.py | 202 ++-
 aria/modeling/service_instance.py   |  18 +-
 aria/modeling/service_template.py   |  16 +-
 aria/modeling/utils.py  |   8 +-
 .../simple_v1_0/modeling/__init__.py|  29 +--
 tests/mock/models.py|   2 +-
 tests/mock/topology.py  |   8 +-
 tests/modeling/test_models.py   |   4 +-
 tests/orchestrator/test_workflow_runner.py  |   8 +-
 .../workflows/executor/test_executor.py |   2 +-
 13 files changed, 265 insertions(+), 57 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/23afaf02/aria/modeling/models.py
--
diff --git a/aria/modeling/models.py b/aria/modeling/models.py
index f3acca6..d7b417b 100644
--- a/aria/modeling/models.py
+++ b/aria/modeling/models.py
@@ -73,6 +73,7 @@ __all__ = (
 
 # Common service models
 'Parameter',
+'Input'
 'Output'
 'Type',
 'Metadata',
@@ -211,10 +212,15 @@ class Parameter(aria_declarative_base, 
service_common.ParameterBase):
 pass
 
 
+class Input(aria_declarative_base, service_common.InputBase):
+# Temporarily, until we will separate the Parameter model into Input, 
Output, Property and
+# Attribute, Parameter will represent only Property and Attribute.
+pass
+
+
 class Output(aria_declarative_base, service_common.OutputBase):
 # Temporarily, until we will separate the Parameter model into Input, 
Output, Property and
-# Attribute, Parameter will represent Input, Property and Attribute, and 
Output will represent
-# the outputs.
+# Attribute, Parameter will represent only Property and Attribute.
 pass
 
 
@@ -285,6 +291,7 @@ models_to_register = [
 
 # Common service models
 Parameter,
+Input,
 Output,
 Type,
 Metadata,

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/23afaf02/aria/modeling/orchestration.py
--
diff --git a/aria/modeling/orchestration.py b/aria/modeling/orchestration.py
index ab9d34d..b65ca62 100644
--- a/aria/modeling/orchestration.py
+++ b/aria/modeling/orchestration.py
@@ -115,7 +115,7 @@ class ExecutionBase(ModelMixin):
 
 @declared_attr
 def inputs(cls):
-return relationship.many_to_many(cls, 'parameter', prefix='inputs', 
dict_key='name')
+return relationship.many_to_many(cls, 'input', dict_key='name')
 
 # region foreign keys
 
@@ -230,8 +230,8 @@ class TaskBase(ModelMixin):
 :vartype relationship: :class:`Relationship`
 :ivar plugin: The implementing plugin (set to None for default execution 
plugin)
 :vartype plugin: :class:`Plugin`
-:ivar inputs: Parameters that can be used by this task
-:vartype inputs: {basestring: :class:`Parameter`}
+:ivar inputs: Inputs that can be used by this task
+:vartype inputs: {basestring: :class:`Input`}
 :ivar implementation: Python path to an ``@operation`` function
 :vartype implementation: basestring
 :ivar max_attempts: Maximum number of retries allowed in case of failure
@@ -301,7 +301,7 @@ class TaskBase(ModelMixin):
 
 @declared_attr
 def inputs(cls):
-return relationship.many_to_many(cls, 'parameter', prefix='inputs', 
dict_key='name')
+return relationship.many_to_many(cls, 'input', dict_key='name')
 
 implementation = Column(String)
 max_attempts = Column(Integer, default=1)

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/23afaf02/aria/modeling/relationship.py
--
diff --git a/aria/modeling/relationship.py b/aria/modeling/relationship.py
index c4f4cf3..8644d42 100644
--- a/aria/modeling/relationship.py
+++ b/aria/modeling/relationship.py
@@ -287,8 +287,10 @@ def many_to_many(model_class,
 
 if prefix is not None:
 

[2/4] incubator-ariatosca git commit: add output model

2017-05-22 Thread avia
add output model


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

Branch: refs/heads/ARIA-180-convert-parameter-to-one-to-many
Commit: 7e1d7eb802274539db7b09941d6fab1f6220716f
Parents: 78d6019
Author: Avia Efrat 
Authored: Sun May 21 16:28:30 2017 +0300
Committer: Avia Efrat 
Committed: Mon May 22 14:06:27 2017 +0300

--
 aria/modeling/models.py |   9 +
 aria/modeling/relationship.py   |   4 +-
 aria/modeling/service_common.py | 197 +++
 aria/modeling/service_instance.py   |   4 +-
 aria/modeling/service_template.py   |   4 +-
 examples/hello-world/helloworld.yaml|   5 +
 .../simple_v1_0/modeling/__init__.py|  20 +-
 7 files changed, 230 insertions(+), 13 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/7e1d7eb8/aria/modeling/models.py
--
diff --git a/aria/modeling/models.py b/aria/modeling/models.py
index 584b877..f3acca6 100644
--- a/aria/modeling/models.py
+++ b/aria/modeling/models.py
@@ -73,6 +73,7 @@ __all__ = (
 
 # Common service models
 'Parameter',
+'Output'
 'Type',
 'Metadata',
 
@@ -210,6 +211,13 @@ class Parameter(aria_declarative_base, 
service_common.ParameterBase):
 pass
 
 
+class Output(aria_declarative_base, service_common.OutputBase):
+# Temporarily, until we will separate the Parameter model into Input, 
Output, Property and
+# Attribute, Parameter will represent Input, Property and Attribute, and 
Output will represent
+# the outputs.
+pass
+
+
 class Type(aria_declarative_base, service_common.TypeBase):
 pass
 
@@ -277,6 +285,7 @@ models_to_register = [
 
 # Common service models
 Parameter,
+Output,
 Type,
 Metadata,
 

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/7e1d7eb8/aria/modeling/relationship.py
--
diff --git a/aria/modeling/relationship.py b/aria/modeling/relationship.py
index 40be5b2..c4f4cf3 100644
--- a/aria/modeling/relationship.py
+++ b/aria/modeling/relationship.py
@@ -287,8 +287,8 @@ def many_to_many(model_class,
 
 if prefix is not None:
 secondary_table_name = '{0}_{1}'.format(prefix, secondary_table_name)
-if other_property is None:
-other_property = '{0}_{1}'.format(prefix, 
formatting.pluralize(this_table))
+if other_property is None:
+other_property = '{0}_{1}'.format(prefix, 
formatting.pluralize(this_table))
 
 secondary_table = _get_secondary_table(
 model_class.metadata,

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/7e1d7eb8/aria/modeling/service_common.py
--
diff --git a/aria/modeling/service_common.py b/aria/modeling/service_common.py
index e9c96a4..05698b6 100644
--- a/aria/modeling/service_common.py
+++ b/aria/modeling/service_common.py
@@ -228,6 +228,203 @@ class ParameterBase(TemplateModelMixin, 
caching.HasCachedMethods):
 description=description)
 
 
+# TODO dry this code. currently it is a copy of ParameterBase
+class OutputBase(TemplateModelMixin, caching.HasCachedMethods):
+"""
+Represents a typed value. The value can contain nested intrinsic functions.
+
+This model can be used as the ``container_holder`` argument for 
:func:`functions.evaluate`.
+
+:ivar name: Name
+:vartype name: basestring
+:ivar type_name: Type name
+:vartype type_name: basestring
+:ivar value: Value
+:ivar description: Description
+:vartype description: basestring
+"""
+
+__tablename__ = 'output'
+
+name = Column(Text)
+type_name = Column(Text)
+description = Column(Text)
+_value = Column(PickleType)
+
+@property
+def value(self):
+value = self._value
+if value is not None:
+evaluation = functions.evaluate(value, self)
+if evaluation is not None:
+value = evaluation.value
+return value
+
+@value.setter
+def value(self, value):
+self._value = value
+
+@property
+@caching.cachedmethod
+def owner(self):
+"""
+The sole owner of this parameter, which is another model that relates 
to it.
+
+*All* parameters should have an owner model. In case this property 
method fails to find
+it, it will raise a ValueError, 

[4/4] incubator-ariatosca git commit: Add property model

2017-05-22 Thread avia
Add property model


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

Branch: refs/heads/ARIA-180-convert-parameter-to-one-to-many
Commit: fa2cc1cff9866d84b51d7c8b68b7c6695446e9c1
Parents: 23afaf0
Author: Avia Efrat 
Authored: Mon May 22 12:05:30 2017 +0300
Committer: Avia Efrat 
Committed: Mon May 22 14:21:22 2017 +0300

--
 aria/modeling/models.py |  16 +-
 aria/modeling/service_common.py | 238 ++-
 aria/modeling/service_instance.py   |  24 +-
 aria/modeling/service_template.py   |  24 +-
 .../simple_v1_0/modeling/__init__.py|  22 +-
 tests/cli/test_service_templates.py |   2 +-
 tests/mock/models.py|  13 +-
 tests/modeling/test_models.py   |   4 +-
 8 files changed, 297 insertions(+), 46 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/fa2cc1cf/aria/modeling/models.py
--
diff --git a/aria/modeling/models.py b/aria/modeling/models.py
index d7b417b..6d43327 100644
--- a/aria/modeling/models.py
+++ b/aria/modeling/models.py
@@ -73,8 +73,9 @@ __all__ = (
 
 # Common service models
 'Parameter',
-'Input'
-'Output'
+'Input',
+'Output',
+'Property',
 'Type',
 'Metadata',
 
@@ -214,13 +215,19 @@ class Parameter(aria_declarative_base, 
service_common.ParameterBase):
 
 class Input(aria_declarative_base, service_common.InputBase):
 # Temporarily, until we will separate the Parameter model into Input, 
Output, Property and
-# Attribute, Parameter will represent only Property and Attribute.
+# Attribute, Parameter will represent only Attribute.
 pass
 
 
 class Output(aria_declarative_base, service_common.OutputBase):
 # Temporarily, until we will separate the Parameter model into Input, 
Output, Property and
-# Attribute, Parameter will represent only Property and Attribute.
+# Attribute, Parameter will represent only Attribute.
+pass
+
+
+class Property(aria_declarative_base, service_common.PropertyBase):
+# Temporarily, until we will separate the Parameter model into Input, 
Output, Property and
+# Attribute, Parameter will represent only Attribute.
 pass
 
 
@@ -293,6 +300,7 @@ models_to_register = [
 Parameter,
 Input,
 Output,
+Property,
 Type,
 Metadata,
 

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/fa2cc1cf/aria/modeling/service_common.py
--
diff --git a/aria/modeling/service_common.py b/aria/modeling/service_common.py
index 0652a5a..0487cab 100644
--- a/aria/modeling/service_common.py
+++ b/aria/modeling/service_common.py
@@ -228,7 +228,7 @@ class ParameterBase(TemplateModelMixin, 
caching.HasCachedMethods):
 description=description)
 
 
-# TODO dry this code. currently it is a copy of ParameterBase
+# TODO dry this code. currently it is almost a copy of ParameterBase
 class OutputBase(TemplateModelMixin, caching.HasCachedMethods):
 """
 Represents a typed value. The value can contain nested intrinsic functions.
@@ -532,7 +532,7 @@ class TypeBase(InstanceModelMixin):
 return [self] + (self.parent.hierarchy if self.parent else [])
 
 
-# TODO dry this code. currently it is a copy of ParameterBase
+# TODO dry this code. currently it is almost a copy of ParameterBase
 class InputBase(TemplateModelMixin, caching.HasCachedMethods):
 """
 Represents a typed value. The value can contain nested intrinsic functions.
@@ -765,3 +765,237 @@ class MetadataBase(TemplateModelMixin):
 console.puts('{0}: {1}'.format(
 context.style.property(self.name),
 context.style.literal(self.value)))
+
+
+# TODO dry this code. currently it is almost a copy of ParameterBase
+class PropertyBase(TemplateModelMixin, caching.HasCachedMethods):
+"""
+Represents a typed value. The value can contain nested intrinsic functions.
+
+This model can be used as the ``container_holder`` argument for 
:func:`functions.evaluate`.
+
+:ivar name: Name
+:vartype name: basestring
+:ivar type_name: Type name
+:vartype type_name: basestring
+:ivar value: Value
+:ivar description: Description
+:vartype description: basestring
+"""
+
+__tablename__ = 'property'
+
+name = Column(Text)
+type_name = Column(Text)
+description = Column(Text)
+

incubator-ariatosca git commit: Add property model

2017-05-22 Thread avia
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-180-convert-parameter-to-one-to-many ee747ef4e -> 33ff7f55c


Add property model


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

Branch: refs/heads/ARIA-180-convert-parameter-to-one-to-many
Commit: 33ff7f55cd85eae21a94afd95a2ad2f46b9c5a18
Parents: ee747ef
Author: Avia Efrat 
Authored: Mon May 22 12:05:30 2017 +0300
Committer: Avia Efrat 
Committed: Mon May 22 12:05:30 2017 +0300

--
 aria/modeling/models.py |  16 +-
 aria/modeling/service_common.py | 238 ++-
 aria/modeling/service_instance.py   |  24 +-
 aria/modeling/service_template.py   |  24 +-
 .../simple_v1_0/modeling/__init__.py|  22 +-
 5 files changed, 285 insertions(+), 39 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/33ff7f55/aria/modeling/models.py
--
diff --git a/aria/modeling/models.py b/aria/modeling/models.py
index d7b417b..6d43327 100644
--- a/aria/modeling/models.py
+++ b/aria/modeling/models.py
@@ -73,8 +73,9 @@ __all__ = (
 
 # Common service models
 'Parameter',
-'Input'
-'Output'
+'Input',
+'Output',
+'Property',
 'Type',
 'Metadata',
 
@@ -214,13 +215,19 @@ class Parameter(aria_declarative_base, 
service_common.ParameterBase):
 
 class Input(aria_declarative_base, service_common.InputBase):
 # Temporarily, until we will separate the Parameter model into Input, 
Output, Property and
-# Attribute, Parameter will represent only Property and Attribute.
+# Attribute, Parameter will represent only Attribute.
 pass
 
 
 class Output(aria_declarative_base, service_common.OutputBase):
 # Temporarily, until we will separate the Parameter model into Input, 
Output, Property and
-# Attribute, Parameter will represent only Property and Attribute.
+# Attribute, Parameter will represent only Attribute.
+pass
+
+
+class Property(aria_declarative_base, service_common.PropertyBase):
+# Temporarily, until we will separate the Parameter model into Input, 
Output, Property and
+# Attribute, Parameter will represent only Attribute.
 pass
 
 
@@ -293,6 +300,7 @@ models_to_register = [
 Parameter,
 Input,
 Output,
+Property,
 Type,
 Metadata,
 

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/33ff7f55/aria/modeling/service_common.py
--
diff --git a/aria/modeling/service_common.py b/aria/modeling/service_common.py
index 0652a5a..0487cab 100644
--- a/aria/modeling/service_common.py
+++ b/aria/modeling/service_common.py
@@ -228,7 +228,7 @@ class ParameterBase(TemplateModelMixin, 
caching.HasCachedMethods):
 description=description)
 
 
-# TODO dry this code. currently it is a copy of ParameterBase
+# TODO dry this code. currently it is almost a copy of ParameterBase
 class OutputBase(TemplateModelMixin, caching.HasCachedMethods):
 """
 Represents a typed value. The value can contain nested intrinsic functions.
@@ -532,7 +532,7 @@ class TypeBase(InstanceModelMixin):
 return [self] + (self.parent.hierarchy if self.parent else [])
 
 
-# TODO dry this code. currently it is a copy of ParameterBase
+# TODO dry this code. currently it is almost a copy of ParameterBase
 class InputBase(TemplateModelMixin, caching.HasCachedMethods):
 """
 Represents a typed value. The value can contain nested intrinsic functions.
@@ -765,3 +765,237 @@ class MetadataBase(TemplateModelMixin):
 console.puts('{0}: {1}'.format(
 context.style.property(self.name),
 context.style.literal(self.value)))
+
+
+# TODO dry this code. currently it is almost a copy of ParameterBase
+class PropertyBase(TemplateModelMixin, caching.HasCachedMethods):
+"""
+Represents a typed value. The value can contain nested intrinsic functions.
+
+This model can be used as the ``container_holder`` argument for 
:func:`functions.evaluate`.
+
+:ivar name: Name
+:vartype name: basestring
+:ivar type_name: Type name
+:vartype type_name: basestring
+:ivar value: Value
+:ivar description: Description
+:vartype description: basestring
+"""
+
+__tablename__ = 'property'
+
+name = Column(Text)
+type_name = Column(Text)
+description = Column(Text)
+_value = Column(PickleType)
+
+@property

[2/2] incubator-ariatosca git commit: Add input model

2017-05-22 Thread avia
Add input model


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

Branch: refs/heads/ARIA-180-convert-parameter-to-one-to-many
Commit: ee747ef4e635a53b937682cba06dbebbf8a27bc0
Parents: 2631de6
Author: Avia Efrat 
Authored: Sun May 21 20:10:50 2017 +0300
Committer: Avia Efrat 
Committed: Sun May 21 20:10:50 2017 +0300

--
 aria/modeling/models.py |  11 +-
 aria/modeling/orchestration.py  |   8 +-
 aria/modeling/relationship.py   |   6 +-
 aria/modeling/service_common.py | 202 ++-
 aria/modeling/service_instance.py   |  18 +-
 aria/modeling/service_template.py   |  16 +-
 aria/modeling/utils.py  |   8 +-
 .../simple_v1_0/modeling/__init__.py|  29 +--
 tests/mock/models.py|   2 +-
 tests/mock/topology.py  |   8 +-
 tests/modeling/test_models.py   |   4 +-
 tests/orchestrator/test_workflow_runner.py  |   8 +-
 .../workflows/executor/test_executor.py |   2 +-
 13 files changed, 265 insertions(+), 57 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/ee747ef4/aria/modeling/models.py
--
diff --git a/aria/modeling/models.py b/aria/modeling/models.py
index f3acca6..d7b417b 100644
--- a/aria/modeling/models.py
+++ b/aria/modeling/models.py
@@ -73,6 +73,7 @@ __all__ = (
 
 # Common service models
 'Parameter',
+'Input'
 'Output'
 'Type',
 'Metadata',
@@ -211,10 +212,15 @@ class Parameter(aria_declarative_base, 
service_common.ParameterBase):
 pass
 
 
+class Input(aria_declarative_base, service_common.InputBase):
+# Temporarily, until we will separate the Parameter model into Input, 
Output, Property and
+# Attribute, Parameter will represent only Property and Attribute.
+pass
+
+
 class Output(aria_declarative_base, service_common.OutputBase):
 # Temporarily, until we will separate the Parameter model into Input, 
Output, Property and
-# Attribute, Parameter will represent Input, Property and Attribute, and 
Output will represent
-# the outputs.
+# Attribute, Parameter will represent only Property and Attribute.
 pass
 
 
@@ -285,6 +291,7 @@ models_to_register = [
 
 # Common service models
 Parameter,
+Input,
 Output,
 Type,
 Metadata,

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/ee747ef4/aria/modeling/orchestration.py
--
diff --git a/aria/modeling/orchestration.py b/aria/modeling/orchestration.py
index ab9d34d..b65ca62 100644
--- a/aria/modeling/orchestration.py
+++ b/aria/modeling/orchestration.py
@@ -115,7 +115,7 @@ class ExecutionBase(ModelMixin):
 
 @declared_attr
 def inputs(cls):
-return relationship.many_to_many(cls, 'parameter', prefix='inputs', 
dict_key='name')
+return relationship.many_to_many(cls, 'input', dict_key='name')
 
 # region foreign keys
 
@@ -230,8 +230,8 @@ class TaskBase(ModelMixin):
 :vartype relationship: :class:`Relationship`
 :ivar plugin: The implementing plugin (set to None for default execution 
plugin)
 :vartype plugin: :class:`Plugin`
-:ivar inputs: Parameters that can be used by this task
-:vartype inputs: {basestring: :class:`Parameter`}
+:ivar inputs: Inputs that can be used by this task
+:vartype inputs: {basestring: :class:`Input`}
 :ivar implementation: Python path to an ``@operation`` function
 :vartype implementation: basestring
 :ivar max_attempts: Maximum number of retries allowed in case of failure
@@ -301,7 +301,7 @@ class TaskBase(ModelMixin):
 
 @declared_attr
 def inputs(cls):
-return relationship.many_to_many(cls, 'parameter', prefix='inputs', 
dict_key='name')
+return relationship.many_to_many(cls, 'input', dict_key='name')
 
 implementation = Column(String)
 max_attempts = Column(Integer, default=1)

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/ee747ef4/aria/modeling/relationship.py
--
diff --git a/aria/modeling/relationship.py b/aria/modeling/relationship.py
index c4f4cf3..8644d42 100644
--- a/aria/modeling/relationship.py
+++ b/aria/modeling/relationship.py
@@ -287,8 +287,10 @@ def many_to_many(model_class,
 
 if prefix is not None: