[incubator-ariatosca] Git Push Summary

2017-03-28 Thread avia
Repository: incubator-ariatosca
Updated Branches:
  
refs/heads/ARIA-133-Add-status-related-methods-to-Execution-Task-and-Node-models
 [deleted] 941d85c0e


[jira] [Closed] (ARIA-133) Add status-related properties to Execution, Task and Node models

2017-03-28 Thread Avia Efrat (JIRA)

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

Avia Efrat closed ARIA-133.
---

> Add status-related properties to Execution, Task and Node models
> 
>
> Key: ARIA-133
> URL: https://issues.apache.org/jira/browse/ARIA-133
> Project: AriaTosca
>  Issue Type: Task
>Reporter: Avia Efrat
>Assignee: Avia Efrat
>Priority: Minor
> Fix For: 0.1.0
>
>
> We are adding those properties so it will be easier to filter these models 
> from storage according to their status, and to not make use of the their 
> `status` constants outside of the models themselves.



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


[jira] [Commented] (ARIA-133) Add status-related properties to Execution, Task and Node models

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

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

ASF GitHub Bot commented on ARIA-133:
-

Github user asfgit closed the pull request at:

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


> Add status-related properties to Execution, Task and Node models
> 
>
> Key: ARIA-133
> URL: https://issues.apache.org/jira/browse/ARIA-133
> Project: AriaTosca
>  Issue Type: Task
>Reporter: Avia Efrat
>Assignee: Avia Efrat
>Priority: Minor
>
> We are adding those properties so it will be easier to filter these models 
> from storage according to their status, and to not make use of the their 
> `status` constants outside of the models themselves.



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


[jira] [Commented] (ARIA-133) Add status-related properties to Execution, Task and Node models

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

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

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

