incubator-ariatosca git commit: Document backreferences (and fix for many-to-many)

2017-03-05 Thread emblemparade
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-105-integrate-modeling 24ad8ba1e -> 5ceb14cd4


Document backreferences (and fix for many-to-many)


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

Branch: refs/heads/ARIA-105-integrate-modeling
Commit: 5ceb14cd43a04703aee0c78b79018217bdf25494
Parents: 24ad8ba
Author: Tal Liron 
Authored: Sun Mar 5 13:45:11 2017 -0600
Committer: Tal Liron 
Committed: Sun Mar 5 13:45:11 2017 -0600

--
 aria/modeling/bases.py|   2 +-
 aria/modeling/orchestration.py|   3 +-
 aria/modeling/service.py  | 102 +
 aria/modeling/service_template.py |  76 
 4 files changed, 169 insertions(+), 14 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/5ceb14cd/aria/modeling/bases.py
--
diff --git a/aria/modeling/bases.py b/aria/modeling/bases.py
index 7fe218d..a4db320 100644
--- a/aria/modeling/bases.py
+++ b/aria/modeling/bases.py
@@ -199,7 +199,7 @@ class ModelMixin(object):
 helper_table = '{0}_{1}'.format(this_table, other_table)
 
 if backreference is None:
-backreference = this_table
+backreference = formatting.pluralize(this_table)
 if table_prefix:
 helper_table = '{0}_{1}'.format(table_prefix, helper_table)
 backreference = '{0}_{1}'.format(table_prefix, backreference)

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/5ceb14cd/aria/modeling/orchestration.py
--
diff --git a/aria/modeling/orchestration.py b/aria/modeling/orchestration.py
index 30879e9..8428b69 100644
--- a/aria/modeling/orchestration.py
+++ b/aria/modeling/orchestration.py
@@ -174,7 +174,8 @@ class ServiceUpdateBase(ModelMixin):
 
 @declared_attr
 def service(cls):
-return cls.many_to_one_relationship('service')
+return cls.many_to_one_relationship('service',
+backreference='updates')
 
 @declared_attr
 def service_name(cls):

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/5ceb14cd/aria/modeling/service.py
--
diff --git a/aria/modeling/service.py b/aria/modeling/service.py
index 842d0fc..eb8acb5 100644
--- a/aria/modeling/service.py
+++ b/aria/modeling/service.py
@@ -69,6 +69,18 @@ class ServiceBase(InstanceModelMixin): # pylint: 
disable=too-many-public-methods
 :vartype created_at: :class:`datetime.datetime`
 :ivar updated_at: Update timestamp
 :vartype updated_at: :class:`datetime.datetime`
+
+:ivar permalink: ??
+:vartype permalink: basestring
+:ivar scaling_groups: ??
+:vartype scaling_groups: {}
+
+:ivar modifications: Modifications of this service
+:vartype modifications: [:class:`ServiceModification`]
+:ivar updates: Updates of this service
+:vartype updates: [:class:`ServiceUpdate`]
+:ivar executions: Executions on this service
+:vartype executions: [:class:`Execution`]
 """
 
 __tablename__ = 'service'
@@ -304,6 +316,26 @@ class NodeBase(InstanceModelMixin):
 :vartype plugins: {basestring: :class:`Plugin`}
 :ivar host: Host node (can be self)
 :vartype host: :class:`Node`
+
+:ivar runtime_properties: TODO: should be replaced with attributes
+:vartype runtime_properties: {}
+:ivar scaling_groups: ??
+:vartype scaling_groups: []
+:ivar state: ??
+:vartype state: basestring
+:ivar version: ??
+:vartype version: int
+
+:ivar service: Containing service
+:vartype service: :class:`Service`
+:ivar groups: We are a member of these groups
+:vartype groups: [:class:`Group`]
+:ivar policies: Policies enacted on this node
+:vartype policies: [:class:`Policy`]
+:ivar substitution_mapping: Our contribution to service substitution
+:vartype substitution_mapping: :class:`SubstitutionMapping`
+:ivar tasks: Tasks on this node
+:vartype tasks: [:class:`Task`]
 """
 
 __tablename__ = 'node'
@@ -558,6 +590,11 @@ class GroupBase(InstanceModelMixin):
 :vartype properties: {basestring: :class:`Parameter`}
 :ivar interfaces: Bundles of operations
 :vartype interfaces: {basestring: :class:`Interface`}
+
+:ivar service: Containing service
+:vartype service: :class:`Service`
+:ivar policies: Policies 

[GitHub] incubator-ariatosca pull request #74: ARIA-115-Log-model-should-have-an-Exec...

2017-03-05 Thread mxmrlv
GitHub user mxmrlv opened a pull request:

https://github.com/apache/incubator-ariatosca/pull/74

ARIA-115-Log-model-should-have-an-Execution-field



You can merge this pull request into a Git repository by running:

$ git pull https://github.com/apache/incubator-ariatosca 
ARIA-115-Log-model-should-have-an-Execution-field

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/incubator-ariatosca/pull/74.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #74


commit 33ff844cdefe2e26744c03b452916f8f834eee2a
Author: max-orlov 
Date:   2017-03-05T17:18:21Z

ARIA-115-Log-model-should-have-an-Execution-field




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


incubator-ariatosca git commit: ARIA-115-Log-model-should-have-an-Execution-field

2017-03-05 Thread mxmrlv
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-115-Log-model-should-have-an-Execution-field [created] 
33ff844cd


ARIA-115-Log-model-should-have-an-Execution-field


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

Branch: refs/heads/ARIA-115-Log-model-should-have-an-Execution-field
Commit: 33ff844cdefe2e26744c03b452916f8f834eee2a
Parents: dc18c1d
Author: max-orlov 
Authored: Sun Mar 5 19:18:21 2017 +0200
Committer: max-orlov 
Committed: Sun Mar 5 19:18:21 2017 +0200

--
 aria/logger.py | 12 +---
 aria/orchestrator/context/common.py|  6 +-
 aria/orchestrator/context/workflow.py  |  2 --
 aria/storage/modeling/orchestrator_elements.py |  8 
 4 files changed, 22 insertions(+), 6 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/33ff844c/aria/logger.py
