ariatosca-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r..@apache.org
Subject [10/24] incubator-ariatosca git commit: Make Execution, Task and Node status properties into methods
Date Tue, 04 Apr 2017 10:22:04 GMT
Make Execution, Task and Node status properties into methods


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

Branch: refs/heads/ARIA-48-aria-cli
Commit: c4ca1e8f98c1b3ac0c974da06f238be989c394a6
Parents: d872282
Author: Avia Efrat <avia@gigaspaces.com>
Authored: Sun Apr 2 16:11:43 2017 +0300
Committer: Ran Ziv <ran@gigaspaces.com>
Committed: Tue Apr 4 13:20:46 2017 +0300

----------------------------------------------------------------------
 aria/modeling/orchestration.py             | 6 +-----
 aria/modeling/service_instance.py          | 1 -
 aria/orchestrator/workflows/core/engine.py | 6 +++---
 aria/orchestrator/workflows/core/task.py   | 2 --
 4 files changed, 4 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/c4ca1e8f/aria/modeling/orchestration.py
----------------------------------------------------------------------
diff --git a/aria/modeling/orchestration.py b/aria/modeling/orchestration.py
index 15abde4..3ad6b58 100644
--- a/aria/modeling/orchestration.py
+++ b/aria/modeling/orchestration.py
@@ -98,13 +98,11 @@ 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
+        return not self.has_ended()
 
     @declared_attr
     def logs(cls):
@@ -290,11 +288,9 @@ class TaskBase(ModelMixin):
     implementation = Column(String)
     _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]
 

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/c4ca1e8f/aria/modeling/service_instance.py
----------------------------------------------------------------------
diff --git a/aria/modeling/service_instance.py b/aria/modeling/service_instance.py
index 48615af..a8fe71b 100644
--- a/aria/modeling/service_instance.py
+++ b/aria/modeling/service_instance.py
@@ -415,7 +415,6 @@ class NodeBase(InstanceModelMixin):
         except KeyError:
             return None
 
-    @property
     def is_available(self):
         return self.state not in [self.INITIAL, self.DELETED, self.ERROR]
 

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/c4ca1e8f/aria/orchestrator/workflows/core/engine.py
----------------------------------------------------------------------
diff --git a/aria/orchestrator/workflows/core/engine.py b/aria/orchestrator/workflows/core/engine.py
index d32abb8..0503142 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.is_waiting 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.has_ended)
+        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 +105,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 not task.model_task.has_ended:
+                if not task.model_task.has_ended():
                     self._workflow_context.model.task.refresh(task.model_task)
             yield task
 

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/c4ca1e8f/aria/orchestrator/workflows/core/task.py
----------------------------------------------------------------------
diff --git a/aria/orchestrator/workflows/core/task.py b/aria/orchestrator/workflows/core/task.py
index aa8963f..540988c 100644
--- a/aria/orchestrator/workflows/core/task.py
+++ b/aria/orchestrator/workflows/core/task.py
@@ -69,11 +69,9 @@ class StubTask(BaseTask):
         self.status = models.Task.PENDING
         self.due_at = datetime.utcnow()
 
-    @property
     def has_ended(self):
         return self.status in [models.Task.SUCCESS, models.Task.FAILED]
 
-    @property
     def is_waiting(self):
         return self.status in [models.Task.PENDING, models.Task.RETRYING]
 


Mime
View raw message