Commit 941d85c0ed622b6b233f38f853145c6a55120dec in incubator-ariatosca's branch 
refs/heads/master from [~avia]
[ https://git-wip-us.apache.org/repos/asf?p=incubator-ariatosca.git;h=941d85c ]

ARIA-133 Add status-related properties to the Execution, Task and Node models

We are adding these properties so it will be easier to filter those models
from storage according to their status, and to not make use of the their
`status` constants outside of the models themselves.

It should be noted, since we currently have the concept of `StubTasks`
(that are not part of the model), we had to implement the same logic for
them, although they don't direct access to the state constants of the
task model. We did this since they are treated as 'regular' model tasks
in some parts of the code.


> Add status-related properties to Execution, Task and Node models
> 
>
> Key: ARIA-133
> URL: https://issues.apache.org/jira/browse/ARIA-133
> Project: AriaTosca
>  Issue Type: Task
>Reporter: Avia Efrat
>Assignee: Avia Efrat
>Priority: Minor
>
> We are adding those properties so it will be easier to filter these models 
> from storage according to their status, and to not make use of the their 
> `status` constants outside of the models themselves.



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


incubator-ariatosca git commit: ARIA-133 Add status-related properties to the Execution, Task and Node models

2017-03-28 Thread avia
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/master 2de049729 -> 941d85c0e


ARIA-133 Add status-related properties to the Execution, Task and Node models

We are adding these properties so it will be easier to filter those models
from storage according to their status, and to not make use of the their
`status` constants outside of the models themselves.

It should be noted, since we currently have the concept of `StubTasks`
(that are not part of the model), we had to implement the same logic for
them, although they don't direct access to the state constants of the
task model. We did this since they are treated as 'regular' model tasks
in some parts of the code.


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

Branch: refs/heads/master
Commit: 941d85c0ed622b6b233f38f853145c6a55120dec
Parents: 2de0497
Author: Avia Efrat 
Authored: Tue Mar 28 12:51:42 2017 +0300
Committer: Avia Efrat 
Committed: Tue Mar 28 18:41:19 2017 +0300

--
 aria/modeling/orchestration.py | 20 
 aria/modeling/service_instance.py  |  4 
 aria/orchestrator/workflows/core/engine.py |  6 +++---
 aria/orchestrator/workflows/core/task.py   |  8 
 4 files changed, 31 insertions(+), 7 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/941d85c0/aria/modeling/orchestration.py
--
diff --git a/aria/modeling/orchestration.py b/aria/modeling/orchestration.py
index a13ae87..f0bd4b2 100644
--- a/aria/modeling/orchestration.py
+++ b/aria/modeling/orchestration.py
@@ -69,7 +69,6 @@ class ExecutionBase(ModelMixin):
 
 STATES = [TERMINATED, FAILED, CANCELLED, PENDING, STARTED, CANCELLING, 
FORCE_CANCELLING]
 END_STATES = [TERMINATED, FAILED, CANCELLED]
-ACTIVE_STATES = [state for state in STATES if state not in END_STATES]
 
 VALID_TRANSITIONS = {
 PENDING: [STARTED, CANCELLED],
@@ -102,6 +101,14 @@ class ExecutionBase(ModelMixin):
 status = Column(Enum(*STATES, name='execution_status'), default=PENDING)
 workflow_name = Column(Text)
 
+@property
+def has_ended(self):
+return self.status in self.END_STATES
+
+@property
+def is_active(self):
+return not self.has_ended
+
 @declared_attr
 def logs(cls):
 return relationship.one_to_many(cls, 'log')
@@ -240,9 +247,6 @@ class TaskBase(ModelMixin):
 FAILED,
 )
 
-WAIT_STATES = [PENDING, RETRYING]
-END_STATES = [SUCCESS, FAILED]
-
 RUNS_ON_SOURCE = 'source'
 RUNS_ON_TARGET = 'target'
 RUNS_ON_NODE = 'node'
@@ -289,6 +293,14 @@ class TaskBase(ModelMixin):
 _runs_on = Column(Enum(*RUNS_ON, name='runs_on'), name='runs_on')
 
 @property
+def has_ended(self):
+return self.status in [self.SUCCESS, self.FAILED]
+
+@property
+def is_waiting(self):
+return self.status in [self.PENDING, self.RETRYING]
+
+@property
 def runs_on(self):
 if self._runs_on == self.RUNS_ON_NODE:
 return self.node

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/941d85c0/aria/modeling/service_instance.py
--
diff --git a/aria/modeling/service_instance.py 
b/aria/modeling/service_instance.py
index e2e5ae0..e6c2b12 100644
--- a/aria/modeling/service_instance.py
+++ b/aria/modeling/service_instance.py
@@ -417,6 +417,10 @@ class NodeBase(InstanceModelMixin):
 except KeyError:
 return None
 
+@property
+def is_available(self):
+return self.state not in [self.INITIAL, self.DELETED, self.ERROR]
+
 # region foreign_keys
 
 @declared_attr

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/941d85c0/aria/orchestrator/workflows/core/engine.py
--
diff --git a/aria/orchestrator/workflows/core/engine.py 
b/aria/orchestrator/workflows/core/engine.py
index fa4550d..d32abb8 100644
--- a/aria/orchestrator/workflows/core/engine.py
+++ b/aria/orchestrator/workflows/core/engine.py
@@ -88,12 +88,12 @@ class Engine(logger.LoggerMixin):
 def _executable_tasks(self):
 now = datetime.utcnow()
 return (task for task in self._tasks_iter()
-if task.status in models.Task.WAIT_STATES and
+if task.is_waiting and
 task.due_at <= now and
 not self._task_has_dependencies(task))
 
 def _ended_tasks(self):
-

incubator-ariatosca git commit: ARIA-133 Add status-related properties to the Execution, Task and Node models [Forced Update!]

2017-03-28 Thread avia
Repository: incubator-ariatosca
Updated Branches:
  
refs/heads/ARIA-133-Add-status-related-methods-to-Execution-Task-and-Node-models
 4ae73450f -> 941d85c0e (forced update)


ARIA-133 Add status-related properties to the Execution, Task and Node models

We are adding these properties so it will be easier to filter those models
from storage according to their status, and to not make use of the their
`status` constants outside of the models themselves.

It should be noted, since we currently have the concept of `StubTasks`
(that are not part of the model), we had to implement the same logic for
them, although they don't direct access to the state constants of the
task model. We did this since they are treated as 'regular' model tasks
in some parts of the code.


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

Branch: 
refs/heads/ARIA-133-Add-status-related-methods-to-Execution-Task-and-Node-models
Commit: 941d85c0ed622b6b233f38f853145c6a55120dec
Parents: 2de0497
Author: Avia Efrat 
Authored: Tue Mar 28 12:51:42 2017 +0300
Committer: Avia Efrat 
Committed: Tue Mar 28 18:41:19 2017 +0300

--
 aria/modeling/orchestration.py | 20 
 aria/modeling/service_instance.py  |  4 
 aria/orchestrator/workflows/core/engine.py |  6 +++---
 aria/orchestrator/workflows/core/task.py   |  8 
 4 files changed, 31 insertions(+), 7 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/941d85c0/aria/modeling/orchestration.py
--
diff --git a/aria/modeling/orchestration.py b/aria/modeling/orchestration.py
index a13ae87..f0bd4b2 100644
--- a/aria/modeling/orchestration.py
+++ b/aria/modeling/orchestration.py
@@ -69,7 +69,6 @@ class ExecutionBase(ModelMixin):
 
 STATES = [TERMINATED, FAILED, CANCELLED, PENDING, STARTED, CANCELLING, 
FORCE_CANCELLING]
 END_STATES = [TERMINATED, FAILED, CANCELLED]
-ACTIVE_STATES = [state for state in STATES if state not in END_STATES]
 
 VALID_TRANSITIONS = {
 PENDING: [STARTED, CANCELLED],
@@ -102,6 +101,14 @@ class ExecutionBase(ModelMixin):
 status = Column(Enum(*STATES, name='execution_status'), default=PENDING)
 workflow_name = Column(Text)
 
+@property
+def has_ended(self):
+return self.status in self.END_STATES
+
+@property
+def is_active(self):
+return not self.has_ended
+
 @declared_attr
 def logs(cls):
 return relationship.one_to_many(cls, 'log')
@@ -240,9 +247,6 @@ class TaskBase(ModelMixin):
 FAILED,
 )
 
-WAIT_STATES = [PENDING, RETRYING]
-END_STATES = [SUCCESS, FAILED]
-
 RUNS_ON_SOURCE = 'source'
 RUNS_ON_TARGET = 'target'
 RUNS_ON_NODE = 'node'
@@ -289,6 +293,14 @@ class TaskBase(ModelMixin):
 _runs_on = Column(Enum(*RUNS_ON, name='runs_on'), name='runs_on')
 
 @property
+def has_ended(self):
+return self.status in [self.SUCCESS, self.FAILED]
+
+@property
+def is_waiting(self):
+return self.status in [self.PENDING, self.RETRYING]
+
+@property
 def runs_on(self):
 if self._runs_on == self.RUNS_ON_NODE:
 return self.node

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/941d85c0/aria/modeling/service_instance.py
--
diff --git a/aria/modeling/service_instance.py 
b/aria/modeling/service_instance.py
index e2e5ae0..e6c2b12 100644
--- a/aria/modeling/service_instance.py
+++ b/aria/modeling/service_instance.py
@@ -417,6 +417,10 @@ class NodeBase(InstanceModelMixin):
 except KeyError:
 return None
 
+@property
+def is_available(self):
+return self.state not in [self.INITIAL, self.DELETED, self.ERROR]
+
 # region foreign_keys
 
 @declared_attr

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/941d85c0/aria/orchestrator/workflows/core/engine.py
--
diff --git a/aria/orchestrator/workflows/core/engine.py 
b/aria/orchestrator/workflows/core/engine.py
index fa4550d..d32abb8 100644
--- a/aria/orchestrator/workflows/core/engine.py
+++ b/aria/orchestrator/workflows/core/engine.py
@@ -88,12 +88,12 @@ class Engine(logger.LoggerMixin):
 def _executable_tasks(self):
 now = datetime.utcnow()
 return (task for task in self._tasks_iter()
-if task.status in models.Task.WAIT_STATES and
+if 

incubator-ariatosca git commit: ARIA-133 Add status-related properties to the Execution, Task and Node models [Forced Update!]

2017-03-28 Thread avia
Repository: incubator-ariatosca
Updated Branches:
  
refs/heads/ARIA-133-Add-status-related-methods-to-Execution-Task-and-Node-models
 9cfc094d5 -> 4ae73450f (forced update)


ARIA-133 Add status-related properties to the Execution, Task and Node models

We are adding these properties so it will be easier to filter those models
from storage according to their status, and to not make use of the their
`status` constants outside of the models themselves.

It should be noted, since we currently have the concept of `StubTasks`
(that are not part of the model), we had to implement the same logic for
them, although they don't direct access to the state constants of the
task model. We did this since they are treated as 'regular' model tasks
in some parts of the code.


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

Branch: 
refs/heads/ARIA-133-Add-status-related-methods-to-Execution-Task-and-Node-models
Commit: 4ae73450fbf995dbb0b7ab8af60e0ed4981e83e2
Parents: 2de0497
Author: Avia Efrat 
Authored: Tue Mar 28 12:51:42 2017 +0300
Committer: Avia Efrat 
Committed: Tue Mar 28 17:44:08 2017 +0300

--
 aria/modeling/orchestration.py | 20 
 aria/modeling/service_instance.py  |  4 
 aria/orchestrator/workflows/core/engine.py |  6 +++---
 aria/orchestrator/workflows/core/task.py   |  9 +
 4 files changed, 32 insertions(+), 7 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/4ae73450/aria/modeling/orchestration.py
--
diff --git a/aria/modeling/orchestration.py b/aria/modeling/orchestration.py
index a13ae87..f0bd4b2 100644
--- a/aria/modeling/orchestration.py
+++ b/aria/modeling/orchestration.py
@@ -69,7 +69,6 @@ class ExecutionBase(ModelMixin):
 
 STATES = [TERMINATED, FAILED, CANCELLED, PENDING, STARTED, CANCELLING, 
FORCE_CANCELLING]
 END_STATES = [TERMINATED, FAILED, CANCELLED]
-ACTIVE_STATES = [state for state in STATES if state not in END_STATES]
 
 VALID_TRANSITIONS = {
 PENDING: [STARTED, CANCELLED],
@@ -102,6 +101,14 @@ class ExecutionBase(ModelMixin):
 status = Column(Enum(*STATES, name='execution_status'), default=PENDING)
 workflow_name = Column(Text)
 
+@property
+def has_ended(self):
+return self.status in self.END_STATES
+
+@property
+def is_active(self):
+return not self.has_ended
+
 @declared_attr
 def logs(cls):
 return relationship.one_to_many(cls, 'log')
@@ -240,9 +247,6 @@ class TaskBase(ModelMixin):
 FAILED,
 )
 
-WAIT_STATES = [PENDING, RETRYING]
-END_STATES = [SUCCESS, FAILED]
-
 RUNS_ON_SOURCE = 'source'
 RUNS_ON_TARGET = 'target'
 RUNS_ON_NODE = 'node'
@@ -289,6 +293,14 @@ class TaskBase(ModelMixin):
 _runs_on = Column(Enum(*RUNS_ON, name='runs_on'), name='runs_on')
 
 @property
+def has_ended(self):
+return self.status in [self.SUCCESS, self.FAILED]
+
+@property
+def is_waiting(self):
+return self.status in [self.PENDING, self.RETRYING]
+
+@property
 def runs_on(self):
 if self._runs_on == self.RUNS_ON_NODE:
 return self.node

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/4ae73450/aria/modeling/service_instance.py
--
diff --git a/aria/modeling/service_instance.py 
b/aria/modeling/service_instance.py
index e2e5ae0..3a5495a 100644
--- a/aria/modeling/service_instance.py
+++ b/aria/modeling/service_instance.py
@@ -417,6 +417,10 @@ class NodeBase(InstanceModelMixin):
 except KeyError:
 return None
 
+@property
+def not_deleted_or_errored(self):
+return self.state not in [self.DELETED, self.ERROR]
+
 # region foreign_keys
 
 @declared_attr

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/4ae73450/aria/orchestrator/workflows/core/engine.py
--
diff --git a/aria/orchestrator/workflows/core/engine.py 
b/aria/orchestrator/workflows/core/engine.py
index fa4550d..d32abb8 100644
--- a/aria/orchestrator/workflows/core/engine.py
+++ b/aria/orchestrator/workflows/core/engine.py
@@ -88,12 +88,12 @@ class Engine(logger.LoggerMixin):
 def _executable_tasks(self):
 now = datetime.utcnow()
 return (task for task in self._tasks_iter()
-if task.status in models.Task.WAIT_STATES and
+if 

[jira] [Commented] (ARIA-133) Add status-related properties to Execution, Task and Node models

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

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

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

Commit 4ae73450fbf995dbb0b7ab8af60e0ed4981e83e2 in incubator-ariatosca's branch 
refs/heads/ARIA-133-Add-status-related-methods-to-Execution-Task-and-Node-models
 from [~avia]
[ https://git-wip-us.apache.org/repos/asf?p=incubator-ariatosca.git;h=4ae7345 ]

ARIA-133 Add status-related properties to the Execution, Task and Node models

We are adding these properties so it will be easier to filter those models
from storage according to their status, and to not make use of the their
`status` constants outside of the models themselves.

It should be noted, since we currently have the concept of `StubTasks`
(that are not part of the model), we had to implement the same logic for
them, although they don't direct access to the state constants of the
task model. We did this since they are treated as 'regular' model tasks
in some parts of the code.


> Add status-related properties to Execution, Task and Node models
> 
>
> Key: ARIA-133
> URL: https://issues.apache.org/jira/browse/ARIA-133
> Project: AriaTosca
>  Issue Type: Task
>Reporter: Avia Efrat
>Assignee: Avia Efrat
>Priority: Minor
>
> We are adding those properties so it will be easier to filter these models 
> from storage according to their status, and to not make use of the their 
> `status` constants outside of the models themselves.



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


[jira] [Updated] (ARIA-133) Add status-related properties to Execution, Task and Node models

2017-03-28 Thread Avia Efrat (JIRA)

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

Avia Efrat updated ARIA-133:

Summary: Add status-related properties to Execution, Task and Node models  
(was: Add status-related methods to Execution, Task and Node models)

> Add status-related properties to Execution, Task and Node models
> 
>
> Key: ARIA-133
> URL: https://issues.apache.org/jira/browse/ARIA-133
> Project: AriaTosca
>  Issue Type: Task
>Reporter: Avia Efrat
>Assignee: Avia Efrat
>Priority: Minor
>
> We are adding those properties so it will be easier to filter these models 
> from storage according to their status, and to not make use of the their 
> `status` constants outside of the models themselves.



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


[incubator-ariatosca] Git Push Summary

2017-03-28 Thread avia
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-133-add-is-active-and-is-ended-to-execution-model [deleted] 
5699aba1d


[incubator-ariatosca] Git Push Summary

2017-03-28 Thread avia
Repository: incubator-ariatosca
Updated Branches:
  
refs/heads/ARIA-133-Add-status-related-methods-to-the-Execution-and-Task-models 
[deleted] ff2c4a379


[GitHub] incubator-ariatosca pull request #85: Add is_active and is_ended methods to ...

2017-03-28 Thread AviaE
Github user AviaE closed the pull request at:

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


---
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 #86: Add status-related methods to the Exec...

2017-03-28 Thread AviaE
GitHub user AviaE opened a pull request:

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

Add status-related methods to the Execution, Task and Node models

We are adding these methods so it will be easier to filter those models
from storage according to their status, and to not make use of the their
`status` constants outside of the models themselves.

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

$ git pull https://github.com/apache/incubator-ariatosca 
ARIA-133-Add-status-related-methods-to-Execution-Task-and-Node-models

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

https://github.com/apache/incubator-ariatosca/pull/86.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 #86


commit 77e35d02b64eb9483da7150631160ea80385383f
Author: Avia Efrat 
Date:   2017-03-28T09:51:42Z

Add status-related methods to the Execution, Task and Node models

We are adding these methods so it will be easier to filter those models
from storage according to their status, and to not make use of the their
`status` constants outside of the models themselves.




---
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: Add status-related methods to the Execution, Task and Node models [Forced Update!]

2017-03-28 Thread avia
Repository: incubator-ariatosca
Updated Branches:
  
refs/heads/ARIA-133-Add-status-related-methods-to-Execution-Task-and-Node-models
 02fedd928 -> 77e35d02b (forced update)


Add status-related methods to the Execution, Task and Node models

We are adding these methods so it will be easier to filter those models
from storage according to their status, and to not make use of the their
`status` constants outside of the models themselves.


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

Branch: 
refs/heads/ARIA-133-Add-status-related-methods-to-Execution-Task-and-Node-models
Commit: 77e35d02b64eb9483da7150631160ea80385383f
Parents: 2de0497
Author: Avia Efrat 
Authored: Tue Mar 28 12:51:42 2017 +0300
Committer: Avia Efrat 
Committed: Tue Mar 28 15:10:09 2017 +0300

--
 aria/modeling/orchestration.py | 16 
 aria/modeling/service_instance.py  |  3 +++
 aria/orchestrator/workflows/core/engine.py |  7 +++
 3 files changed, 18 insertions(+), 8 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/77e35d02/aria/modeling/orchestration.py
--
diff --git a/aria/modeling/orchestration.py b/aria/modeling/orchestration.py
index a13ae87..b35b293 100644
--- a/aria/modeling/orchestration.py
+++ b/aria/modeling/orchestration.py
@@ -69,7 +69,6 @@ class ExecutionBase(ModelMixin):
 
 STATES = [TERMINATED, FAILED, CANCELLED, PENDING, STARTED, CANCELLING, 
FORCE_CANCELLING]
 END_STATES = [TERMINATED, FAILED, CANCELLED]
-ACTIVE_STATES = [state for state in STATES if state not in END_STATES]
 
 VALID_TRANSITIONS = {
 PENDING: [STARTED, CANCELLED],
@@ -102,6 +101,12 @@ class ExecutionBase(ModelMixin):
 status = Column(Enum(*STATES, name='execution_status'), default=PENDING)
 workflow_name = Column(Text)
 
+def has_ended(self):
+return self.status in self.END_STATES
+
+def is_active(self):
+return not self.has_ended()
+
 @declared_attr
 def logs(cls):
 return relationship.one_to_many(cls, 'log')
@@ -240,9 +245,6 @@ class TaskBase(ModelMixin):
 FAILED,
 )
 
-WAIT_STATES = [PENDING, RETRYING]
-END_STATES = [SUCCESS, FAILED]
-
 RUNS_ON_SOURCE = 'source'
 RUNS_ON_TARGET = 'target'
 RUNS_ON_NODE = 'node'
@@ -288,6 +290,12 @@ class TaskBase(ModelMixin):
 implementation = Column(String)
 _runs_on = Column(Enum(*RUNS_ON, name='runs_on'), name='runs_on')
 
+def has_ended(self):
+return self.status in [self.SUCCESS, self.FAILED]
+
+def is_waiting(self):
+return not self.has_ended()
+
 @property
 def runs_on(self):
 if self._runs_on == self.RUNS_ON_NODE:

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/77e35d02/aria/modeling/service_instance.py
--
diff --git a/aria/modeling/service_instance.py 
b/aria/modeling/service_instance.py
index e2e5ae0..8848210 100644
--- a/aria/modeling/service_instance.py
+++ b/aria/modeling/service_instance.py
@@ -417,6 +417,9 @@ class NodeBase(InstanceModelMixin):
 except KeyError:
 return None
 
+def not_deleted_or_errored(self):
+return self.state not in [self.DELETED, self.ERROR]
+
 # region foreign_keys
 
 @declared_attr

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/77e35d02/aria/orchestrator/workflows/core/engine.py
--
diff --git a/aria/orchestrator/workflows/core/engine.py 
b/aria/orchestrator/workflows/core/engine.py
index fa4550d..3228934 100644
--- a/aria/orchestrator/workflows/core/engine.py
+++ b/aria/orchestrator/workflows/core/engine.py
@@ -88,12 +88,11 @@ class Engine(logger.LoggerMixin):
 def _executable_tasks(self):
 now = datetime.utcnow()
 return (task for task in self._tasks_iter()
-if task.status in models.Task.WAIT_STATES and
-task.due_at <= now and
+if task.is_waiting() and task.due_at <= now and
 not self._task_has_dependencies(task))
 
 def _ended_tasks(self):
-return (task for task in self._tasks_iter() if task.status in 
models.Task.END_STATES)
+return (task for task in self._tasks_iter() if task.has_ended)
 
 def _task_has_dependencies(self, task):
 return len(self._execution_graph.pred.get(task.id, {})) > 0
@@ -105,7 +104,7 @@ class 

[jira] [Commented] (ARIA-132) Models cascading deletion raises constraint errors

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

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

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

Commit 2de049729f5d0fff50297d25a88f5eecdcf266f9 in incubator-ariatosca's branch 
refs/heads/ARIA-133-Add-status-related-methods-to-Execution-Task-and-Node-models
 from [~Mxmrlv]
[ https://git-wip-us.apache.org/repos/asf?p=incubator-ariatosca.git;h=2de0497 ]

ARIA-132-Models-cascading-deletion-raises-constraint-errors

Additional fixes:
- The relationships are now defined on both sides. we no longer use backref, 
but back_populates.


> Models cascading deletion raises constraint errors
> --
>
> Key: ARIA-132
> URL: https://issues.apache.org/jira/browse/ARIA-132
> Project: AriaTosca
>  Issue Type: Bug
>Reporter: Ran Ziv
>Assignee: Maxim Orlov
>Priority: Critical
> Fix For: 0.1.0
>
>
> Models whose deletion should cascade to additional models currently don't 
> behave this way and instead raise constraint errors



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


[1/3] incubator-ariatosca git commit: ARIA-132-Models-cascading-deletion-raises-constraint-errors [Forced Update!]

2017-03-28 Thread avia
Repository: incubator-ariatosca
Updated Branches:
  
refs/heads/ARIA-133-Add-status-related-methods-to-Execution-Task-and-Node-models
 a08f6d657 -> 02fedd928 (forced update)


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/2de04972/aria/modeling/service_template.py
--
diff --git a/aria/modeling/service_template.py 
b/aria/modeling/service_template.py
index 8b619bf..8355521 100644
--- a/aria/modeling/service_template.py
+++ b/aria/modeling/service_template.py
@@ -41,7 +41,7 @@ from . import (
 )
 
 
-class ServiceTemplateBase(TemplateModelMixin): # pylint: 
disable=too-many-public-methods
+class ServiceTemplateBase(TemplateModelMixin):
 """
 A service template is a source for creating :class:`Service` instances.
 
@@ -90,7 +90,6 @@ class ServiceTemplateBase(TemplateModelMixin): # pylint: 
disable=too-many-public
 :vartype created_at: :class:`datetime.datetime`
 :ivar updated_at: Update timestamp
 :vartype updated_at: :class:`datetime.datetime`
-
 :ivar services: Instantiated services
 :vartype services: [:class:`Service`]
 """
@@ -108,121 +107,151 @@ class ServiceTemplateBase(TemplateModelMixin): # 
pylint: disable=too-many-public
 
 description = Column(Text)
 main_file_name = Column(Text)
+created_at = Column(DateTime, nullable=False, index=True)
+updated_at = Column(DateTime)
+
+# region foreign keys
 
 @declared_attr
-def meta_data(cls):
-# Warning! We cannot use the attr name "metadata" because it's used by 
SQLAlchemy!
-return relationship.many_to_many(cls, 'metadata', dict_key='name')
+def substitution_template_fk(cls):
+"""For ServiceTemplate one-to-one to SubstitutionTemplate"""
+return relationship.foreign_key('substitution_template', nullable=True)
 
 @declared_attr
-def node_templates(cls):
-return relationship.one_to_many(cls, 'node_template', dict_key='name')
+def node_type_fk(cls):
+"""For ServiceTemplate one-to-one to Type"""
+return relationship.foreign_key('type', nullable=True)
 
 @declared_attr
-def group_templates(cls):
-return relationship.one_to_many(cls, 'group_template', dict_key='name')
+def group_type_fk(cls):
+"""For ServiceTemplate one-to-one to Type"""
+return relationship.foreign_key('type', nullable=True)
 
 @declared_attr
-def policy_templates(cls):
-return relationship.one_to_many(cls, 'policy_template', 
dict_key='name')
+def policy_type_fk(cls):
+"""For ServiceTemplate one-to-one to Type"""
+return relationship.foreign_key('type', nullable=True)
 
 @declared_attr
-def substitution_template(cls):
-return relationship.one_to_one(cls, 'substitution_template')
+def relationship_type_fk(cls):
+"""For ServiceTemplate one-to-one to Type"""
+return relationship.foreign_key('type', nullable=True)
 
 @declared_attr
-def inputs(cls):
-return relationship.many_to_many(cls, 'parameter', prefix='inputs', 
dict_key='name')
+def capability_type_fk(cls):
+"""For ServiceTemplate one-to-one to Type"""
+return relationship.foreign_key('type', nullable=True)
 
 @declared_attr
-def outputs(cls):
-return relationship.many_to_many(cls, 'parameter', prefix='outputs', 
dict_key='name')
+def interface_type_fk(cls):
+"""For ServiceTemplate one-to-one to Type"""
+return relationship.foreign_key('type', nullable=True)
 
 @declared_attr
-def workflow_templates(cls):
-return relationship.one_to_many(cls, 'operation_template', 
dict_key='name')
+def artifact_type_fk(cls):
+"""For ServiceTemplate one-to-one to Type"""
+return relationship.foreign_key('type', nullable=True)
+
+# endregion
+
+# region association proxies
+
+# endregion
+
+# region one_to_one relationships
 
 @declared_attr
-def plugin_specifications(cls):
-return relationship.one_to_many(cls, 'plugin_specification', 
dict_key='name')
+def substitution_template(cls):
+return relationship.one_to_one(
+cls, 'substitution_template', 
back_populates=relationship.NO_BACK_POP)
 
 @declared_attr
 def node_types(cls):
-return relationship.one_to_one(cls, 'type', fk='node_type_fk', 
other_property=False)
+return relationship.one_to_one(
+cls, 'type', fk='node_type_fk', 
back_populates=relationship.NO_BACK_POP)
 
 @declared_attr
 def group_types(cls):
-return relationship.one_to_one(cls, 'type', fk='group_type_fk', 
other_property=False)
+return relationship.one_to_one(
+cls, 'type', fk='group_type_fk', 
back_populates=relationship.NO_BACK_POP)
 
 @declared_attr
 def policy_types(cls):
-return relationship.one_to_one(cls, 'type', fk='policy_type_fk', 
other_property=False)
+

[3/3] incubator-ariatosca git commit: Add status-related methods to the Execution, Task and Node models

2017-03-28 Thread avia
Add status-related methods to the Execution, Task and Node models

We are adding these methods so it will be easier to filter those models
from storage according to their status, and to not make use of the their
`status` constants outside of the models themselves.


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

Branch: 
refs/heads/ARIA-133-Add-status-related-methods-to-Execution-Task-and-Node-models
Commit: 02fedd928367d85b589b10c6c62a91f124b917d5
Parents: 2de0497
Author: Avia Efrat 
Authored: Tue Mar 28 12:51:42 2017 +0300
Committer: Avia Efrat 
Committed: Tue Mar 28 15:08:33 2017 +0300

--
 aria/modeling/orchestration.py | 16 
 aria/modeling/service_instance.py  |  3 ++-
 aria/orchestrator/workflows/core/engine.py |  7 +++
 3 files changed, 17 insertions(+), 9 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/02fedd92/aria/modeling/orchestration.py
--
diff --git a/aria/modeling/orchestration.py b/aria/modeling/orchestration.py
index a13ae87..b35b293 100644
--- a/aria/modeling/orchestration.py
+++ b/aria/modeling/orchestration.py
@@ -69,7 +69,6 @@ class ExecutionBase(ModelMixin):
 
 STATES = [TERMINATED, FAILED, CANCELLED, PENDING, STARTED, CANCELLING, 
FORCE_CANCELLING]
 END_STATES = [TERMINATED, FAILED, CANCELLED]
-ACTIVE_STATES = [state for state in STATES if state not in END_STATES]
 
 VALID_TRANSITIONS = {
 PENDING: [STARTED, CANCELLED],
@@ -102,6 +101,12 @@ class ExecutionBase(ModelMixin):
 status = Column(Enum(*STATES, name='execution_status'), default=PENDING)
 workflow_name = Column(Text)
 
+def has_ended(self):
+return self.status in self.END_STATES
+
+def is_active(self):
+return not self.has_ended()
+
 @declared_attr
 def logs(cls):
 return relationship.one_to_many(cls, 'log')
@@ -240,9 +245,6 @@ class TaskBase(ModelMixin):
 FAILED,
 )
 
-WAIT_STATES = [PENDING, RETRYING]
-END_STATES = [SUCCESS, FAILED]
-
 RUNS_ON_SOURCE = 'source'
 RUNS_ON_TARGET = 'target'
 RUNS_ON_NODE = 'node'
@@ -288,6 +290,12 @@ class TaskBase(ModelMixin):
 implementation = Column(String)
 _runs_on = Column(Enum(*RUNS_ON, name='runs_on'), name='runs_on')
 
+def has_ended(self):
+return self.status in [self.SUCCESS, self.FAILED]
+
+def is_waiting(self):
+return not self.has_ended()
+
 @property
 def runs_on(self):
 if self._runs_on == self.RUNS_ON_NODE:

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/02fedd92/aria/modeling/service_instance.py
--
diff --git a/aria/modeling/service_instance.py 
b/aria/modeling/service_instance.py
index e2e5ae0..80828b1 100644
--- a/aria/modeling/service_instance.py
+++ b/aria/modeling/service_instance.py
@@ -417,7 +417,8 @@ class NodeBase(InstanceModelMixin):
 except KeyError:
 return None
 
-# region foreign_keys
+def not_deleted_or_errored(self):
+return self.state not in [self.DELETED, self.ERROR]
 
 @declared_attr
 def type_fk(cls):

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/02fedd92/aria/orchestrator/workflows/core/engine.py
--
diff --git a/aria/orchestrator/workflows/core/engine.py 
b/aria/orchestrator/workflows/core/engine.py
index fa4550d..3228934 100644
--- a/aria/orchestrator/workflows/core/engine.py
+++ b/aria/orchestrator/workflows/core/engine.py
@@ -88,12 +88,11 @@ class Engine(logger.LoggerMixin):
 def _executable_tasks(self):
 now = datetime.utcnow()
 return (task for task in self._tasks_iter()
-if task.status in models.Task.WAIT_STATES and
-task.due_at <= now and
+if task.is_waiting() and task.due_at <= now and
 not self._task_has_dependencies(task))
 
 def _ended_tasks(self):
-return (task for task in self._tasks_iter() if task.status in 
models.Task.END_STATES)
+return (task for task in self._tasks_iter() if task.has_ended)
 
 def _task_has_dependencies(self, task):
 return len(self._execution_graph.pred.get(task.id, {})) > 0
@@ -105,7 +104,7 @@ class Engine(logger.LoggerMixin):
 for _, data in self._execution_graph.nodes_iter(data=True):
 task = data['task']
 if isinstance(task, 

incubator-ariatosca git commit: Add status-related methods to the Execution, Task and Node models [Forced Update!]

2017-03-28 Thread avia
Repository: incubator-ariatosca
Updated Branches:
  
refs/heads/ARIA-133-Add-status-related-methods-to-Execution-Task-and-Node-models
 8ccb67aa7 -> a08f6d657 (forced update)


Add status-related methods to the Execution, Task and Node models

We are adding these methods so it will be easier to filter those models
from storage according to their status, and to not make use of the their
`status` constants outside of the models themselves.


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

Branch: 
refs/heads/ARIA-133-Add-status-related-methods-to-Execution-Task-and-Node-models
Commit: a08f6d6578a855a88a54c8c97a8a3ca28dd7c56c
Parents: 07cbfcd
Author: Avia Efrat 
Authored: Tue Mar 28 12:51:42 2017 +0300
Committer: Avia Efrat 
Committed: Tue Mar 28 15:03:43 2017 +0300

--
 aria/modeling/orchestration.py | 16 
 aria/modeling/service_instance.py  |  3 +++
 aria/orchestrator/workflows/core/engine.py |  7 +++
 3 files changed, 18 insertions(+), 8 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/a08f6d65/aria/modeling/orchestration.py
--
diff --git a/aria/modeling/orchestration.py b/aria/modeling/orchestration.py
index 2d58671..a2bb7a6 100644
--- a/aria/modeling/orchestration.py
+++ b/aria/modeling/orchestration.py
@@ -69,7 +69,6 @@ class ExecutionBase(ModelMixin):
 
 STATES = [TERMINATED, FAILED, CANCELLED, PENDING, STARTED, CANCELLING, 
FORCE_CANCELLING]
 END_STATES = [TERMINATED, FAILED, CANCELLED]
-ACTIVE_STATES = [state for state in STATES if state not in END_STATES]
 
 VALID_TRANSITIONS = {
 PENDING: [STARTED, CANCELLED],
@@ -102,6 +101,12 @@ class ExecutionBase(ModelMixin):
 status = Column(Enum(*STATES, name='execution_status'), default=PENDING)
 workflow_name = Column(Text)
 
+def has_ended(self):
+return self.status in self.END_STATES
+
+def is_active(self):
+return not self.has_ended()
+
 @declared_attr
 def service(cls):
 return relationship.many_to_one(cls, 'service')
@@ -228,9 +233,6 @@ class TaskBase(ModelMixin):
 FAILED,
 )
 
-WAIT_STATES = [PENDING, RETRYING]
-END_STATES = [SUCCESS, FAILED]
-
 RUNS_ON_SOURCE = 'source'
 RUNS_ON_TARGET = 'target'
 RUNS_ON_NODE = 'node'
@@ -272,6 +274,12 @@ class TaskBase(ModelMixin):
 implementation = Column(String)
 _runs_on = Column(Enum(*RUNS_ON, name='runs_on'), name='runs_on')
 
+def has_ended(self):
+return self.status in [self.SUCCESS, self.FAILED]
+
+def is_waiting(self):
+return not self.has_ended()
+
 @property
 def runs_on(self):
 if self._runs_on == self.RUNS_ON_NODE:

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/a08f6d65/aria/modeling/service_instance.py
--
diff --git a/aria/modeling/service_instance.py 
b/aria/modeling/service_instance.py
index 1e18db0..1b17ffd 100644
--- a/aria/modeling/service_instance.py
+++ b/aria/modeling/service_instance.py
@@ -391,6 +391,9 @@ class NodeBase(InstanceModelMixin): # pylint: 
disable=too-many-public-methods
 except KeyError:
 return None
 
+def not_deleted_or_errored(self):
+return self.state not in [self.DELETED, self.ERROR]
+
 @declared_attr
 def node_template(cls):
 return relationship.many_to_one(cls, 'node_template')

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/a08f6d65/aria/orchestrator/workflows/core/engine.py
--
diff --git a/aria/orchestrator/workflows/core/engine.py 
b/aria/orchestrator/workflows/core/engine.py
index fa4550d..3228934 100644
--- a/aria/orchestrator/workflows/core/engine.py
+++ b/aria/orchestrator/workflows/core/engine.py
@@ -88,12 +88,11 @@ class Engine(logger.LoggerMixin):
 def _executable_tasks(self):
 now = datetime.utcnow()
 return (task for task in self._tasks_iter()
-if task.status in models.Task.WAIT_STATES and
-task.due_at <= now and
+if task.is_waiting() and task.due_at <= now and
 not self._task_has_dependencies(task))
 
 def _ended_tasks(self):
-return (task for task in self._tasks_iter() if task.status in 
models.Task.END_STATES)
+return (task for task in self._tasks_iter() if task.has_ended)
 
 def _task_has_dependencies(self, 

[jira] [Closed] (ARIA-132) Models cascading deletion raises constraint errors

2017-03-28 Thread Ran Ziv (JIRA)

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

Ran Ziv closed ARIA-132.


> Models cascading deletion raises constraint errors
> --
>
> Key: ARIA-132
> URL: https://issues.apache.org/jira/browse/ARIA-132
> Project: AriaTosca
>  Issue Type: Bug
>Reporter: Ran Ziv
>Assignee: Maxim Orlov
>Priority: Critical
> Fix For: 0.1.0
>
>
> Models whose deletion should cascade to additional models currently don't 
> behave this way and instead raise constraint errors



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


[jira] [Commented] (ARIA-132) Models cascading deletion raises constraint errors

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

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

ASF GitHub Bot commented on ARIA-132:
-

Github user asfgit closed the pull request at:

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


> Models cascading deletion raises constraint errors
> --
>
> Key: ARIA-132
> URL: https://issues.apache.org/jira/browse/ARIA-132
> Project: AriaTosca
>  Issue Type: Bug
>Reporter: Ran Ziv
>Assignee: Maxim Orlov
>Priority: Critical
> Fix For: 0.1.0
>
>
> Models whose deletion should cascade to additional models currently don't 
> behave this way and instead raise constraint errors



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


[jira] [Resolved] (ARIA-132) Models cascading deletion raises constraint errors

2017-03-28 Thread Ran Ziv (JIRA)

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

Ran Ziv resolved ARIA-132.
--
   Resolution: Fixed
Fix Version/s: 0.1.0

> Models cascading deletion raises constraint errors
> --
>
> Key: ARIA-132
> URL: https://issues.apache.org/jira/browse/ARIA-132
> Project: AriaTosca
>  Issue Type: Bug
>Reporter: Ran Ziv
>Assignee: Maxim Orlov
>Priority: Critical
> Fix For: 0.1.0
>
>
> Models whose deletion should cascade to additional models currently don't 
> behave this way and instead raise constraint errors



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


[incubator-ariatosca] Git Push Summary

2017-03-28 Thread mxmrlv
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-132-Models-cascading-deletion-raises-constraint-errors 
[deleted] 2de049729


[2/2] incubator-ariatosca git commit: ARIA-132-Models-cascading-deletion-raises-constraint-errors

2017-03-28 Thread mxmrlv
ARIA-132-Models-cascading-deletion-raises-constraint-errors

Additional fixes:
- The relationships are now defined on both sides. we no longer use backref, 
but back_populates.


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

Branch: refs/heads/ARIA-132-Models-cascading-deletion-raises-constraint-errors
Commit: 2de049729f5d0fff50297d25a88f5eecdcf266f9
Parents: 07cbfcd
Author: max-orlov 
Authored: Sun Mar 26 14:13:47 2017 +0300
Committer: max-orlov 
Committed: Tue Mar 28 15:01:15 2017 +0300

--
 aria/.pylintrc  |   2 +-
 aria/modeling/orchestration.py  |  16 +
 aria/modeling/relationship.py   | 222 +++--
 aria/modeling/service_changes.py|  86 +-
 aria/modeling/service_common.py |   4 +
 aria/modeling/service_instance.py   | 813 +++---
 aria/modeling/service_template.py   | 823 +--
 tests/orchestrator/context/test_operation.py|   4 +-
 .../node-cellar/node-cellar.yaml|   1 -
 9 files changed, 1299 insertions(+), 672 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/2de04972/aria/.pylintrc
--
diff --git a/aria/.pylintrc b/aria/.pylintrc
index 589402f..7222605 100644
--- a/aria/.pylintrc
+++ b/aria/.pylintrc
@@ -375,7 +375,7 @@ max-attributes=20
 min-public-methods=0
 
 # Maximum number of public methods for a class (see R0904).
-max-public-methods=20
+max-public-methods=50
 
 # Maximum number of boolean expressions in a if statement
 max-bool-expr=5

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/2de04972/aria/modeling/orchestration.py
--
diff --git a/aria/modeling/orchestration.py b/aria/modeling/orchestration.py
index 2d58671..a13ae87 100644
--- a/aria/modeling/orchestration.py
+++ b/aria/modeling/orchestration.py
@@ -103,9 +103,17 @@ class ExecutionBase(ModelMixin):
 workflow_name = Column(Text)
 
 @declared_attr
+def logs(cls):
+return relationship.one_to_many(cls, 'log')
+
+@declared_attr
 def service(cls):
 return relationship.many_to_one(cls, 'service')
 
+@declared_attr
+def tasks(cls):
+return relationship.one_to_many(cls, 'task')
+
 # region foreign keys
 
 @declared_attr
@@ -185,6 +193,10 @@ class PluginBase(ModelMixin):
 
 __tablename__ = 'plugin'
 
+@declared_attr
+def tasks(cls):
+return relationship.one_to_many(cls, 'task')
+
 archive_name = Column(Text, nullable=False, index=True)
 distribution = Column(Text)
 distribution_release = Column(Text)
@@ -239,6 +251,10 @@ class TaskBase(ModelMixin):
 INFINITE_RETRIES = -1
 
 @declared_attr
+def logs(cls):
+return relationship.one_to_many(cls, 'log')
+
+@declared_attr
 def node(cls):
 return relationship.many_to_one(cls, 'node')
 

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/2de04972/aria/modeling/relationship.py
--
diff --git a/aria/modeling/relationship.py b/aria/modeling/relationship.py
index 70691b3..ac1de28 100644
--- a/aria/modeling/relationship.py
+++ b/aria/modeling/relationship.py
@@ -26,9 +26,10 @@ from sqlalchemy import (
 
 from ..utils import formatting
 
+NO_BACK_POP = 'NO_BACK_POP'
 
-def foreign_key(other_table,
-nullable=False):
+
+def foreign_key(other_table, nullable=False):
 """
 Declare a foreign key property, which will also create a foreign key 
column in the table with
 the name of the property. By convention the property name should end in 
"_fk".
@@ -54,9 +55,7 @@ def foreign_key(other_table,
   nullable=nullable)
 
 
-def one_to_one_self(model_class,
-fk,
-relationship_kwargs=None):
+def one_to_one_self(model_class, fk):
 """
 Declare a one-to-one relationship property. The property value would be an 
instance of the same
 model.
@@ -69,12 +68,8 @@ def one_to_one_self(model_class,
 :type model_class: type
 :param fk: Foreign key name
 :type fk: basestring
-:param relationship_kwargs: Extra kwargs for SQLAlchemy ``relationship``
-:type relationship_kwargs: {}
 """
 
-relationship_kwargs = relationship_kwargs or {}
-
 remote_side = '{model_class}.{remote_column}'.format(
 

[1/2] incubator-ariatosca git commit: ARIA-132-Models-cascading-deletion-raises-constraint-errors [Forced Update!]

2017-03-28 Thread mxmrlv
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-132-Models-cascading-deletion-raises-constraint-errors 
d35a11959 -> 2de049729 (forced update)


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/2de04972/aria/modeling/service_template.py
--
diff --git a/aria/modeling/service_template.py 
b/aria/modeling/service_template.py
index 8b619bf..8355521 100644
--- a/aria/modeling/service_template.py
+++ b/aria/modeling/service_template.py
@@ -41,7 +41,7 @@ from . import (
 )
 
 
-class ServiceTemplateBase(TemplateModelMixin): # pylint: 
disable=too-many-public-methods
+class ServiceTemplateBase(TemplateModelMixin):
 """
 A service template is a source for creating :class:`Service` instances.
 
@@ -90,7 +90,6 @@ class ServiceTemplateBase(TemplateModelMixin): # pylint: 
disable=too-many-public
 :vartype created_at: :class:`datetime.datetime`
 :ivar updated_at: Update timestamp
 :vartype updated_at: :class:`datetime.datetime`
-
 :ivar services: Instantiated services
 :vartype services: [:class:`Service`]
 """
@@ -108,121 +107,151 @@ class ServiceTemplateBase(TemplateModelMixin): # 
pylint: disable=too-many-public
 
 description = Column(Text)
 main_file_name = Column(Text)
+created_at = Column(DateTime, nullable=False, index=True)
+updated_at = Column(DateTime)
+
+# region foreign keys
 
 @declared_attr
-def meta_data(cls):
-# Warning! We cannot use the attr name "metadata" because it's used by 
SQLAlchemy!
-return relationship.many_to_many(cls, 'metadata', dict_key='name')
+def substitution_template_fk(cls):
+"""For ServiceTemplate one-to-one to SubstitutionTemplate"""
+return relationship.foreign_key('substitution_template', nullable=True)
 
 @declared_attr
-def node_templates(cls):
-return relationship.one_to_many(cls, 'node_template', dict_key='name')
+def node_type_fk(cls):
+"""For ServiceTemplate one-to-one to Type"""
+return relationship.foreign_key('type', nullable=True)
 
 @declared_attr
-def group_templates(cls):
-return relationship.one_to_many(cls, 'group_template', dict_key='name')
+def group_type_fk(cls):
+"""For ServiceTemplate one-to-one to Type"""
+return relationship.foreign_key('type', nullable=True)
 
 @declared_attr
-def policy_templates(cls):
-return relationship.one_to_many(cls, 'policy_template', 
dict_key='name')
+def policy_type_fk(cls):
+"""For ServiceTemplate one-to-one to Type"""
+return relationship.foreign_key('type', nullable=True)
 
 @declared_attr
-def substitution_template(cls):
-return relationship.one_to_one(cls, 'substitution_template')
+def relationship_type_fk(cls):
+"""For ServiceTemplate one-to-one to Type"""
+return relationship.foreign_key('type', nullable=True)
 
 @declared_attr
-def inputs(cls):
-return relationship.many_to_many(cls, 'parameter', prefix='inputs', 
dict_key='name')
+def capability_type_fk(cls):
+"""For ServiceTemplate one-to-one to Type"""
+return relationship.foreign_key('type', nullable=True)
 
 @declared_attr
-def outputs(cls):
-return relationship.many_to_many(cls, 'parameter', prefix='outputs', 
dict_key='name')
+def interface_type_fk(cls):
+"""For ServiceTemplate one-to-one to Type"""
+return relationship.foreign_key('type', nullable=True)
 
 @declared_attr
-def workflow_templates(cls):
-return relationship.one_to_many(cls, 'operation_template', 
dict_key='name')
+def artifact_type_fk(cls):
+"""For ServiceTemplate one-to-one to Type"""
+return relationship.foreign_key('type', nullable=True)
+
+# endregion
+
+# region association proxies
+
+# endregion
+
+# region one_to_one relationships
 
 @declared_attr
-def plugin_specifications(cls):
-return relationship.one_to_many(cls, 'plugin_specification', 
dict_key='name')
+def substitution_template(cls):
+return relationship.one_to_one(
+cls, 'substitution_template', 
back_populates=relationship.NO_BACK_POP)
 
 @declared_attr
 def node_types(cls):
-return relationship.one_to_one(cls, 'type', fk='node_type_fk', 
other_property=False)
+return relationship.one_to_one(
+cls, 'type', fk='node_type_fk', 
back_populates=relationship.NO_BACK_POP)
 
 @declared_attr
 def group_types(cls):
-return relationship.one_to_one(cls, 'type', fk='group_type_fk', 
other_property=False)
+return relationship.one_to_one(
+cls, 'type', fk='group_type_fk', 
back_populates=relationship.NO_BACK_POP)
 
 @declared_attr
 def policy_types(cls):
-return relationship.one_to_one(cls, 'type', fk='policy_type_fk', 
other_property=False)
+return 

[jira] [Updated] (ARIA-133) Add status-related methods to Execution, Task and Node models

2017-03-28 Thread Avia Efrat (JIRA)

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

Avia Efrat updated ARIA-133:

Summary: Add status-related methods to Execution, Task and Node models  
(was: Add status-related methods to the Execution, Task and Node models)

> Add status-related methods to Execution, Task and Node models
> -
>
> Key: ARIA-133
> URL: https://issues.apache.org/jira/browse/ARIA-133
> Project: AriaTosca
>  Issue Type: Task
>Reporter: Avia Efrat
>Assignee: Avia Efrat
>Priority: Minor
>
> We are adding those methods so it will be easier to filter these models from 
> storage according to their status, and to not make use of the their `status` 
> constants outside of the models themselves.



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


incubator-ariatosca git commit: Add status-related methods to the Execution, Task and Node models

2017-03-28 Thread avia
Repository: incubator-ariatosca
Updated Branches:
  
refs/heads/ARIA-133-Add-status-related-methods-to-Execution-Task-and-Node-models
 [created] 8ccb67aa7


Add status-related methods to the Execution, Task and Node models

We are adding these methods so it will be easier to filter those models
from storage according to their status, and to not make use of the their
`status` constants outside of the models themselves.


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

Branch: 
refs/heads/ARIA-133-Add-status-related-methods-to-Execution-Task-and-Node-models
Commit: 8ccb67aa7ce9ff38279be6a58d021d386961a086
Parents: 07cbfcd
Author: Avia Efrat 
Authored: Tue Mar 28 12:51:42 2017 +0300
Committer: Avia Efrat 
Committed: Tue Mar 28 14:55:09 2017 +0300

--
 aria/modeling/orchestration.py | 16 
 aria/orchestrator/workflows/core/engine.py |  7 +++
 2 files changed, 15 insertions(+), 8 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/8ccb67aa/aria/modeling/orchestration.py
--
diff --git a/aria/modeling/orchestration.py b/aria/modeling/orchestration.py
index 2d58671..e6f6c7f 100644
--- a/aria/modeling/orchestration.py
+++ b/aria/modeling/orchestration.py
@@ -69,7 +69,6 @@ class ExecutionBase(ModelMixin):
 
 STATES = [TERMINATED, FAILED, CANCELLED, PENDING, STARTED, CANCELLING, 
FORCE_CANCELLING]
 END_STATES = [TERMINATED, FAILED, CANCELLED]
-ACTIVE_STATES = [state for state in STATES if state not in END_STATES]
 
 VALID_TRANSITIONS = {
 PENDING: [STARTED, CANCELLED],
@@ -102,6 +101,12 @@ class ExecutionBase(ModelMixin):
 status = Column(Enum(*STATES, name='execution_status'), default=PENDING)
 workflow_name = Column(Text)
 
+def has_ended(self):
+return self.status in self.END_STATES
+
+def is_active(self):
+return not self.has_ended()
+
 @declared_attr
 def service(cls):
 return relationship.many_to_one(cls, 'service')
@@ -228,9 +233,6 @@ class TaskBase(ModelMixin):
 FAILED,
 )
 
-WAIT_STATES = [PENDING, RETRYING]
-END_STATES = [SUCCESS, FAILED]
-
 RUNS_ON_SOURCE = 'source'
 RUNS_ON_TARGET = 'target'
 RUNS_ON_NODE = 'node'
@@ -272,6 +274,12 @@ class TaskBase(ModelMixin):
 implementation = Column(String)
 _runs_on = Column(Enum(*RUNS_ON, name='runs_on'), name='runs_on')
 
+def is_waiting(self):
+return self.status in [self.PENDING, self.RETRYING]
+
+def has_ended(self):
+return not self.is_waiting()
+
 @property
 def runs_on(self):
 if self._runs_on == self.RUNS_ON_NODE:

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/8ccb67aa/aria/orchestrator/workflows/core/engine.py
--
diff --git a/aria/orchestrator/workflows/core/engine.py 
b/aria/orchestrator/workflows/core/engine.py
index fa4550d..3228934 100644
--- a/aria/orchestrator/workflows/core/engine.py
+++ b/aria/orchestrator/workflows/core/engine.py
@@ -88,12 +88,11 @@ class Engine(logger.LoggerMixin):
 def _executable_tasks(self):
 now = datetime.utcnow()
 return (task for task in self._tasks_iter()
-if task.status in models.Task.WAIT_STATES and
-task.due_at <= now and
+if task.is_waiting() and task.due_at <= now and
 not self._task_has_dependencies(task))
 
 def _ended_tasks(self):
-return (task for task in self._tasks_iter() if task.status in 
models.Task.END_STATES)
+return (task for task in self._tasks_iter() if task.has_ended)
 
 def _task_has_dependencies(self, task):
 return len(self._execution_graph.pred.get(task.id, {})) > 0
@@ -105,7 +104,7 @@ class Engine(logger.LoggerMixin):
 for _, data in self._execution_graph.nodes_iter(data=True):
 task = data['task']
 if isinstance(task, engine_task.OperationTask):
-if task.model_task.status not in models.Task.END_STATES:
+if not task.model_task.has_ended():
 self._workflow_context.model.task.refresh(task.model_task)
 yield task
 



[jira] [Updated] (ARIA-133) Add status-related methods to the Execution, Task and Node models

2017-03-28 Thread Avia Efrat (JIRA)

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

Avia Efrat updated ARIA-133:

Description: We are adding those methods so it will be easier to filter 
these models from storage according to their status, and to not make use of the 
their `status` constants outside of the models themselves.  (was: We are adding 
these methods so it will be easier to filter these models from storage 
according to their status, and to not make use of the their `status` constants 
outside of the models themselves.)

> Add status-related methods to the Execution, Task and Node models
> -
>
> Key: ARIA-133
> URL: https://issues.apache.org/jira/browse/ARIA-133
> Project: AriaTosca
>  Issue Type: Task
>Reporter: Avia Efrat
>Assignee: Avia Efrat
>Priority: Minor
>
> We are adding those methods so it will be easier to filter these models from 
> storage according to their status, and to not make use of the their `status` 
> constants outside of the models themselves.



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


[jira] [Updated] (ARIA-133) Add status-related methods to the Execution, Task and Node models

2017-03-28 Thread Avia Efrat (JIRA)

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

Avia Efrat updated ARIA-133:

Summary: Add status-related methods to the Execution, Task and Node models  
(was: Add status-related methods to the Execution and Task models)

> Add status-related methods to the Execution, Task and Node models
> -
>
> Key: ARIA-133
> URL: https://issues.apache.org/jira/browse/ARIA-133
> Project: AriaTosca
>  Issue Type: Task
>Reporter: Avia Efrat
>Assignee: Avia Efrat
>Priority: Minor
>
> We are adding these methods so it will be easier to filter these models from 
> storage according to their status, and to not make use of the their `status` 
> constants outside of the models themselves.



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


[jira] [Updated] (ARIA-133) Add status-related methods to the Execution and Task models

2017-03-28 Thread Avia Efrat (JIRA)

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

Avia Efrat updated ARIA-133:

Description: We are adding these methods so it will be easier to filter 
these models from storage according to their status, and to not make use of the 
their `status` constants outside of the models themselves.  (was: We are adding 
these methods so it will be easier to filter executions and tasks from the 
storage according to their status, and to not make use of the their `status` 
constants outside of the models themselves.)

> Add status-related methods to the Execution and Task models
> ---
>
> Key: ARIA-133
> URL: https://issues.apache.org/jira/browse/ARIA-133
> Project: AriaTosca
>  Issue Type: Task
>Reporter: Avia Efrat
>Assignee: Avia Efrat
>Priority: Minor
>
> We are adding these methods so it will be easier to filter these models from 
> storage according to their status, and to not make use of the their `status` 
> constants outside of the models themselves.



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


[jira] [Commented] (ARIA-132) Models cascading deletion raises constraint errors

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

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

ASF GitHub Bot commented on ARIA-132:
-

Github user mxmrlv commented on a diff in the pull request:

https://github.com/apache/incubator-ariatosca/pull/84#discussion_r108395116
  
--- Diff: aria/modeling/service_template.py ---
@@ -1644,6 +1935,52 @@ def node_template_fk(cls):
 
 # endregion
 
+# region association proxies
+
+# endregion
+
+# region one_to_one relationships
+
+# endregion
+
+# region one_to_many relationships
+
+@declared_attr
+def artifacts(cls):
+return relationship.one_to_many(cls, 'artifact')
+
+# endregion
+
+# region many_to_one relationships
+
+@declared_attr
+def node_template(cls):
+return relationship.many_to_one(cls, 'node_template')
+
+@declared_attr
+def type(cls):
+return relationship.many_to_one(cls, 'type', back_populates=False)
+
+# endregion
+
+# region many_to_many relationships
+
+@declared_attr
+def properties(cls):
+return relationship.many_to_many(cls, 'parameter', 
prefix='properties', dict_key='name')
+
+# endregion
+
+description = Column(Text)
+source_path = Column(Text)
+target_path = Column(Text)
+repository_url = Column(Text)
+repository_credential = Column(modeling_types.StrictDict(basestring, 
basestring))
+
+
--- End diff --

remove


> Models cascading deletion raises constraint errors
> --
>
> Key: ARIA-132
> URL: https://issues.apache.org/jira/browse/ARIA-132
> Project: AriaTosca
>  Issue Type: Bug
>Reporter: Ran Ziv
>Assignee: Maxim Orlov
>Priority: Critical
>
> Models whose deletion should cascade to additional models currently don't 
> behave this way and instead raise constraint errors



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


[jira] [Commented] (ARIA-132) Models cascading deletion raises constraint errors

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

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

ASF GitHub Bot commented on ARIA-132:
-

Github user mxmrlv commented on a diff in the pull request:

https://github.com/apache/incubator-ariatosca/pull/84#discussion_r108392826
  
--- Diff: aria/.pylintrc ---
@@ -375,7 +375,7 @@ max-attributes=20
 min-public-methods=0
--- End diff --

add documentation


> Models cascading deletion raises constraint errors
> --
>
> Key: ARIA-132
> URL: https://issues.apache.org/jira/browse/ARIA-132
> Project: AriaTosca
>  Issue Type: Bug
>Reporter: Ran Ziv
>Assignee: Maxim Orlov
>Priority: Critical
>
> Models whose deletion should cascade to additional models currently don't 
> behave this way and instead raise constraint errors



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


[jira] [Commented] (ARIA-132) Models cascading deletion raises constraint errors

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

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

ASF GitHub Bot commented on ARIA-132:
-

Github user mxmrlv commented on a diff in the pull request:

https://github.com/apache/incubator-ariatosca/pull/84#discussion_r108393478
  
--- Diff: aria/modeling/relationship.py ---
@@ -114,28 +105,24 @@ def one_to_many_self(model_class,
 :param dict_key: If set the value will be a dict with this key as the 
dict key; otherwise will
  be a list
 :type dict_key: basestring
-:param relationship_kwargs: Extra kwargs for SQLAlchemy 
``relationship``
-:type relationship_kwargs: {}
 """
-
-relationship_kwargs = relationship_kwargs or {}
-
-relationship_kwargs.setdefault('remote_side', 
'{model_class}.{remote_column}'.format(
-model_class=model_class.__name__,
-remote_column=fk
-))
-
-return _relationship(model_class, model_class.__tablename__, None, 
relationship_kwargs,
- other_property=False, dict_key=dict_key)
+return _relationship(
+model_class,
+model_class.__tablename__,
+relationship_kwargs={
+'remote_side': '{model_class}.{remote_column}'.format(
+model_class=model_class.__name__, remote_column=fk)
+},
+back_populates=False,
+dict_key=dict_key
+)
 
 
 def one_to_one(model_class,
other_table,
fk=None,
other_fk=None,
-   other_property=None,
-   relationship_kwargs=None,
-   backref_kwargs=None):
+   back_populates=None):
--- End diff --

add NO_BACK_POP const (instead of False)


> Models cascading deletion raises constraint errors
> --
>
> Key: ARIA-132
> URL: https://issues.apache.org/jira/browse/ARIA-132
> Project: AriaTosca
>  Issue Type: Bug
>Reporter: Ran Ziv
>Assignee: Maxim Orlov
>Priority: Critical
>
> Models whose deletion should cascade to additional models currently don't 
> behave this way and instead raise constraint errors



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


[GitHub] incubator-ariatosca pull request #84: ARIA-132 models cascading deletion rai...

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

https://github.com/apache/incubator-ariatosca/pull/84#discussion_r108395116
  
--- Diff: aria/modeling/service_template.py ---
@@ -1644,6 +1935,52 @@ def node_template_fk(cls):
 
 # endregion
 
+# region association proxies
+
+# endregion
+
+# region one_to_one relationships
+
+# endregion
+
+# region one_to_many relationships
+
+@declared_attr
+def artifacts(cls):
+return relationship.one_to_many(cls, 'artifact')
+
+# endregion
+
+# region many_to_one relationships
+
+@declared_attr
+def node_template(cls):
+return relationship.many_to_one(cls, 'node_template')
+
+@declared_attr
+def type(cls):
+return relationship.many_to_one(cls, 'type', back_populates=False)
+
+# endregion
+
+# region many_to_many relationships
+
+@declared_attr
+def properties(cls):
+return relationship.many_to_many(cls, 'parameter', 
prefix='properties', dict_key='name')
+
+# endregion
+
+description = Column(Text)
+source_path = Column(Text)
+target_path = Column(Text)
+repository_url = Column(Text)
+repository_credential = Column(modeling_types.StrictDict(basestring, 
basestring))
+
+
--- End diff --

remove


---
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 #84: ARIA-132 models cascading deletion rai...

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

https://github.com/apache/incubator-ariatosca/pull/84#discussion_r108392826
  
--- Diff: aria/.pylintrc ---
@@ -375,7 +375,7 @@ max-attributes=20
 min-public-methods=0
--- End diff --

add documentation


---
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 #84: ARIA-132 models cascading deletion rai...

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

https://github.com/apache/incubator-ariatosca/pull/84#discussion_r108393478
  
--- Diff: aria/modeling/relationship.py ---
@@ -114,28 +105,24 @@ def one_to_many_self(model_class,
 :param dict_key: If set the value will be a dict with this key as the 
dict key; otherwise will
  be a list
 :type dict_key: basestring
-:param relationship_kwargs: Extra kwargs for SQLAlchemy 
``relationship``
-:type relationship_kwargs: {}
 """
-
-relationship_kwargs = relationship_kwargs or {}
-
-relationship_kwargs.setdefault('remote_side', 
'{model_class}.{remote_column}'.format(
-model_class=model_class.__name__,
-remote_column=fk
-))
-
-return _relationship(model_class, model_class.__tablename__, None, 
relationship_kwargs,
- other_property=False, dict_key=dict_key)
+return _relationship(
+model_class,
+model_class.__tablename__,
+relationship_kwargs={
+'remote_side': '{model_class}.{remote_column}'.format(
+model_class=model_class.__name__, remote_column=fk)
+},
+back_populates=False,
+dict_key=dict_key
+)
 
 
 def one_to_one(model_class,
other_table,
fk=None,
other_fk=None,
-   other_property=None,
-   relationship_kwargs=None,
-   backref_kwargs=None):
+   back_populates=None):
--- End diff --

add NO_BACK_POP const (instead of False)


---
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-133) Add status-related methods to the Execution and Task models

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

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

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

Commit ff2c4a379322303631ddc55e4dad78bd77768bc5 in incubator-ariatosca's branch 
refs/heads/ARIA-133-Add-status-related-methods-to-the-Execution-and-Task-models 
from [~avia]
[ https://git-wip-us.apache.org/repos/asf?p=incubator-ariatosca.git;h=ff2c4a3 ]

ARIA-133 Add status-related methods to the Execution and Task models

We are adding these methods so it will be easier to filter executions
and tasks from the storage according to their status, and to not make
use of the their `status` constants outside of the models themselves.


> Add status-related methods to the Execution and Task models
> ---
>
> Key: ARIA-133
> URL: https://issues.apache.org/jira/browse/ARIA-133
> Project: AriaTosca
>  Issue Type: Task
>Reporter: Avia Efrat
>Assignee: Avia Efrat
>Priority: Minor
>
> We are adding these methods so it will be easier to filter executions and 
> tasks from the storage according to their status, and to not make use of the 
> their `status` constants outside of the models themselves.



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


incubator-ariatosca git commit: ARIA-133 Add status-related methods to the Execution and Task models

2017-03-28 Thread avia
Repository: incubator-ariatosca
Updated Branches:
  
refs/heads/ARIA-133-Add-status-related-methods-to-the-Execution-and-Task-models 
[created] ff2c4a379


ARIA-133 Add status-related methods to the Execution and Task models

We are adding these methods so it will be easier to filter executions
and tasks from the storage according to their status, and to not make
use of the their `status` constants outside of the models themselves.


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

Branch: 
refs/heads/ARIA-133-Add-status-related-methods-to-the-Execution-and-Task-models
Commit: ff2c4a379322303631ddc55e4dad78bd77768bc5
Parents: 07cbfcd
Author: Avia Efrat 
Authored: Tue Mar 28 12:51:42 2017 +0300
Committer: Avia Efrat 
Committed: Tue Mar 28 13:24:29 2017 +0300

--
 aria/modeling/orchestration.py | 16 
 aria/orchestrator/workflows/core/engine.py |  7 +++
 2 files changed, 15 insertions(+), 8 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/ff2c4a37/aria/modeling/orchestration.py
--
diff --git a/aria/modeling/orchestration.py b/aria/modeling/orchestration.py
index 2d58671..e6f6c7f 100644
--- a/aria/modeling/orchestration.py
+++ b/aria/modeling/orchestration.py
@@ -69,7 +69,6 @@ class ExecutionBase(ModelMixin):
 
 STATES = [TERMINATED, FAILED, CANCELLED, PENDING, STARTED, CANCELLING, 
FORCE_CANCELLING]
 END_STATES = [TERMINATED, FAILED, CANCELLED]
-ACTIVE_STATES = [state for state in STATES if state not in END_STATES]
 
 VALID_TRANSITIONS = {
 PENDING: [STARTED, CANCELLED],
@@ -102,6 +101,12 @@ class ExecutionBase(ModelMixin):
 status = Column(Enum(*STATES, name='execution_status'), default=PENDING)
 workflow_name = Column(Text)
 
+def has_ended(self):
+return self.status in self.END_STATES
+
+def is_active(self):
+return not self.has_ended()
+
 @declared_attr
 def service(cls):
 return relationship.many_to_one(cls, 'service')
@@ -228,9 +233,6 @@ class TaskBase(ModelMixin):
 FAILED,
 )
 
-WAIT_STATES = [PENDING, RETRYING]
-END_STATES = [SUCCESS, FAILED]
-
 RUNS_ON_SOURCE = 'source'
 RUNS_ON_TARGET = 'target'
 RUNS_ON_NODE = 'node'
@@ -272,6 +274,12 @@ class TaskBase(ModelMixin):
 implementation = Column(String)
 _runs_on = Column(Enum(*RUNS_ON, name='runs_on'), name='runs_on')
 
+def is_waiting(self):
+return self.status in [self.PENDING, self.RETRYING]
+
+def has_ended(self):
+return not self.is_waiting()
+
 @property
 def runs_on(self):
 if self._runs_on == self.RUNS_ON_NODE:

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/ff2c4a37/aria/orchestrator/workflows/core/engine.py
--
diff --git a/aria/orchestrator/workflows/core/engine.py 
b/aria/orchestrator/workflows/core/engine.py
index fa4550d..3228934 100644
--- a/aria/orchestrator/workflows/core/engine.py
+++ b/aria/orchestrator/workflows/core/engine.py
@@ -88,12 +88,11 @@ class Engine(logger.LoggerMixin):
 def _executable_tasks(self):
 now = datetime.utcnow()
 return (task for task in self._tasks_iter()
-if task.status in models.Task.WAIT_STATES and
-task.due_at <= now and
+if task.is_waiting() and task.due_at <= now and
 not self._task_has_dependencies(task))
 
 def _ended_tasks(self):
-return (task for task in self._tasks_iter() if task.status in 
models.Task.END_STATES)
+return (task for task in self._tasks_iter() if task.has_ended)
 
 def _task_has_dependencies(self, task):
 return len(self._execution_graph.pred.get(task.id, {})) > 0
@@ -105,7 +104,7 @@ class Engine(logger.LoggerMixin):
 for _, data in self._execution_graph.nodes_iter(data=True):
 task = data['task']
 if isinstance(task, engine_task.OperationTask):
-if task.model_task.status not in models.Task.END_STATES:
+if not task.model_task.has_ended():
 self._workflow_context.model.task.refresh(task.model_task)
 yield task
 



[jira] [Updated] (ARIA-133) Add status-related methods to the Execution and Task models

2017-03-28 Thread Avia Efrat (JIRA)

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

Avia Efrat updated ARIA-133:

Summary: Add status-related methods to the Execution and Task models  (was: 
Add is_active and is_ended methods to the Execution and Task model)

> Add status-related methods to the Execution and Task models
> ---
>
> Key: ARIA-133
> URL: https://issues.apache.org/jira/browse/ARIA-133
> Project: AriaTosca
>  Issue Type: Task
>Reporter: Avia Efrat
>Assignee: Avia Efrat
>Priority: Minor
>
> We are adding these methods so it will be easier to filter executions and 
> tasks from the storage according to their status, and to not make use of the 
> their `status` constants outside of the models themselves.



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


[jira] [Updated] (ARIA-133) Add is_active and is_ended methods to the Execution model

2017-03-28 Thread Avia Efrat (JIRA)

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

Avia Efrat updated ARIA-133:

Description: We are adding these methods so it will be easier to filter 
executions and tasks from the storage according to their status, and to not 
make use of the their `status` constants outside of the models themselves.  
(was: We are adding these functions so it will be easier to filter executions 
from the storage according to their status, and to not make use of the `status` 
constants outside of the Execution model.)

> Add is_active and is_ended methods to the Execution model
> -
>
> Key: ARIA-133
> URL: https://issues.apache.org/jira/browse/ARIA-133
> Project: AriaTosca
>  Issue Type: Task
>Reporter: Avia Efrat
>Assignee: Avia Efrat
>Priority: Minor
>
> We are adding these methods so it will be easier to filter executions and 
> tasks from the storage according to their status, and to not make use of the 
> their `status` constants outside of the models themselves.



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


[jira] [Updated] (ARIA-133) Add is_active and is_ended methods to the Execution and Task model

2017-03-28 Thread Avia Efrat (JIRA)

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

Avia Efrat updated ARIA-133:

Summary: Add is_active and is_ended methods to the Execution and Task model 
 (was: Add is_active and is_ended methods to the Execution model)

> Add is_active and is_ended methods to the Execution and Task model
> --
>
> Key: ARIA-133
> URL: https://issues.apache.org/jira/browse/ARIA-133
> Project: AriaTosca
>  Issue Type: Task
>Reporter: Avia Efrat
>Assignee: Avia Efrat
>Priority: Minor
>
> We are adding these methods so it will be easier to filter executions and 
> tasks from the storage according to their status, and to not make use of the 
> their `status` constants outside of the models themselves.



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


[incubator-ariatosca] Git Push Summary

2017-03-28 Thread mxmrlv
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-120-Builtin-workflows-relationship-operations-execution-order 
[deleted] 07cbfcdab


incubator-ariatosca git commit: ARIA-132-Models-cascading-deletion-raises-constraint-errors [Forced Update!]

2017-03-28 Thread mxmrlv
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-132-Models-cascading-deletion-raises-constraint-errors 
6fb690006 -> d35a11959 (forced update)


ARIA-132-Models-cascading-deletion-raises-constraint-errors


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

Branch: refs/heads/ARIA-132-Models-cascading-deletion-raises-constraint-errors
Commit: d35a11959662c4759678377d4e197cb12743510a
Parents: 07cbfcd
Author: max-orlov 
Authored: Sun Mar 26 14:13:47 2017 +0300
Committer: max-orlov 
Committed: Tue Mar 28 13:02:01 2017 +0300

--
 aria/.pylintrc  |   2 +-
 aria/modeling/orchestration.py  |  16 +
 aria/modeling/relationship.py   | 220 +++--
 aria/modeling/service_changes.py|  86 +-
 aria/modeling/service_common.py |   4 +
 aria/modeling/service_instance.py   | 795 --
 aria/modeling/service_template.py   | 803 +--
 tests/orchestrator/context/test_operation.py|   4 +-
 .../node-cellar/node-cellar.yaml|   1 -
 9 files changed, 1287 insertions(+), 644 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/d35a1195/aria/.pylintrc
--
diff --git a/aria/.pylintrc b/aria/.pylintrc
index 589402f..7222605 100644
--- a/aria/.pylintrc
+++ b/aria/.pylintrc
@@ -375,7 +375,7 @@ max-attributes=20
 min-public-methods=0
 
 # Maximum number of public methods for a class (see R0904).
-max-public-methods=20
+max-public-methods=50
 
 # Maximum number of boolean expressions in a if statement
 max-bool-expr=5

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/d35a1195/aria/modeling/orchestration.py
--
diff --git a/aria/modeling/orchestration.py b/aria/modeling/orchestration.py
index 2d58671..a13ae87 100644
--- a/aria/modeling/orchestration.py
+++ b/aria/modeling/orchestration.py
@@ -103,9 +103,17 @@ class ExecutionBase(ModelMixin):
 workflow_name = Column(Text)
 
 @declared_attr
+def logs(cls):
+return relationship.one_to_many(cls, 'log')
+
+@declared_attr
 def service(cls):
 return relationship.many_to_one(cls, 'service')
 
+@declared_attr
+def tasks(cls):
+return relationship.one_to_many(cls, 'task')
+
 # region foreign keys
 
 @declared_attr
@@ -185,6 +193,10 @@ class PluginBase(ModelMixin):
 
 __tablename__ = 'plugin'
 
+@declared_attr
+def tasks(cls):
+return relationship.one_to_many(cls, 'task')
+
 archive_name = Column(Text, nullable=False, index=True)
 distribution = Column(Text)
 distribution_release = Column(Text)
@@ -239,6 +251,10 @@ class TaskBase(ModelMixin):
 INFINITE_RETRIES = -1
 
 @declared_attr
+def logs(cls):
+return relationship.one_to_many(cls, 'log')
+
+@declared_attr
 def node(cls):
 return relationship.many_to_one(cls, 'node')
 

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/d35a1195/aria/modeling/relationship.py
--
diff --git a/aria/modeling/relationship.py b/aria/modeling/relationship.py
index 70691b3..1121dc0 100644
--- a/aria/modeling/relationship.py
+++ b/aria/modeling/relationship.py
@@ -27,8 +27,7 @@ from sqlalchemy import (
 from ..utils import formatting
 
 
-def foreign_key(other_table,
-nullable=False):
+def foreign_key(other_table, nullable=False):
 """
 Declare a foreign key property, which will also create a foreign key 
column in the table with
 the name of the property. By convention the property name should end in 
"_fk".
@@ -54,9 +53,7 @@ def foreign_key(other_table,
   nullable=nullable)
 
 
-def one_to_one_self(model_class,
-fk,
-relationship_kwargs=None):
+def one_to_one_self(model_class, fk):
 """
 Declare a one-to-one relationship property. The property value would be an 
instance of the same
 model.
@@ -69,12 +66,8 @@ def one_to_one_self(model_class,
 :type model_class: type
 :param fk: Foreign key name
 :type fk: basestring
-:param relationship_kwargs: Extra kwargs for SQLAlchemy ``relationship``
-:type relationship_kwargs: {}
 """
 
-relationship_kwargs = relationship_kwargs or {}
-
 remote_side = '{model_class}.{remote_column}'.format(
 

[jira] [Commented] (ARIA-132) Models cascading deletion raises constraint errors

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

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

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

Commit d35a11959662c4759678377d4e197cb12743510a in incubator-ariatosca's branch 
refs/heads/ARIA-132-Models-cascading-deletion-raises-constraint-errors from 
[~Mxmrlv]
[ https://git-wip-us.apache.org/repos/asf?p=incubator-ariatosca.git;h=d35a119 ]

ARIA-132-Models-cascading-deletion-raises-constraint-errors


> Models cascading deletion raises constraint errors
> --
>
> Key: ARIA-132
> URL: https://issues.apache.org/jira/browse/ARIA-132
> Project: AriaTosca
>  Issue Type: Bug
>Reporter: Ran Ziv
>Assignee: Maxim Orlov
>Priority: Critical
>
> Models whose deletion should cascade to additional models currently don't 
> behave this way and instead raise constraint errors



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


incubator-ariatosca git commit: Add is_active and is_ended methods to the Execution model [Forced Update!]

2017-03-28 Thread avia
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-133-add-is-active-and-is-ended-to-execution-model a5ae00221 
-> 5699aba1d (forced update)


Add is_active and is_ended methods to the Execution model

We are adding these methods so it will be easier to filter executions
from the storage according to their status, and to not make use of the
`status` constants outside of the Execution 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/5699aba1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/5699aba1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/5699aba1

Branch: refs/heads/ARIA-133-add-is-active-and-is-ended-to-execution-model
Commit: 5699aba1d803f18aa49089caf0ff48e436d3c811
Parents: 07cbfcd
Author: Avia Efrat 
Authored: Tue Mar 28 12:51:42 2017 +0300
Committer: Avia Efrat 
Committed: Tue Mar 28 12:55:56 2017 +0300

--
 aria/modeling/orchestration.py | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/5699aba1/aria/modeling/orchestration.py
--
diff --git a/aria/modeling/orchestration.py b/aria/modeling/orchestration.py
index 2d58671..fe65a94 100644
--- a/aria/modeling/orchestration.py
+++ b/aria/modeling/orchestration.py
@@ -69,7 +69,6 @@ class ExecutionBase(ModelMixin):
 
 STATES = [TERMINATED, FAILED, CANCELLED, PENDING, STARTED, CANCELLING, 
FORCE_CANCELLING]
 END_STATES = [TERMINATED, FAILED, CANCELLED]
-ACTIVE_STATES = [state for state in STATES if state not in END_STATES]
 
 VALID_TRANSITIONS = {
 PENDING: [STARTED, CANCELLED],
@@ -102,6 +101,12 @@ class ExecutionBase(ModelMixin):
 status = Column(Enum(*STATES, name='execution_status'), default=PENDING)
 workflow_name = Column(Text)
 
+def is_ended(self):
+return self.status in self.END_STATES
+
+def is_active(self):
+return not self.is_ended()
+
 @declared_attr
 def service(cls):
 return relationship.many_to_one(cls, 'service')



[jira] [Commented] (ARIA-48) ARIA CLI

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

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

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

Commit 2f2751c3b850d9a199b200f505e17f2d6cebbe20 in incubator-ariatosca's branch 
refs/heads/ARIA-48-aria-cli from [~ran]
[ https://git-wip-us.apache.org/repos/asf?p=incubator-ariatosca.git;h=2f2751c ]

ARIA-48 cli


> ARIA CLI
> 
>
> Key: ARIA-48
> URL: https://issues.apache.org/jira/browse/ARIA-48
> Project: AriaTosca
>  Issue Type: Story
>Reporter: Ran Ziv
>Assignee: Ran Ziv
>
> Create a CLI for ARIA (based on Cloudify's CLI)



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


[3/3] incubator-ariatosca git commit: ARIA-48 cli

2017-03-28 Thread ran
ARIA-48 cli


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

Branch: refs/heads/ARIA-48-aria-cli
Commit: 2f2751c3b850d9a199b200f505e17f2d6cebbe20
Parents: 07cbfcd
Author: Ran Ziv 
Authored: Tue Mar 28 12:17:46 2017 +0300
Committer: Ran Ziv 
Committed: Tue Mar 28 12:17:46 2017 +0300

--
 aria/__init__.py|   2 +-
 aria/cli/VERSION|   3 +
 aria/cli/args_parser.py | 269 -
 aria/cli/cli.py | 113 
 aria/cli/cli/__init__.py|  14 +
 aria/cli/cli/aria.py| 473 
 aria/cli/cli/helptexts.py   |  65 +++
 aria/cli/colorful_event.py  | 152 ++
 aria/cli/commands.py| 546 ---
 aria/cli/commands/__init__.py   |  14 +
 aria/cli/commands/executions.py | 173 ++
 aria/cli/commands/logs.py   |  64 +++
 aria/cli/commands/node_templates.py | 101 
 aria/cli/commands/nodes.py  |  93 
 aria/cli/commands/plugins.py| 145 +
 aria/cli/commands/service_templates.py  | 204 +++
 aria/cli/commands/services.py   | 172 ++
 aria/cli/commands/workflows.py  | 107 
 aria/cli/config.py  |  46 --
 aria/cli/config/__init__.py |  14 +
 aria/cli/config/config.py   |  70 +++
 aria/cli/config/config_template.yaml|  12 +
 aria/cli/constants.py   |  18 +
 aria/cli/csar.py|  11 +-
 aria/cli/dry.py |  88 ---
 aria/cli/env.py | 118 
 aria/cli/exceptions.py  |  54 +-
 aria/cli/inputs.py  | 118 
 aria/cli/logger.py  | 110 
 aria/cli/main.py|  71 +++
 aria/cli/service_template_utils.py  | 140 +
 aria/cli/storage.py |  95 
 aria/cli/table.py   |  90 +++
 aria/cli/utils.py   | 152 ++
 aria/core.py| 115 
 aria/modeling/exceptions.py |  18 +
 aria/modeling/orchestration.py  |   9 +-
 aria/modeling/service_changes.py|  10 +-
 aria/modeling/service_instance.py   |  16 +-
 aria/modeling/service_template.py   |  12 +-
 aria/modeling/utils.py  |  73 ++-
 aria/orchestrator/context/workflow.py   |  19 +-
 aria/orchestrator/runner.py | 101 
 aria/orchestrator/workflow_runner.py| 132 +
 aria/orchestrator/workflows/builtin/__init__.py |   1 +
 aria/utils/archive.py   |  63 +++
 aria/utils/conversion.py|  31 ++
 aria/utils/exceptions.py|  11 +
 aria/utils/file.py  |  13 +
 aria/utils/formatting.py|  43 ++
 aria/utils/threading.py |  24 +
 requirements.in |   5 +
 setup.py|   2 +-
 tests/utils/test_threading.py   |  35 ++
 54 files changed, 3293 insertions(+), 1357 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/2f2751c3/aria/__init__.py
--
diff --git a/aria/__init__.py b/aria/__init__.py
index b9251d5..df75b1e 100644
--- a/aria/__init__.py
+++ b/aria/__init__.py
@@ -84,6 +84,6 @@ def application_resource_storage(api, api_kwargs=None, 
initiator=None, initiator
 
 return storage.ResourceStorage(api_cls=api,
api_kwargs=api_kwargs,
-   items=['blueprint', 'deployment', 'plugin'],
+   items=['service_template', 'service', 
'plugin'],
initiator=initiator,
initiator_kwargs=initiator_kwargs)

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/2f2751c3/aria/cli/VERSION
--
diff --git a/aria/cli/VERSION 

[2/3] incubator-ariatosca git commit: ARIA-48 cli

2017-03-28 Thread ran
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/2f2751c3/aria/cli/commands/service_templates.py
--
diff --git a/aria/cli/commands/service_templates.py 
b/aria/cli/commands/service_templates.py
new file mode 100644
index 000..0f163d5
--- /dev/null
+++ b/aria/cli/commands/service_templates.py
@@ -0,0 +1,204 @@
+# 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 os
+import json
+
+from .. import utils
+from .. import csar
+from ..cli import aria
+from .. import service_template_utils
+from ..table import print_data
+from ..exceptions import AriaCliError
+from ...core import Core
+from ...exceptions import AriaException
+
+
+DESCRIPTION_LIMIT = 20
+SERVICE_TEMPLATE_COLUMNS = \
+['id', 'name', 'main_file_name', 'created_at', 'updated_at']
+
+
+@aria.group(name='service-templates')
+@aria.options.verbose()
+def service_templates():
+"""Handle service templates on the manager
+"""
+pass
+
+
+@service_templates.command(name='show',
+   short_help='Show service template information')
+@aria.argument('service-template-id')
+@aria.options.verbose()
+@aria.pass_model_storage
+@aria.pass_logger
+def show(service_template_id, model_storage, logger):
+"""Show information for a specific service templates
+
+`SERVICE_TEMPLATE_ID` is the id of the service template to show 
information on.
+"""
+logger.info('Showing service template {0}...'.format(service_template_id))
+service_template = model_storage.service_template.get(service_template_id)
+services = [d.to_dict() for d in service_template.services]
+service_template_dict = service_template.to_dict()
+service_template_dict['#services'] = len(services)
+columns = SERVICE_TEMPLATE_COLUMNS + ['#services']
+print_data(columns, service_template_dict, 'Service-template:', 
max_width=50)
+
+logger.info('Description:')
+
logger.info('{0}\n'.format(service_template_dict['description'].encode('UTF-8') 
or ''))
+
+logger.info('Existing services:')
+logger.info('{0}\n'.format(json.dumps([d['name'] for d in services])))
+
+
+@service_templates.command(name='list',
+   short_help='List service templates')
+@aria.options.sort_by()
+@aria.options.descending
+@aria.options.verbose()
+@aria.pass_model_storage
+@aria.pass_logger
+def list(sort_by, descending, model_storage, logger):
+"""List all service templates
+"""
+def trim_description(service_template):
+if service_template['description'] is not None:
+if len(service_template['description']) >= DESCRIPTION_LIMIT:
+service_template['description'] = '{0}..'.format(
+service_template['description'][:DESCRIPTION_LIMIT - 2])
+else:
+service_template['description'] = ''
+return service_template
+
+logger.info('Listing all service templates...')
+service_templates = [trim_description(b.to_dict()) for b in 
model_storage.service_template.list(
+sort=utils.storage_sort_param(sort_by, descending))]
+print_data(SERVICE_TEMPLATE_COLUMNS, service_templates, 'Service 
templates:')
+
+
+@service_templates.command(name='store',
+   short_help='Store a service template')
+@aria.argument('service-template-path')
+@aria.argument('service-template-name')
+@aria.options.verbose()
+@aria.pass_model_storage
+@aria.pass_resource_storage
+@aria.pass_plugin_manager
+@aria.pass_logger
+def store(service_template_path, service_template_name, model_storage, 
resource_storage,
+  plugin_manager, logger):
+"""Store a service template
+
+`SERVICE_TEMPLATE_PATH` is the path of the service template to store.
+
+`SERVICE_TEMPLATE_NAME` is the name of the service template to store.
+"""
+logger.info('Storing service template 
{0}...'.format(service_template_name))
+
+service_template_path = service_template_utils.get(service_template_path)
+core = Core(model_storage, resource_storage, plugin_manager)
+core.create_service_template(service_template_path,
+ os.path.dirname(service_template_path),
+   

[1/3] incubator-ariatosca git commit: ARIA-48 cli

2017-03-28 Thread ran
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-48-aria-cli [created] 2f2751c3b


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/2f2751c3/aria/orchestrator/runner.py
--
diff --git a/aria/orchestrator/runner.py b/aria/orchestrator/runner.py
deleted file mode 100644
index f1633fa..000
--- a/aria/orchestrator/runner.py
+++ /dev/null
@@ -1,101 +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.
-
-"""
-Workflow runner
-"""
-
-import tempfile
-import os
-
-from .context.workflow import WorkflowContext
-from .workflows.core.engine import Engine
-from .workflows.executor.thread import ThreadExecutor
-from ..storage import (
-sql_mapi,
-filesystem_rapi,
-)
-from .. import (
-application_model_storage,
-application_resource_storage
-)
-
-
-class Runner(object):
-"""
-Runs workflows on a deployment. By default uses temporary storage (either 
on disk or in memory)
-but can also be used with existing storage.
-
-Handles the initialization of the storage engine and provides convenience 
methods for
-sub-classes to create tasks.
-
-:param path: path to Sqlite database file; use '' (the default) to use a 
temporary file,
- and None to use an in-memory database
-:type path: string
-"""
-
-def __init__(self, workflow_name, workflow_fn, inputs, 
initialize_model_storage_fn,
- service_id_fn, storage_path='', is_storage_temporary=True):
-if storage_path == '':
-# Temporary file storage
-the_file, storage_path = tempfile.mkstemp(suffix='.db', 
prefix='aria-')
-os.close(the_file)
-
-self._storage_path = storage_path
-self._storage_dir = os.path.dirname(storage_path)
-self._storage_name = os.path.basename(storage_path)
-self._is_storage_temporary = is_storage_temporary
-
-workflow_context = self.create_workflow_context(workflow_name, 
initialize_model_storage_fn,
-service_id_fn)
-
-tasks_graph = workflow_fn(ctx=workflow_context, **inputs)
-
-self._engine = Engine(
-executor=ThreadExecutor(),
-workflow_context=workflow_context,
-tasks_graph=tasks_graph)
-
-def run(self):
-try:
-self._engine.execute()
-finally:
-self.cleanup()
-
-def create_workflow_context(self,
-workflow_name,
-initialize_model_storage_fn,
-service_id_fn):
-self.cleanup()
-model_storage = application_model_storage(
-sql_mapi.SQLAlchemyModelAPI,
-initiator_kwargs=dict(base_dir=self._storage_dir, 
filename=self._storage_name))
-if initialize_model_storage_fn:
-initialize_model_storage_fn(model_storage)
-resource_storage = application_resource_storage(
-filesystem_rapi.FileSystemResourceAPI, 
api_kwargs=dict(directory='.'))
-return WorkflowContext(
-name=workflow_name,
-model_storage=model_storage,
-resource_storage=resource_storage,
-service_id=service_id_fn(),
-workflow_name=self.__class__.__name__,
-task_max_attempts=1,
-task_retry_interval=1)
-
-def cleanup(self):
-if (self._is_storage_temporary and (self._storage_path is not None) and
-os.path.isfile(self._storage_path)):
-os.remove(self._storage_path)

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/2f2751c3/aria/orchestrator/workflow_runner.py
--
diff --git a/aria/orchestrator/workflow_runner.py 
b/aria/orchestrator/workflow_runner.py
new file mode 100644
index 000..3d790a8
--- /dev/null
+++ b/aria/orchestrator/workflow_runner.py
@@ -0,0 +1,132 @@
+# 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.

[jira] [Created] (ARIA-133) Add is_active and is_ended methods to the Execution model

2017-03-28 Thread Avia Efrat (JIRA)
Avia Efrat created ARIA-133:
---

 Summary: Add is_active and is_ended methods to the Execution model
 Key: ARIA-133
 URL: https://issues.apache.org/jira/browse/ARIA-133
 Project: AriaTosca
  Issue Type: Task
Reporter: Avia Efrat
Assignee: Avia Efrat
Priority: Minor


We are adding these functions so it will be easier to filter executions from 
the storage according to their status, and to not make use of the `status` 
constants outside of the Execution model.



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


[2/4] incubator-ariatosca git commit: ARIA-120-Builtin-workflows-relationship-operations-execution-order

2017-03-28 Thread mxmrlv
ARIA-120-Builtin-workflows-relationship-operations-execution-order


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

Branch: refs/heads/ARIA-132-Models-cascading-deletion-raises-constraint-errors
Commit: 07cbfcdabc207452acda33fa9f1ababf97e5d260
Parents: 0e10793
Author: max-orlov 
Authored: Mon Mar 13 16:35:10 2017 +0200
Committer: max-orlov 
Committed: Tue Mar 28 11:18:19 2017 +0300

--
 aria/modeling/relationship.py   |   2 +-
 aria/orchestrator/workflows/api/task.py |  29 +++--
 aria/orchestrator/workflows/builtin/utils.py|  60 +++--
 .../orchestrator/workflows/builtin/workflows.py | 102 +--
 .../workflows/core/events_handler.py|   7 +-
 aria/orchestrator/workflows/core/task.py|   2 +
 tests/mock/context.py   |   7 +-
 tests/mock/models.py| 123 ++-
 tests/mock/topology.py  |  41 +--
 tests/modeling/test_models.py   |  30 +++--
 .../orchestrator/workflows/builtin/__init__.py  |  65 --
 .../orchestrator/workflows/builtin/test_heal.py |   7 +-
 .../workflows/builtin/test_install.py   |  15 ++-
 .../workflows/builtin/test_uninstall.py |  15 ++-
 .../workflows/executor/test_executor.py |   2 +
 .../workflows/executor/test_process_executor.py |   2 +
 16 files changed, 323 insertions(+), 186 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/07cbfcda/aria/modeling/relationship.py
--
diff --git a/aria/modeling/relationship.py b/aria/modeling/relationship.py
index ef2bcdd..70691b3 100644
--- a/aria/modeling/relationship.py
+++ b/aria/modeling/relationship.py
@@ -308,7 +308,7 @@ def many_to_many(model_class,
 if prefix is not None:
 secondary_table = '{0}_{1}'.format(prefix, secondary_table)
 if other_property is None:
-other_property = '{0}_{1}'.format(prefix, this_table)
+other_property = '{0}_{1}'.format(prefix, 
formatting.pluralize(this_table))
 
 backref_kwargs = backref_kwargs or {}
 backref_kwargs.setdefault('uselist', True)

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/07cbfcda/aria/orchestrator/workflows/api/task.py
--
diff --git a/aria/orchestrator/workflows/api/task.py 
b/aria/orchestrator/workflows/api/task.py
index 009b81c..f49ec2e 100644
--- a/aria/orchestrator/workflows/api/task.py
+++ b/aria/orchestrator/workflows/api/task.py
@@ -90,6 +90,8 @@ class OperationTask(BaseTask):
 self.ignore_failure = (self.workflow_context._task_ignore_failure
if ignore_failure is None else ignore_failure)
 self.runs_on = runs_on
+self.interface_name = interface_name
+self.operation_name = operation_name
 
 # Wrap inputs
 inputs = copy.deepcopy(inputs) if inputs else {}
@@ -101,11 +103,11 @@ class OperationTask(BaseTask):
 # model, because they are different from the operation inputs. If we 
do this, then the two
 # kinds of inputs should *not* be merged here.
 
-operation = self._get_operation(interface_name, operation_name)
+operation = self._get_operation()
 if operation is None:
 raise exceptions.OperationNotFoundException(
 'Could not find operation "{0}" on interface "{1}" for {2} 
"{3}"'
-.format(operation_name, interface_name, actor_type, 
actor.name))
+.format(self.operation_name, self.interface_name, actor_type, 
actor.name))
 
 self.plugin = None
 if operation.plugin_specification:
@@ -113,15 +115,26 @@ class OperationTask(BaseTask):
 if self.plugin is None:
 raise exceptions.PluginNotFoundException(
 'Could not find plugin of operation "{0}" on interface 
"{1}" for {2} "{3}"'
-.format(operation_name, interface_name, actor_type, 
actor.name))
+.format(self.operation_name, self.interface_name, 
actor_type, actor.name))
 
 self.implementation = operation.implementation
 self.inputs = OperationTask._merge_inputs(operation.inputs, inputs)
 
 self.name = OperationTask.NAME_FORMAT.format(type=actor_type,
  name=actor.name,
- 

[jira] [Commented] (ARIA-120) Builtin workflows have wrong execution order in relationship operations

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

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

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

Commit 07cbfcdabc207452acda33fa9f1ababf97e5d260 in incubator-ariatosca's branch 
refs/heads/ARIA-132-Models-cascading-deletion-raises-constraint-errors from 
[~Mxmrlv]
[ https://git-wip-us.apache.org/repos/asf?p=incubator-ariatosca.git;h=07cbfcd ]

ARIA-120-Builtin-workflows-relationship-operations-execution-order


> Builtin workflows have wrong execution order in relationship operations
> ---
>
> Key: ARIA-120
> URL: https://issues.apache.org/jira/browse/ARIA-120
> Project: AriaTosca
>  Issue Type: Bug
>Reporter: Maxim Orlov
>Assignee: Maxim Orlov
> Fix For: 0.1.0
>
>
> The execution order of relationships based operations of a node is wrong. 
> In the current state, all of the pre_configure source operations are executed 
> before any pre_configure target operations are executed.
> In the desired state, each source-target operations of a single relationship 
> are executed side by side (concurrently), and only once both are done, the 
> execution of the next relationship's source-target operations commences.



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


[jira] [Commented] (ARIA-126) Update state of nodes during normative lifecycle execution

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

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

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

Commit 0e107933e68ec8a6fbc690a02d59e2fca900a540 in incubator-ariatosca's branch 
refs/heads/ARIA-132-Models-cascading-deletion-raises-constraint-errors from 
[~avia]
[ https://git-wip-us.apache.org/repos/asf?p=incubator-ariatosca.git;h=0e10793 ]

ARIA-126 Add node states

1. The states are described in section 3.3.1 of the TOSCA spec.

2. The state is changed if a standard lifecycle operation runs of the
node, as described in sections 5.7.4.1, 5.7.4.4.1, and 5.7.4.4.2 of the TOSCA 
spec.

3. We did not address the 'error' state yet.
This state is defined as part of the possible node states in the model, but 
currently no execution path leads to setting a node's state to 'error'.

4. No validation of state transiontions.
For example, we do not validate if a node goes from 'created'
to 'started' without going through the 'configured' state in between.


> Update state of nodes during normative lifecycle execution
> --
>
> Key: ARIA-126
> URL: https://issues.apache.org/jira/browse/ARIA-126
> Project: AriaTosca
>  Issue Type: Story
>Reporter: Avia Efrat
>Assignee: Avia Efrat
> Fix For: 0.1.0
>
>
> Update a node's state while preforming tasks that reflect changes to its 
> state.
> Currently, this will be hardcoded specifically for lifecycle operations, i.e. 
> `created`, `configured`, `started` etc.



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


[4/4] incubator-ariatosca git commit: reorded model representation order of relationships(comments)

2017-03-28 Thread mxmrlv
reorded model representation order of relationships(comments)


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

Branch: refs/heads/ARIA-132-Models-cascading-deletion-raises-constraint-errors
Commit: 6fb690006b034a3bf09e07ea63b01c6dd9286c98
Parents: 6e8391b
Author: max-orlov 
Authored: Mon Mar 27 14:36:37 2017 +0300
Committer: max-orlov 
Committed: Tue Mar 28 11:26:07 2017 +0300

--
 aria/modeling/relationship.py |  39 +-
 aria/modeling/service_changes.py  |  87 +++-
 aria/modeling/service_instance.py | 814 -
 aria/modeling/service_template.py | 778 ---
 4 files changed, 1100 insertions(+), 618 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/6fb69000/aria/modeling/relationship.py
--
diff --git a/aria/modeling/relationship.py b/aria/modeling/relationship.py
index 63b13c8..1121dc0 100644
--- a/aria/modeling/relationship.py
+++ b/aria/modeling/relationship.py
@@ -78,12 +78,14 @@ def one_to_one_self(model_class, fk):
 model_class=model_class.__name__,
 column=fk
 )
-
-return relationship(
-_get_class_for_table(model_class, model_class.__tablename__).__name__,
-primaryjoin=primaryjoin,
-remote_side=remote_side,
-post_update=True,
+return _relationship(
+model_class,
+model_class.__tablename__,
+relationship_kwargs={
+'primaryjoin': primaryjoin,
+'remote_side': remote_side,
+'post_update': True
+}
 )
 
 
@@ -108,9 +110,8 @@ def one_to_many_self(model_class, fk, dict_key=None):
 model_class,
 model_class.__tablename__,
 relationship_kwargs={
-'remote_side': 
'{model_class}.{remote_column}'.format(model_class=model_class.__name__,
-  
remote_column=fk
- )
+'remote_side': '{model_class}.{remote_column}'.format(
+model_class=model_class.__name__, remote_column=fk)
 },
 back_populates=False,
 dict_key=dict_key
@@ -144,6 +145,8 @@ def one_to_one(model_class,
false to disable
 :type back_populates: basestring|bool
 """
+if back_populates is None:
+back_populates = model_class.__tablename__
 
 return _relationship(model_class,
  other_table,
@@ -156,7 +159,7 @@ def one_to_many(model_class,
 child_table,
 child_fk=None,
 dict_key=None,
-child_property=None):
+back_populates=None):
 """
 Declare a one-to-many relationship property. The property value would be a 
list or dict of
 instances of the child table's model.
@@ -177,14 +180,16 @@ def one_to_many(model_class,
 :param dict_key: If set the value will be a dict with this key as the dict 
key; otherwise will
  be a list
 :type dict_key: basestring
-:param child_property: Override name of matching many-to-one property at 
child table; set to
+:param back_populates: Override name of matching many-to-one property at 
child table; set to
false to disable
-:type child_property: basestring|bool
+:type back_populates: basestring|bool
 """
+if back_populates is None:
+back_populates = model_class.__tablename__
 return _relationship(
 model_class,
 child_table,
-relationship_kwargs={'back_populates': child_property or 
model_class.__tablename__},
+back_populates=back_populates,
 other_fk=child_fk,
 dict_key=dict_key)
 
@@ -217,14 +222,12 @@ def many_to_one(model_class,
 false to disable
 :type back_populates: basestring|bool
 """
-relationship_kwargs = {}
-if back_populates is not False:
-relationship_kwargs['back_populates'] = back_populates or \
-
formatting.pluralize(model_class.__tablename__)
+if back_populates is None:
+back_populates = formatting.pluralize(model_class.__tablename__)
 
 return _relationship(model_class,
  parent_table,
- relationship_kwargs=relationship_kwargs,
+ back_populates=back_populates,
  fk=fk,
 

[jira] [Commented] (ARIA-132) Models cascading deletion raises constraint errors

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

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

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

Commit 6e8391b15cd58b331752ccc49e151a9fd6a821fb in incubator-ariatosca's branch 
refs/heads/ARIA-132-Models-cascading-deletion-raises-constraint-errors from 
[~Mxmrlv]
[ https://git-wip-us.apache.org/repos/asf?p=incubator-ariatosca.git;h=6e8391b ]

ARIA-132-Models-cascading-deletion-raises-constraint-errors


> Models cascading deletion raises constraint errors
> --
>
> Key: ARIA-132
> URL: https://issues.apache.org/jira/browse/ARIA-132
> Project: AriaTosca
>  Issue Type: Bug
>Reporter: Ran Ziv
>Assignee: Maxim Orlov
>Priority: Critical
>
> Models whose deletion should cascade to additional models currently don't 
> behave this way and instead raise constraint errors



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


[1/4] incubator-ariatosca git commit: ARIA-126 Add node states [Forced Update!]

2017-03-28 Thread mxmrlv
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-132-Models-cascading-deletion-raises-constraint-errors 
3220d4701 -> 6fb690006 (forced update)


ARIA-126 Add node states

1. The states are described in section 3.3.1 of the TOSCA spec.

2. The state is changed if a standard lifecycle operation runs of the
node, as described in sections 5.7.4.1, 5.7.4.4.1, and 5.7.4.4.2 of the TOSCA 
spec.

3. We did not address the 'error' state yet.
This state is defined as part of the possible node states in the model, but 
currently no execution path leads to setting a node's state to 'error'.

4. No validation of state transiontions.
For example, we do not validate if a node goes from 'created'
to 'started' without going through the 'configured' state in between.


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

Branch: refs/heads/ARIA-132-Models-cascading-deletion-raises-constraint-errors
Commit: 0e107933e68ec8a6fbc690a02d59e2fca900a540
Parents: b3cf69a
Author: Avia Efrat 
Authored: Wed Mar 22 17:19:58 2017 +0200
Committer: Avia Efrat 
Committed: Mon Mar 27 16:38:52 2017 +0300

--
 aria/modeling/service_instance.py   |  52 ++-
 aria/modeling/service_template.py   |   2 +-
 .../workflows/core/events_handler.py|  18 ++-
 tests/mock/models.py|   4 +-
 tests/modeling/test_mixins.py   |   2 +-
 tests/modeling/test_models.py   |  12 +-
 .../orchestrator/workflows/core/test_events.py  | 147 +++
 7 files changed, 222 insertions(+), 15 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/0e107933/aria/modeling/service_instance.py
--
diff --git a/aria/modeling/service_instance.py 
b/aria/modeling/service_instance.py
index f120734..1e18db0 100644
--- a/aria/modeling/service_instance.py
+++ b/aria/modeling/service_instance.py
@@ -18,7 +18,8 @@
 from sqlalchemy import (
 Column,
 Text,
-Integer
+Integer,
+Enum,
 )
 from sqlalchemy import DateTime
 from sqlalchemy.ext.associationproxy import association_proxy
@@ -322,8 +323,8 @@ class NodeBase(InstanceModelMixin): # pylint: 
disable=too-many-public-methods
 :vartype runtime_properties: {}
 :ivar scaling_groups: ??
 :vartype scaling_groups: []
-:ivar state: ??
-:vartype state: basestring
+:ivar state: The state of the node, according to to the TOSCA-defined node 
states
+:vartype state: string
 :ivar version: Used by `aria.storage.instrumentation`
 :vartype version: int
 
@@ -347,6 +348,49 @@ class NodeBase(InstanceModelMixin): # pylint: 
disable=too-many-public-methods
   'node_template_fk',
   'service_name']
 
+INITIAL = 'initial'
+CREATING = 'creating'
+CREATED = 'created'
+CONFIGURING = 'configuring'
+CONFIGURED = 'configured'
+STARTING = 'starting'
+STARTED = 'started'
+STOPPING = 'stopping'
+DELETING = 'deleting'
+# 'deleted' isn't actually part of the tosca spec, since according the 
description of the
+# 'deleting' state: "Node is transitioning from its current state to one 
where it is deleted and
+#  its state is no longer tracked by the instance model."
+# However, we prefer to be able to retrieve information about deleted 
nodes, so we chose to add
+# this 'deleted' state to enable us to do so.
+DELETED = 'deleted'
+ERROR = 'error'
+
+STATES = [INITIAL, CREATING, CREATED, CONFIGURING, CONFIGURED, STARTING, 
STARTED, STOPPING,
+  DELETING, DELETED, ERROR]
+
+_op_to_state = {'create': {'transitional': CREATING, 'finished': CREATED},
+'configure': {'transitional': CONFIGURING, 'finished': 
CONFIGURED},
+'start': {'transitional': STARTING, 'finished': STARTED},
+'stop': {'transitional': STOPPING, 'finished': CONFIGURED},
+'delete': {'transitional': DELETING, 'finished': DELETED}}
+
+@classmethod
+def determine_state(cls, op_name, is_transitional):
+""" :returns the state the node should be in as a result of running the
+operation on this node.
+
+e.g. if we are running 
tosca.interfaces.node.lifecycle.Standard.create, then
+the resulting state should either 'creating' (if the task just 
started) or 'created'
+(if the task ended).
+
+If the operation is not a standard 

[jira] [Closed] (ARIA-120) Builtin workflows have wrong execution order in relationship operations

2017-03-28 Thread Maxim Orlov (JIRA)

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

Maxim Orlov closed ARIA-120.

   Resolution: Fixed
 Assignee: Maxim Orlov
Fix Version/s: 0.1.0

> Builtin workflows have wrong execution order in relationship operations
> ---
>
> Key: ARIA-120
> URL: https://issues.apache.org/jira/browse/ARIA-120
> Project: AriaTosca
>  Issue Type: Bug
>Reporter: Maxim Orlov
>Assignee: Maxim Orlov
> Fix For: 0.1.0
>
>
> The execution order of relationships based operations of a node is wrong. 
> In the current state, all of the pre_configure source operations are executed 
> before any pre_configure target operations are executed.
> In the desired state, each source-target operations of a single relationship 
> are executed side by side (concurrently), and only once both are done, the 
> execution of the next relationship's source-target operations commences.



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


[jira] [Commented] (ARIA-120) Builtin workflows have wrong execution order in relationship operations

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

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

ASF GitHub Bot commented on ARIA-120:
-

Github user asfgit closed the pull request at:

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


> Builtin workflows have wrong execution order in relationship operations
> ---
>
> Key: ARIA-120
> URL: https://issues.apache.org/jira/browse/ARIA-120
> Project: AriaTosca
>  Issue Type: Bug
>Reporter: Maxim Orlov
>
> The execution order of relationships based operations of a node is wrong. 
> In the current state, all of the pre_configure source operations are executed 
> before any pre_configure target operations are executed.
> In the desired state, each source-target operations of a single relationship 
> are executed side by side (concurrently), and only once both are done, the 
> execution of the next relationship's source-target operations commences.



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


[jira] [Commented] (ARIA-120) Builtin workflows have wrong execution order in relationship operations

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

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

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

Commit 07cbfcdabc207452acda33fa9f1ababf97e5d260 in incubator-ariatosca's branch 
refs/heads/master from [~Mxmrlv]
[ https://git-wip-us.apache.org/repos/asf?p=incubator-ariatosca.git;h=07cbfcd ]

ARIA-120-Builtin-workflows-relationship-operations-execution-order


> Builtin workflows have wrong execution order in relationship operations
> ---
>
> Key: ARIA-120
> URL: https://issues.apache.org/jira/browse/ARIA-120
> Project: AriaTosca
>  Issue Type: Bug
>Reporter: Maxim Orlov
>
> The execution order of relationships based operations of a node is wrong. 
> In the current state, all of the pre_configure source operations are executed 
> before any pre_configure target operations are executed.
> In the desired state, each source-target operations of a single relationship 
> are executed side by side (concurrently), and only once both are done, the 
> execution of the next relationship's source-target operations commences.



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


incubator-ariatosca git commit: ARIA-120-Builtin-workflows-relationship-operations-execution-order

2017-03-28 Thread mxmrlv
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/master 0e107933e -> 07cbfcdab


ARIA-120-Builtin-workflows-relationship-operations-execution-order


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

Branch: refs/heads/master
Commit: 07cbfcdabc207452acda33fa9f1ababf97e5d260
Parents: 0e10793
Author: max-orlov 
Authored: Mon Mar 13 16:35:10 2017 +0200
Committer: max-orlov 
Committed: Tue Mar 28 11:18:19 2017 +0300

--
 aria/modeling/relationship.py   |   2 +-
 aria/orchestrator/workflows/api/task.py |  29 +++--
 aria/orchestrator/workflows/builtin/utils.py|  60 +++--
 .../orchestrator/workflows/builtin/workflows.py | 102 +--
 .../workflows/core/events_handler.py|   7 +-
 aria/orchestrator/workflows/core/task.py|   2 +
 tests/mock/context.py   |   7 +-
 tests/mock/models.py| 123 ++-
 tests/mock/topology.py  |  41 +--
 tests/modeling/test_models.py   |  30 +++--
 .../orchestrator/workflows/builtin/__init__.py  |  65 --
 .../orchestrator/workflows/builtin/test_heal.py |   7 +-
 .../workflows/builtin/test_install.py   |  15 ++-
 .../workflows/builtin/test_uninstall.py |  15 ++-
 .../workflows/executor/test_executor.py |   2 +
 .../workflows/executor/test_process_executor.py |   2 +
 16 files changed, 323 insertions(+), 186 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/07cbfcda/aria/modeling/relationship.py
--
diff --git a/aria/modeling/relationship.py b/aria/modeling/relationship.py
index ef2bcdd..70691b3 100644
--- a/aria/modeling/relationship.py
+++ b/aria/modeling/relationship.py
@@ -308,7 +308,7 @@ def many_to_many(model_class,
 if prefix is not None:
 secondary_table = '{0}_{1}'.format(prefix, secondary_table)
 if other_property is None:
-other_property = '{0}_{1}'.format(prefix, this_table)
+other_property = '{0}_{1}'.format(prefix, 
formatting.pluralize(this_table))
 
 backref_kwargs = backref_kwargs or {}
 backref_kwargs.setdefault('uselist', True)

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/07cbfcda/aria/orchestrator/workflows/api/task.py
--
diff --git a/aria/orchestrator/workflows/api/task.py 
b/aria/orchestrator/workflows/api/task.py
index 009b81c..f49ec2e 100644
--- a/aria/orchestrator/workflows/api/task.py
+++ b/aria/orchestrator/workflows/api/task.py
@@ -90,6 +90,8 @@ class OperationTask(BaseTask):
 self.ignore_failure = (self.workflow_context._task_ignore_failure
if ignore_failure is None else ignore_failure)
 self.runs_on = runs_on
+self.interface_name = interface_name
+self.operation_name = operation_name
 
 # Wrap inputs
 inputs = copy.deepcopy(inputs) if inputs else {}
@@ -101,11 +103,11 @@ class OperationTask(BaseTask):
 # model, because they are different from the operation inputs. If we 
do this, then the two
 # kinds of inputs should *not* be merged here.
 
-operation = self._get_operation(interface_name, operation_name)
+operation = self._get_operation()
 if operation is None:
 raise exceptions.OperationNotFoundException(
 'Could not find operation "{0}" on interface "{1}" for {2} 
"{3}"'
-.format(operation_name, interface_name, actor_type, 
actor.name))
+.format(self.operation_name, self.interface_name, actor_type, 
actor.name))
 
 self.plugin = None
 if operation.plugin_specification:
@@ -113,15 +115,26 @@ class OperationTask(BaseTask):
 if self.plugin is None:
 raise exceptions.PluginNotFoundException(
 'Could not find plugin of operation "{0}" on interface 
"{1}" for {2} "{3}"'
-.format(operation_name, interface_name, actor_type, 
actor.name))
+.format(self.operation_name, self.interface_name, 
actor_type, actor.name))
 
 self.implementation = operation.implementation
 self.inputs = OperationTask._merge_inputs(operation.inputs, inputs)
 
 self.name = OperationTask.NAME_FORMAT.format(type=actor_type,
  name=actor.name,
- 

[GitHub] incubator-ariatosca pull request #77: ARIA-120-Builtin-workflows-relationshi...

2017-03-28 Thread asfgit
Github user asfgit closed the pull request at:

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


---
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 Push Summary

2017-03-28 Thread avia
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-98-update-dependencies-versions [deleted] e282f23f6


[incubator-ariatosca] Git Push Summary

2017-03-28 Thread avia
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/mock-master [deleted] f21c6e7d8