--
diff --git a/aria/logger.py b/aria/logger.py
index 9fe05ae..6f0b84a 100644
--- a/aria/logger.py
+++ b/aria/logger.py
@@ -98,13 +98,17 @@ def create_console_log_handler(level=logging.DEBUG, 
formatter=None):
 return console
 
 
-def create_sqla_log_handler(session, engine, log_cls, level=logging.DEBUG):
+def create_sqla_log_handler(session, engine, 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, 
level=level)
+return _SQLAlchemyHandler(session=session,
+  engine=engine,
+  log_cls=log_cls,
+  execution_id=execution_id,
+  level=level)
 
 
 class _DefaultConsoleFormat(logging.Formatter):
@@ -148,16 +152,18 @@ def create_file_log_handler(
 
 class _SQLAlchemyHandler(logging.Handler):
 
-def __init__(self, session, engine, log_cls, **kwargs):
+def __init__(self, session, engine, log_cls, execution_id, **kwargs):
 logging.Handler.__init__(self, **kwargs)
 self._session = session
 self._engine = engine
 self._cls = log_cls
+self._execution_id = execution_id
 
 def emit(self, record):
 created_at = 
datetime.strptime(logging.Formatter('%(asctime)s').formatTime(record),
'%Y-%m-%d %H:%M:%S,%f')
 log = self._cls(
+execution_fk=self._execution_id,
 actor=record.prefix,
 level=record.levelname,
 msg=record.msg,

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/33ff844c/aria/orchestrator/context/common.py
--
diff --git a/aria/orchestrator/context/common.py 
b/aria/orchestrator/context/common.py
index b34cd5d..947c474 100644
--- a/aria/orchestrator/context/common.py
+++ b/aria/orchestrator/context/common.py
@@ -51,6 +51,7 @@ class BaseContext(object):
 service_instance_id,
 model_storage,
 resource_storage,
+execution_id,
 workdir=None,
 **kwargs):
 super(BaseContext, self).__init__(**kwargs)
@@ -60,6 +61,7 @@ class BaseContext(object):
 self._resource = resource_storage
 self._service_instance_id = service_instance_id
 self._workdir = workdir
+self._execution_id = execution_id
 self.logger = None
 
 def _register_logger(self, logger_name=None, level=None):
@@ -74,7 +76,9 @@ class BaseContext(object):
 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.model.Log, 
**api_kwargs)
+return aria_logger.create_sqla_log_handler(log_cls=modeling.model.Log,
+   
execution_id=self._execution_id,
+   **api_kwargs)
 
 def __repr__(self):
 return (

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/33ff844c/aria/orchestrator/context/workflow.py
--
diff --git a/aria/orchestrator/context/workflow.py 

[jira] [Commented] (ARIA-116) Missing type_hierarchy in relationship

2017-03-05 Thread ASF subversion and git services (JIRA)

[ 
https://issues.apache.org/jira/browse/ARIA-116?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15896425#comment-15896425
 ] 

ASF subversion and git services commented on ARIA-116:
--

Commit 347f8503a3fc37132da6d2a2374487273417174a in incubator-ariatosca's branch 
refs/heads/ARIA-116-Missing-type_hierarchy-in-relationship from [~Mxmrlv]
[ https://git-wip-us.apache.org/repos/asf?p=incubator-ariatosca.git;h=347f850 ]

ARIA-116-Missing-type_hierarchy-in-relationship


> Missing type_hierarchy in relationship
> --
>
> Key: ARIA-116
> URL: https://issues.apache.org/jira/browse/ARIA-116
> Project: AriaTosca
>  Issue Type: Bug
>Affects Versions: 0.1.0
>Reporter: Maxim Orlov
>Assignee: Maxim Orlov
>
> The model of Relationship is missing type_hierarchy. It should be reinstated.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


incubator-ariatosca git commit: ARIA-116-Missing-type_hierarchy-in-relationship [Forced Update!]

2017-03-05 Thread mxmrlv
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-116-Missing-type_hierarchy-in-relationship 7ec515022 -> 
347f8503a (forced update)


ARIA-116-Missing-type_hierarchy-in-relationship


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

Branch: refs/heads/ARIA-116-Missing-type_hierarchy-in-relationship
Commit: 347f8503a3fc37132da6d2a2374487273417174a
Parents: dc18c1d
Author: max-orlov 
Authored: Sun Mar 5 18:31:36 2017 +0200
Committer: max-orlov 
Committed: Sun Mar 5 18:59:02 2017 +0200

--
 aria/storage/modeling/instance_elements.py |  3 +-
 tests/storage/test_models.py   | 81 +
 2 files changed, 59 insertions(+), 25 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/347f8503/aria/storage/modeling/instance_elements.py
--
diff --git a/aria/storage/modeling/instance_elements.py 
b/aria/storage/modeling/instance_elements.py
index 2b102f1..86e2ea6 100644
--- a/aria/storage/modeling/instance_elements.py
+++ b/aria/storage/modeling/instance_elements.py
@@ -1179,8 +1179,9 @@ class RelationshipBase(structure.ModelMixin):
 target_capability_name = Column(Text)
 type_name = Column(Text)
 template_name = Column(Text)
+type_hierarchy = Column(aria_types.List)
 
-# # region orchestrator required columns
+# region orchestrator required columns
 source_position = Column(Integer)
 target_position = Column(Integer)
 

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/347f8503/tests/storage/test_models.py
--
diff --git a/tests/storage/test_models.py b/tests/storage/test_models.py
index 1e8d6b5..81b4122 100644
--- a/tests/storage/test_models.py
+++ b/tests/storage/test_models.py
@@ -91,12 +91,20 @@ def _node_template_storage():
 
 
 def _nodes_storage():
-storage = _nodes_storage()
+storage = _node_template_storage()
 service_instance = 
storage.service_instance.get_by_name(mock.models.DEPLOYMENT_NAME)
-dependent_node_template = 
storage.node_template.get_by_name(mock.models.DEPENDENT_NODE_NAME)
+
 dependency_node_template = 
storage.node_template.get_by_name(mock.models.DEPENDENCY_NODE_NAME)
 dependency_node = 
mock.models.get_dependency_node_instance(dependency_node_template,

service_instance)
+
+req_template, cap_template = mock.models.get_relationship(dependency_node)
+storage.requirement_template.put(req_template)
+storage.capability_template.put(cap_template)
+
+dependent_node_template = mock.models.get_dependent_node(service_instance,
+ req_template,
+ cap_template)
 dependent_node = 
mock.models.get_dependent_node_instance(dependent_node_template,
  service_instance)
 storage.node.put(dependency_node)
@@ -670,29 +678,54 @@ class TestNodeInstanceIP(object):
 return node_instance
 
 
-@pytest.mark.skip('Should be reworked into relationship')
 class TestRelationshipInstance(object):
-def test_relatiship_instance_model_creation(self, nodes_storage):
-relationship = mock.models.get_relationship(
-
target=nodes_storage.node.get_by_name(mock.models.DEPENDENCY_NODE_NAME)
-)
-nodes_storage.relationship.put(relationship)
-node_instances = nodes_storage.node
-source_node_instance = 
node_instances.get_by_name(mock.models.DEPENDENT_NODE_INSTANCE_NAME)
-target_node_instance = 
node_instances.get_by_name(mock.models.DEPENDENCY_NODE_INSTANCE_NAME)
-
-relationship_instance = _test_model(
-is_valid=True,
-storage=nodes_storage,
-model_cls=Relationship,
-model_kwargs=dict(
-relationship=relationship,
-source_node_instance=source_node_instance,
-target_node_instance=target_node_instance
-))
-assert relationship_instance.relationship == relationship
-assert relationship_instance.source_node_instance == 
source_node_instance
-assert relationship_instance.target_node_instance == 
target_node_instance
+@pytest.mark.parametrize(
+'is_valid, source_requirement_index, target_node_id, 
target_capability_name, type_name, '
+

[jira] [Commented] (ARIA-116) Missing type_hierarchy in relationship

2017-03-05 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/ARIA-116?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15896418#comment-15896418
 ] 

ASF GitHub Bot commented on ARIA-116:
-

GitHub user mxmrlv opened a pull request:

https://github.com/apache/incubator-ariatosca/pull/73

ARIA-116-Missing-type_hierarchy-in-relationship



You can merge this pull request into a Git repository by running:

$ git pull https://github.com/apache/incubator-ariatosca 
ARIA-116-Missing-type_hierarchy-in-relationship

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/incubator-ariatosca/pull/73.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #73


commit 7ec51502269677fc4975387694fef513b4fda71a
Author: max-orlov 
Date:   2017-03-05T16:31:36Z

ARIA-116-Missing-type_hierarchy-in-relationship




> Missing type_hierarchy in relationship
> --
>
> Key: ARIA-116
> URL: https://issues.apache.org/jira/browse/ARIA-116
> Project: AriaTosca
>  Issue Type: Bug
>Affects Versions: 0.1.0
>Reporter: Maxim Orlov
>Assignee: Maxim Orlov
>
> The model of Relationship is missing type_hierarchy. It should be reinstated.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[GitHub] incubator-ariatosca pull request #73: ARIA-116-Missing-type_hierarchy-in-rel...

2017-03-05 Thread mxmrlv
GitHub user mxmrlv opened a pull request:

https://github.com/apache/incubator-ariatosca/pull/73

ARIA-116-Missing-type_hierarchy-in-relationship



You can merge this pull request into a Git repository by running:

$ git pull https://github.com/apache/incubator-ariatosca 
ARIA-116-Missing-type_hierarchy-in-relationship

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/incubator-ariatosca/pull/73.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #73


commit 7ec51502269677fc4975387694fef513b4fda71a
Author: max-orlov 
Date:   2017-03-05T16:31:36Z

ARIA-116-Missing-type_hierarchy-in-relationship




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[jira] [Commented] (ARIA-116) Missing type_hierarchy in relationship

2017-03-05 Thread ASF subversion and git services (JIRA)

[ 
https://issues.apache.org/jira/browse/ARIA-116?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15896417#comment-15896417
 ] 

ASF subversion and git services commented on ARIA-116:
--

Commit 7ec51502269677fc4975387694fef513b4fda71a in incubator-ariatosca's branch 
refs/heads/ARIA-116-Missing-type_hierarchy-in-relationship from [~Mxmrlv]
[ https://git-wip-us.apache.org/repos/asf?p=incubator-ariatosca.git;h=7ec5150 ]

ARIA-116-Missing-type_hierarchy-in-relationship


> Missing type_hierarchy in relationship
> --
>
> Key: ARIA-116
> URL: https://issues.apache.org/jira/browse/ARIA-116
> Project: AriaTosca
>  Issue Type: Bug
>Affects Versions: 0.1.0
>Reporter: Maxim Orlov
>Assignee: Maxim Orlov
>
> The model of Relationship is missing type_hierarchy. It should be reinstated.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


incubator-ariatosca git commit: ARIA-116-Missing-type_hierarchy-in-relationship [Forced Update!]

2017-03-05 Thread mxmrlv
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-116-Missing-type_hierarchy-in-relationship e6ea0c0be -> 
7ec515022 (forced update)


ARIA-116-Missing-type_hierarchy-in-relationship


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

Branch: refs/heads/ARIA-116-Missing-type_hierarchy-in-relationship
Commit: 7ec51502269677fc4975387694fef513b4fda71a
Parents: dc18c1d
Author: max-orlov 
Authored: Sun Mar 5 18:31:36 2017 +0200
Committer: max-orlov 
Committed: Sun Mar 5 18:55:31 2017 +0200

--
 aria/storage/modeling/instance_elements.py |  3 +-
 tests/storage/test_models.py   | 81 +
 2 files changed, 59 insertions(+), 25 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/7ec51502/aria/storage/modeling/instance_elements.py
--
diff --git a/aria/storage/modeling/instance_elements.py 
b/aria/storage/modeling/instance_elements.py
index 2b102f1..86e2ea6 100644
--- a/aria/storage/modeling/instance_elements.py
+++ b/aria/storage/modeling/instance_elements.py
@@ -1179,8 +1179,9 @@ class RelationshipBase(structure.ModelMixin):
 target_capability_name = Column(Text)
 type_name = Column(Text)
 template_name = Column(Text)
+type_hierarchy = Column(aria_types.List)
 
-# # region orchestrator required columns
+# region orchestrator required columns
 source_position = Column(Integer)
 target_position = Column(Integer)
 

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/7ec51502/tests/storage/test_models.py
--
diff --git a/tests/storage/test_models.py b/tests/storage/test_models.py
index 1e8d6b5..5735408 100644
--- a/tests/storage/test_models.py
+++ b/tests/storage/test_models.py
@@ -91,12 +91,20 @@ def _node_template_storage():
 
 
 def _nodes_storage():
-storage = _nodes_storage()
+storage = _node_template_storage()
 service_instance = 
storage.service_instance.get_by_name(mock.models.DEPLOYMENT_NAME)
-dependent_node_template = 
storage.node_template.get_by_name(mock.models.DEPENDENT_NODE_NAME)
+
 dependency_node_template = 
storage.node_template.get_by_name(mock.models.DEPENDENCY_NODE_NAME)
 dependency_node = 
mock.models.get_dependency_node_instance(dependency_node_template,

service_instance)
+
+req_template, cap_template = mock.models.get_relationship(dependency_node)
+storage.requirement_template.put(req_template)
+storage.capability_template.put(cap_template)
+
+dependent_node_template = mock.models.get_dependent_node(service_instance,
+ req_template,
+ cap_template)
 dependent_node = 
mock.models.get_dependent_node_instance(dependent_node_template,
  service_instance)
 storage.node.put(dependency_node)
@@ -670,29 +678,54 @@ class TestNodeInstanceIP(object):
 return node_instance
 
 
-@pytest.mark.skip('Should be reworked into relationship')
 class TestRelationshipInstance(object):
-def test_relatiship_instance_model_creation(self, nodes_storage):
-relationship = mock.models.get_relationship(
-
target=nodes_storage.node.get_by_name(mock.models.DEPENDENCY_NODE_NAME)
-)
-nodes_storage.relationship.put(relationship)
-node_instances = nodes_storage.node
-source_node_instance = 
node_instances.get_by_name(mock.models.DEPENDENT_NODE_INSTANCE_NAME)
-target_node_instance = 
node_instances.get_by_name(mock.models.DEPENDENCY_NODE_INSTANCE_NAME)
-
-relationship_instance = _test_model(
-is_valid=True,
-storage=nodes_storage,
-model_cls=Relationship,
-model_kwargs=dict(
-relationship=relationship,
-source_node_instance=source_node_instance,
-target_node_instance=target_node_instance
-))
-assert relationship_instance.relationship == relationship
-assert relationship_instance.source_node_instance == 
source_node_instance
-assert relationship_instance.target_node_instance == 
target_node_instance
+@pytest.mark.parametrize(
+'is_valid, source_requirement_index, target_node_id, 
target_capability_name, type_name, '
+

[jira] [Commented] (ARIA-116) Missing type_hierarchy in relationship

2017-03-05 Thread ASF subversion and git services (JIRA)

[ 
https://issues.apache.org/jira/browse/ARIA-116?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15896385#comment-15896385
 ] 

ASF subversion and git services commented on ARIA-116:
--

Commit e6ea0c0bec1a9c31dc4fe2648c5e83bcd9131ae9 in incubator-ariatosca's branch 
refs/heads/ARIA-116-Missing-type_hierarchy-in-relationship from [~Mxmrlv]
[ https://git-wip-us.apache.org/repos/asf?p=incubator-ariatosca.git;h=e6ea0c0 ]

ARIA-116-Missing-type_hierarchy-in-relationship


> Missing type_hierarchy in relationship
> --
>
> Key: ARIA-116
> URL: https://issues.apache.org/jira/browse/ARIA-116
> Project: AriaTosca
>  Issue Type: Bug
>Affects Versions: 0.1.0
>Reporter: Maxim Orlov
>Assignee: Maxim Orlov
>
> The model of Relationship is missing type_hierarchy. It should be reinstated.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[incubator-ariatosca] Git Push Summary

2017-03-05 Thread mxmrlv
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-116-Missing-type_hierarchy-in-relationship [created] dc18c1d3c


[jira] [Created] (ARIA-116) Missing type_hierarchy in relationship

2017-03-05 Thread Maxim Orlov (JIRA)
Maxim Orlov created ARIA-116:


 Summary: Missing type_hierarchy in relationship
 Key: ARIA-116
 URL: https://issues.apache.org/jira/browse/ARIA-116
 Project: AriaTosca
  Issue Type: Bug
Affects Versions: 0.1.0
Reporter: Maxim Orlov
Assignee: Maxim Orlov


The model of Relationship is missing type_hierarchy. It should be reinstated.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Assigned] (ARIA-96) Dependency versions strictness / conflicts

2017-03-05 Thread Ran Ziv (JIRA)

 [ 
https://issues.apache.org/jira/browse/ARIA-96?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Ran Ziv reassigned ARIA-96:
---

Assignee: Avia Efrat

> Dependency versions strictness / conflicts
> --
>
> Key: ARIA-96
> URL: https://issues.apache.org/jira/browse/ARIA-96
> Project: AriaTosca
>  Issue Type: Task
>Reporter: Ran Ziv
>Assignee: Avia Efrat
>
> When ARIA is used by another project, it might lead to dependency versions 
> conflicts.
> Dependency versions should be made less strict (i.e. ranges).
> Alternatively we could consider vendoring some of the more common 
> dependencies inside ARIA.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Created] (ARIA-115) Log model should have an Execution field

2017-03-05 Thread Ran Ziv (JIRA)
Ran Ziv created ARIA-115:


 Summary: Log model should have an Execution field
 Key: ARIA-115
 URL: https://issues.apache.org/jira/browse/ARIA-115
 Project: AriaTosca
  Issue Type: Task
Reporter: Ran Ziv
Assignee: Maxim Orlov


The Log model currently doesn't relate to a specific execution.
The field should be added to the model.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[GitHub] incubator-ariatosca pull request #72: Aria 105 integrate modeling

2017-03-05 Thread mxmrlv
Github user mxmrlv commented on a diff in the pull request:

https://github.com/apache/incubator-ariatosca/pull/72#discussion_r104312850
  
--- Diff: aria/modeling/bases.py ---
@@ -0,0 +1,405 @@
+# 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.
+
+"""
+ARIA's storage.structures module
+Path: aria.storage.structures
+
+models module holds ARIA's models.
+
+classes:
+* ModelMixin - abstract model implementation.
+* ModelIDMixin - abstract model implementation with IDs.
+"""
+
+from sqlalchemy.orm import relationship, backref
+from sqlalchemy.orm.collections import attribute_mapped_collection
+from sqlalchemy.ext import associationproxy
+from sqlalchemy import (
+Column,
+ForeignKey,
+Integer,
+Text,
+Table,
+)
+
+from . import utils
+from ..utils import formatting
+
+
+class ModelMixin(object):
+
+@utils.classproperty
+def __modelname__(cls):
 # pylint: disable=no-self-argument
+return getattr(cls, '__mapiname__', cls.__tablename__)
+
+@classmethod
+def id_column_name(cls):
+raise NotImplementedError
+
+@classmethod
+def name_column_name(cls):
+raise NotImplementedError
+
+@classmethod
+def foreign_key(cls, parent_table, nullable=False):
+"""
+Return a ForeignKey object.
+
+:param parent_table: Parent table name
+:param nullable: Should the column be allowed to remain empty
+"""
+return Column(Integer,
+  ForeignKey('{table}.id'.format(table=parent_table),
+ ondelete='CASCADE'),
+  nullable=nullable)
+
+@classmethod
+def relationship_to_self(cls,
+ column_name,
+ relationship_kwargs=None):
+relationship_kwargs = relationship_kwargs or {}
+
+remote_side = '{cls}.{remote_column}'.format(
+cls=cls.__name__,
+remote_column=cls.id_column_name()
+)
+
+primaryjoin = '{remote_side} == {cls}.{column}'.format(
+remote_side=remote_side,
+cls=cls.__name__,
+column=column_name
+)
+
+return relationship(
+cls._get_cls_by_tablename(cls.__tablename__).__name__,
+primaryjoin=primaryjoin,
+remote_side=remote_side,
+post_update=True,
+**relationship_kwargs
+)
+
+@classmethod
+def one_to_many_relationship_to_self(cls,
+ key,
+ dict_key=None,
+ relationship_kwargs=None):
+relationship_kwargs = relationship_kwargs or {}
--- End diff --

It has become somewhat problematic to figure out how the x_to_many 
relationships work, since there must be a foreign key on the "many" side. This 
is exactly the issue we talked about. it seems that using the `backref` could 
actually fix this. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-ariatosca pull request #72: Aria 105 integrate modeling

2017-03-05 Thread mxmrlv
Github user mxmrlv commented on a diff in the pull request:

https://github.com/apache/incubator-ariatosca/pull/72#discussion_r104309404
  
--- Diff: aria/modeling/misc.py ---
@@ -0,0 +1,232 @@
+# 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.
+
+import cPickle as pickle
+import logging
+
+from sqlalchemy import (
+Column,
+Text,
+Binary
+)
+from sqlalchemy.ext.declarative import declared_attr
+
+from ..storage import exceptions
+from ..utils import collections, formatting, console
+from .bases import InstanceModelMixin, TemplateModelMixin
+from . import utils
+
+
+class ParameterBase(TemplateModelMixin):
+"""
+Represents a typed value.
+
+This class is used by both service template and service instance 
elements.
+
+:ivar name: Name
+:ivar type_name: Type name
+:ivar value: Value
+:ivar description: Description
+"""
+
+__tablename__ = 'parameter'
+
+name = Column(Text)
+type_name = Column(Text)
+
+# Check: value type
+_value = Column(Binary, name='value')
+description = Column(Text)
+
+@property
+def as_raw(self):
+return collections.OrderedDict((
+('name', self.name),
+('type_name', self.type_name),
+('value', self.value),
+('description', self.description)))
+
+@property
+def value(self):
+if self._value is None:
+return None
+try:
+return pickle.loads(self._value)
+except BaseException:
+raise exceptions.StorageError('bad format for parameter of 
type "{0}": {1}'.format(
+self.type_name, self._value))
+
+@value.setter
+def value(self, value):
+if value is None:
+self._value = None
+else:
+try:
+self._value = pickle.dumps(value)
+except (pickle.PicklingError, TypeError):
+logging.getLogger('aria').warn('Could not pickle parameter 
of type "{0}": {1}'
+   .format(self.type_name, 
value))
+self._value = pickle.dumps(str(value))
+ 
+def instantiate(self, context, container):
+from . import models
+return models.Parameter(name=self.name,
+type_name=self.type_name,
+_value=self._value,
+description=self.description)
+
+def coerce_values(self, context, container, report_issues):
+if self.value is not None:
+self.value = utils.coerce_value(context, container, self.value,
+report_issues)
+
+def dump(self, context):
+if self.type_name is not None:
+console.puts('{0}: {1} ({2})'.format(
+context.style.property(self.name),
+context.style.literal(self.value),
+context.style.type(self.type_name)))
+else:
+console.puts('{0}: {1}'.format(
+context.style.property(self.name),
+context.style.literal(self.value)))
+if self.description:
+console.puts(context.style.meta(self.description))
+
+
+class TypeBase(InstanceModelMixin):
+"""
+Represents a type and its children.
+"""
+
+__tablename__ = 'type'
+
+variant = Column(Text, nullable=False) 
+description = Column(Text)
+_role = Column(Text, name='role')
+
+@declared_attr
+def parent(cls):
+return cls.relationship_to_self('parent_type_fk')
+
+@declared_attr
+def children(cls):
+return cls.one_to_many_relationship_to_self('parent_type_fk')
+
+# region foreign keys
+
+

[GitHub] incubator-ariatosca pull request #72: Aria 105 integrate modeling

2017-03-05 Thread mxmrlv
Github user mxmrlv commented on a diff in the pull request:

https://github.com/apache/incubator-ariatosca/pull/72#discussion_r104312798
  
--- Diff: aria/modeling/__init__.py ---
@@ -16,20 +16,27 @@
 from collections import namedtuple
--- End diff --

The naming convention is inconsistent throughout the package. some are 
plural, while others are singular (IMO singular is better). Furthermore, it's 
kinda rough to figure out which module does what (without looking in the code).



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-ariatosca pull request #72: Aria 105 integrate modeling

2017-03-05 Thread mxmrlv
Github user mxmrlv commented on a diff in the pull request:

https://github.com/apache/incubator-ariatosca/pull/72#discussion_r104309365
  
--- Diff: aria/modeling/misc.py ---
@@ -0,0 +1,232 @@
+# 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.
+
+import cPickle as pickle
+import logging
+
+from sqlalchemy import (
+Column,
+Text,
+Binary
+)
+from sqlalchemy.ext.declarative import declared_attr
+
+from ..storage import exceptions
+from ..utils import collections, formatting, console
+from .bases import InstanceModelMixin, TemplateModelMixin
+from . import utils
+
+
+class ParameterBase(TemplateModelMixin):
+"""
+Represents a typed value.
+
+This class is used by both service template and service instance 
elements.
+
+:ivar name: Name
+:ivar type_name: Type name
+:ivar value: Value
+:ivar description: Description
+"""
+
+__tablename__ = 'parameter'
+
+name = Column(Text)
+type_name = Column(Text)
+
+# Check: value type
+_value = Column(Binary, name='value')
+description = Column(Text)
+
+@property
+def as_raw(self):
+return collections.OrderedDict((
+('name', self.name),
+('type_name', self.type_name),
+('value', self.value),
+('description', self.description)))
+
+@property
+def value(self):
+if self._value is None:
+return None
+try:
+return pickle.loads(self._value)
+except BaseException:
+raise exceptions.StorageError('bad format for parameter of 
type "{0}": {1}'.format(
+self.type_name, self._value))
+
+@value.setter
+def value(self, value):
+if value is None:
+self._value = None
+else:
+try:
+self._value = pickle.dumps(value)
+except (pickle.PicklingError, TypeError):
+logging.getLogger('aria').warn('Could not pickle parameter 
of type "{0}": {1}'
+   .format(self.type_name, 
value))
+self._value = pickle.dumps(str(value))
+ 
+def instantiate(self, context, container):
+from . import models
+return models.Parameter(name=self.name,
+type_name=self.type_name,
+_value=self._value,
+description=self.description)
+
+def coerce_values(self, context, container, report_issues):
+if self.value is not None:
+self.value = utils.coerce_value(context, container, self.value,
+report_issues)
+
+def dump(self, context):
+if self.type_name is not None:
+console.puts('{0}: {1} ({2})'.format(
+context.style.property(self.name),
+context.style.literal(self.value),
+context.style.type(self.type_name)))
+else:
+console.puts('{0}: {1}'.format(
+context.style.property(self.name),
+context.style.literal(self.value)))
+if self.description:
+console.puts(context.style.meta(self.description))
+
+
+class TypeBase(InstanceModelMixin):
+"""
+Represents a type and its children.
+"""
+
+__tablename__ = 'type'
+
+variant = Column(Text, nullable=False) 
+description = Column(Text)
+_role = Column(Text, name='role')
+
+@declared_attr
+def parent(cls):
+return cls.relationship_to_self('parent_type_fk')
+
+@declared_attr
+def children(cls):
+return cls.one_to_many_relationship_to_self('parent_type_fk')
+
+# region foreign keys
+
+

[GitHub] incubator-ariatosca pull request #72: Aria 105 integrate modeling

2017-03-05 Thread mxmrlv
Github user mxmrlv commented on a diff in the pull request:

https://github.com/apache/incubator-ariatosca/pull/72#discussion_r104313005
  
--- Diff: aria/modeling/service.py ---
@@ -0,0 +1,1451 @@
+# 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.
+
+# pylint: disable=no-self-argument, no-member, abstract-method
+
+from sqlalchemy import (
+Column,
+Text,
+Integer
+)
+from sqlalchemy import DateTime
+from sqlalchemy.ext.associationproxy import association_proxy
+from sqlalchemy.ext.declarative import declared_attr
+
+from .bases import InstanceModelMixin
+from ..parser import validation
+from ..utils import collections, formatting, console
+
+from . import (
+utils,
+types as modeling_types
+)
+
+
+class ServiceBase(InstanceModelMixin): # pylint: 
disable=too-many-public-methods
+"""
+A service is usually an instance of a :class:`ServiceTemplate`.
+
+You will usually not create it programmatically, but instead 
instantiate it from a service
+template.
+
+:ivar name: Name (unique for this ARIA installation)
+:vartype name: basestring
+:ivar service_template: Template from which this service was 
instantiated (optional)
+:vartype service_template: :class:`ServiceTemplate`
+:ivar description: Human-readable description
+:vartype description: string
+:ivar meta_data: Custom annotations
+:vartype meta_data: {basestring: :class:`Metadata`}
+:ivar node: Nodes
+:vartype node: [:class:`Node`]
+:ivar groups: Groups of nodes
+:vartype groups: [:class:`Group`]
+:ivar policies: Policies
+:vartype policies: [:class:`Policy`]
+:ivar substitution: The entire service can appear as a node
+:vartype substitution: :class:`Substitution`
+:ivar inputs: Externally provided parameters
+:vartype inputs: {basestring: :class:`Parameter`}
+:ivar outputs: These parameters are filled in after service 
installation
+:vartype outputs: {basestring: :class:`Parameter`}
+:ivar operations: Custom operations that can be performed on the 
service
+:vartype operations: {basestring: :class:`Operation`}
+:ivar plugins: Plugins required to be installed
+:vartype plugins: {basestring: :class:`Plugin`}
+:ivar created_at: Creation timestamp
+:vartype created_at: :class:`datetime.datetime`
+:ivar updated_at: Update timestamp
+:vartype updated_at: :class:`datetime.datetime`
+"""
+
+__tablename__ = 'service'
+
+@declared_attr
+def service_template(cls):
+return cls.many_to_one_relationship('service_template')
+
+description = Column(Text)
+
+@declared_attr
+def meta_data(cls):
+# Warning! We cannot use the attr name "metadata" because it's 
used by SqlAlchemy!
+return cls.many_to_many_relationship('metadata', dict_key='name')
+
+@declared_attr
+def nodes(cls):
+return cls.one_to_many_relationship('node')
+
+@declared_attr
+def groups(cls):
+return cls.one_to_many_relationship('group')
+
+@declared_attr
+def policies(cls):
+return cls.one_to_many_relationship('policy')
+
+@declared_attr
+def substitution(cls):
+return cls.one_to_one_relationship('substitution')
+
+@declared_attr
+def inputs(cls):
+return cls.many_to_many_relationship('parameter', 
table_prefix='inputs',
+ dict_key='name')
+
+@declared_attr
+def outputs(cls):
+return cls.many_to_many_relationship('parameter', 
table_prefix='outputs',
+ dict_key='name')
+
+@declared_attr
+def operations(cls):
+return cls.one_to_many_relationship('operation', dict_key='name')
+
+@declared_attr
+def 

[GitHub] incubator-ariatosca pull request #72: Aria 105 integrate modeling

2017-03-05 Thread mxmrlv
Github user mxmrlv commented on a diff in the pull request:

https://github.com/apache/incubator-ariatosca/pull/72#discussion_r104313124
  
--- Diff: aria/modeling/bases.py ---
@@ -0,0 +1,405 @@
+# 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.
+
+"""
+ARIA's storage.structures module
+Path: aria.storage.structures
+
+models module holds ARIA's models.
+
+classes:
+* ModelMixin - abstract model implementation.
+* ModelIDMixin - abstract model implementation with IDs.
+"""
+
+from sqlalchemy.orm import relationship, backref
+from sqlalchemy.orm.collections import attribute_mapped_collection
+from sqlalchemy.ext import associationproxy
+from sqlalchemy import (
+Column,
+ForeignKey,
+Integer,
+Text,
+Table,
+)
+
+from . import utils
+from ..utils import formatting
+
+
+class ModelMixin(object):
+
+@utils.classproperty
+def __modelname__(cls):
 # pylint: disable=no-self-argument
+return getattr(cls, '__mapiname__', cls.__tablename__)
+
+@classmethod
+def id_column_name(cls):
+raise NotImplementedError
+
+@classmethod
+def name_column_name(cls):
+raise NotImplementedError
+
+@classmethod
+def foreign_key(cls, parent_table, nullable=False):
+"""
+Return a ForeignKey object.
+
+:param parent_table: Parent table name
+:param nullable: Should the column be allowed to remain empty
+"""
+return Column(Integer,
+  ForeignKey('{table}.id'.format(table=parent_table),
+ ondelete='CASCADE'),
+  nullable=nullable)
+
+@classmethod
+def relationship_to_self(cls,
+ column_name,
+ relationship_kwargs=None):
+relationship_kwargs = relationship_kwargs or {}
+
+remote_side = '{cls}.{remote_column}'.format(
+cls=cls.__name__,
+remote_column=cls.id_column_name()
+)
+
+primaryjoin = '{remote_side} == {cls}.{column}'.format(
+remote_side=remote_side,
+cls=cls.__name__,
+column=column_name
+)
+
+return relationship(
+cls._get_cls_by_tablename(cls.__tablename__).__name__,
+primaryjoin=primaryjoin,
+remote_side=remote_side,
+post_update=True,
+**relationship_kwargs
+)
+
+@classmethod
+def one_to_many_relationship_to_self(cls,
--- End diff --

This one is only used in the type hierarchy structure. Maybe it'd be better 
not to expose this method (just implement that logic only in `TypeBase`).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-ariatosca pull request #72: Aria 105 integrate modeling

2017-03-05 Thread mxmrlv
Github user mxmrlv commented on a diff in the pull request:

https://github.com/apache/incubator-ariatosca/pull/72#discussion_r104312966
  
--- Diff: aria/modeling/orchestration.py ---
@@ -451,12 +451,45 @@ def actor(self):
 """
 return self.node or self.relationship
 
+@orm.validates('max_attempts')
+def validate_max_attempts(self, _, value): 
 # pylint: disable=no-self-use
+"""Validates that max attempts is either -1 or a positive number"""
+if value < 1 and value != TaskBase.INFINITE_RETRIES:
+raise ValueError('Max attempts can be either -1 (infinite) or 
any positive number. '
+ 'Got {value}'.format(value=value))
+return value
+
+# region foreign keys
+
+__private_fields__ = ['node_fk',
+  'relationship_fk',
+  'plugin_fk',
+  'execution_fk']
+
+@declared_attr
+def node_fk(cls):
+return cls.foreign_key('node', nullable=True)
+
+@declared_attr
+def relationship_fk(cls):
+return cls.foreign_key('relationship', nullable=True)
+
+@declared_attr
+def plugin_fk(cls):
+return cls.foreign_key('plugin', nullable=True)
+
+@declared_attr
+def execution_fk(cls):
+return cls.foreign_key('execution', nullable=True)
+
+# endregion
+
 @classmethod
-def as_node_instance(cls, instance, runs_on, **kwargs):
+def as_node_task(cls, instance, runs_on, **kwargs):
 return cls(node=instance, _runs_on=runs_on, **kwargs)
 
 @classmethod
-def as_relationship_instance(cls, instance, runs_on, **kwargs):
+def as_relationship_task(cls, instance, runs_on, **kwargs):
--- End diff --

ditto


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-ariatosca pull request #72: Aria 105 integrate modeling

2017-03-05 Thread mxmrlv
Github user mxmrlv commented on a diff in the pull request:

https://github.com/apache/incubator-ariatosca/pull/72#discussion_r104313185
  
--- Diff: aria/modeling/service_template.py ---
@@ -0,0 +1,1617 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
--- End diff --

I think it could be nice if `name` would be the default key for dicts.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-ariatosca pull request #72: Aria 105 integrate modeling

2017-03-05 Thread mxmrlv
Github user mxmrlv commented on a diff in the pull request:

https://github.com/apache/incubator-ariatosca/pull/72#discussion_r104312962
  
--- Diff: aria/modeling/orchestration.py ---
@@ -451,12 +451,45 @@ def actor(self):
 """
 return self.node or self.relationship
 
+@orm.validates('max_attempts')
+def validate_max_attempts(self, _, value): 
 # pylint: disable=no-self-use
+"""Validates that max attempts is either -1 or a positive number"""
+if value < 1 and value != TaskBase.INFINITE_RETRIES:
+raise ValueError('Max attempts can be either -1 (infinite) or 
any positive number. '
+ 'Got {value}'.format(value=value))
+return value
+
+# region foreign keys
+
+__private_fields__ = ['node_fk',
+  'relationship_fk',
+  'plugin_fk',
+  'execution_fk']
+
+@declared_attr
+def node_fk(cls):
+return cls.foreign_key('node', nullable=True)
+
+@declared_attr
+def relationship_fk(cls):
+return cls.foreign_key('relationship', nullable=True)
+
+@declared_attr
+def plugin_fk(cls):
+return cls.foreign_key('plugin', nullable=True)
+
+@declared_attr
+def execution_fk(cls):
+return cls.foreign_key('execution', nullable=True)
+
+# endregion
+
 @classmethod
-def as_node_instance(cls, instance, runs_on, **kwargs):
+def as_node_task(cls, instance, runs_on, **kwargs):
--- End diff --

so the current api looks some thing like `Task.as_node_task(...)` instead 
of `Task.as_node(...)`?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-ariatosca pull request #72: Aria 105 integrate modeling

2017-03-05 Thread mxmrlv
Github user mxmrlv commented on a diff in the pull request:

https://github.com/apache/incubator-ariatosca/pull/72#discussion_r104313485
  
--- Diff: aria/orchestrator/workflows/api/task.py ---
@@ -69,21 +70,38 @@ def __init__(self,
  ignore_failure=None,
  inputs=None,
  plugin=None,
- runs_on=None):
+ runs_on=None,
+ dry=False):
 """
 Creates an operation task using the name, details, node instance 
and any additional kwargs.
-:param name: the operation of the name.
+
+:param name: the name of the operation.
 :param actor: the operation host on which this operation is 
registered.
 :param inputs: operation inputs.
 """
-assert isinstance(actor, (model.Node,
-  model.Relationship))
+
+assert isinstance(actor, (models.Node, models.Relationship))
 super(OperationTask, self).__init__()
+
+if dry:
--- End diff --

why should the task know about whether it's being dry-ran or not?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-ariatosca pull request #72: Aria 105 integrate modeling

2017-03-05 Thread mxmrlv
Github user mxmrlv commented on a diff in the pull request:

https://github.com/apache/incubator-ariatosca/pull/72#discussion_r104313280
  
--- Diff: aria/modeling/types.py ---
@@ -23,7 +23,7 @@
 )
 from sqlalchemy.ext import mutable
 
-from .. import exceptions
+from ..storage import exceptions
--- End diff --

I think we should create new exceptions - modelling exceptions. from within 
the same package it think it's better if we trow package specific exceptions.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


Re: [CONF] Ariatosca > Podling Report 2017-03

2017-03-05 Thread Suneel Marthi
Thanks John, will fix that.

On Sun, Mar 5, 2017 at 9:09 AM, John D. Ament 
wrote:

> Suneel,
>
> This area is a 1 X, not a multi-select.  We typically see that community
> building begins after the first release - you have software that users can
> leverage, questions come through.  IMHO, this is not in community building.
>
> John
>
> On Sun, Mar 5, 2017 at 9:01 AM Suneel Marthi (Confluence) <
> conflue...@apache.org> wrote:
>
>> [image: avatar_e1ac74408df1fba1b108a97c76b1836f.png]
>> 
>>  Suneel
>> Marthi *edited* a page
>>
>> [image: page-icon.png]
>> 
>>  Podling
>> Report 2017-03
>> 
>>
>> ...
>>
>> [ ] Initial setup
>> [X] Working towards first release
>> [X] Community building
>> [ ] Nearing graduation
>> [ ] Other:
>>
>> ...
>> [image:
>> com.atlassian.confluence.plugins.confluence-email-resources:view-page-email-adg-footer-item:icon.png]
>> 
>>  View
>> page
>> 
>> •
>> [image:
>> com.atlassian.confluence.plugins.confluence-email-resources:add-comment-to-content-email-adg-footer-item:icon.png]
>> 
>>  Add
>> comment
>> 
>> •
>> [image:
>> com.atlassian.confluence.plugins.confluence-like:view-email-adg-content-item:icon.png]
>> 
>> Like
>> 
>>
>> Stop watching page
>> 
>> •
>> Manage notifications
>> 
>> [image: footer-desktop-logo.png]
>> This message was sent by Atlassian Confluence 5.8.4
>> [image: footer-mobile-logo.png]
>>
>


[GitHub] incubator-ariatosca pull request #72: Aria 105 integrate modeling

2017-03-05 Thread ran-z
Github user ran-z commented on a diff in the pull request:

https://github.com/apache/incubator-ariatosca/pull/72#discussion_r104309335
  
--- Diff: aria/orchestrator/workflows/builtin/utils.py ---
@@ -14,33 +14,41 @@
 # limitations under the License.
 
 from ..api.task import OperationTask
+from .. import exceptions
 
 
-def create_node_task(operation_name, node):
+def create_node_task(interface_name, operation_name, node, dry=False):
--- End diff --

why is the dry param here now as well?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-ariatosca pull request #72: Aria 105 integrate modeling

2017-03-05 Thread ran-z
Github user ran-z commented on a diff in the pull request:

https://github.com/apache/incubator-ariatosca/pull/72#discussion_r104309303
  
--- Diff: aria/orchestrator/workflows/api/task.py ---
@@ -69,21 +70,38 @@ def __init__(self,
  ignore_failure=None,
  inputs=None,
  plugin=None,
- runs_on=None):
+ runs_on=None,
+ dry=False):
 """
 Creates an operation task using the name, details, node instance 
and any additional kwargs.
-:param name: the operation of the name.
+
+:param name: the name of the operation.
 :param actor: the operation host on which this operation is 
registered.
 :param inputs: operation inputs.
 """
-assert isinstance(actor, (model.Node,
-  model.Relationship))
+
+assert isinstance(actor, (models.Node, models.Relationship))
 super(OperationTask, self).__init__()
+
+if dry:
--- End diff --

why keep this at all?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-ariatosca pull request #72: Aria 105 integrate modeling

2017-03-05 Thread ran-z
Github user ran-z commented on a diff in the pull request:

https://github.com/apache/incubator-ariatosca/pull/72#discussion_r104308959
  
--- Diff: aria/cli/args_parser.py ---
@@ -137,10 +137,6 @@ def add_workflow_parser(workflow):
 '-w', '--workflow',
 default='install',
 help='The workflow name')
-workflow.add_argument(
--- End diff --

putting aside the fact this code is going to be thrown out anyway,
how would a workflow execution not require a service instance to run on?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---