ariatosca-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dankil...@apache.org
Subject [01/11] incubator-ariatosca git commit: add eta a settable property and refactor some
Date Tue, 08 Nov 2016 12:29:09 GMT
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-10-task-retries [created] 0b3c85d8a


add eta a settable property and refactor some


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

Branch: refs/heads/ARIA-10-task-retries
Commit: 7f516c2450a42fce871cc0a0a61d6d7429378116
Parents: 8947f72
Author: Dan Kilman <dank@gigaspaces.com>
Authored: Tue Nov 8 11:03:08 2016 +0200
Committer: Dan Kilman <dank@gigaspaces.com>
Committed: Tue Nov 8 11:03:08 2016 +0200

----------------------------------------------------------------------
 aria/workflows/core/task.py | 33 +++++++++++++++++++++------------
 1 file changed, 21 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/7f516c24/aria/workflows/core/task.py
----------------------------------------------------------------------
diff --git a/aria/workflows/core/task.py b/aria/workflows/core/task.py
index fc72b59..ec7b861 100644
--- a/aria/workflows/core/task.py
+++ b/aria/workflows/core/task.py
@@ -147,9 +147,7 @@ class OperationTask(BaseTask, logger.LoggerMixin):
 
     @status.setter
     def status(self, value):
-        if self._update_fields is None:
-            raise exceptions.TaskException("Task is not in update mode")
-        self._update_fields['status'] = value
+        self._update_property('status', value)
 
     @property
     def started_at(self):
@@ -161,9 +159,7 @@ class OperationTask(BaseTask, logger.LoggerMixin):
 
     @started_at.setter
     def started_at(self, value):
-        if self._update_fields is None:
-            raise exceptions.TaskException("Task is not in update mode")
-        self._update_fields['started_at'] = value
+        self._update_property('started_at', value)
 
     @property
     def ended_at(self):
@@ -175,9 +171,7 @@ class OperationTask(BaseTask, logger.LoggerMixin):
 
     @ended_at.setter
     def ended_at(self, value):
-        if self._update_fields is None:
-            raise exceptions.TaskException("Task is not in update mode")
-        self._update_fields['ended_at'] = value
+        self._update_property('ended_at', value)
 
     @property
     def retry_count(self):
@@ -189,12 +183,27 @@ class OperationTask(BaseTask, logger.LoggerMixin):
 
     @retry_count.setter
     def retry_count(self, value):
-        if self._update_fields is None:
-            raise exceptions.TaskException("Task is not in update mode")
-        self._update_fields['retry_count'] = value
+        self._update_property('retry_count', value)
+
+    @property
+    def eta(self):
+        """
+        Returns the minimum datetime in which the task can be executed
+        :return: eta
+        """
+        return self.context.eta
+
+    @eta.setter
+    def eta(self, value):
+        self._update_property('eta', value)
 
     def __getattr__(self, attr):
         try:
             return getattr(self.context, attr)
         except AttributeError:
             return super(OperationTask, self).__getattribute__(attr)
+
+    def _update_property(self, key, value):
+        if self._update_fields is None:
+            raise exceptions.TaskException("Task is not in update mode")
+        self._update_fields[key] = value


Mime
View raw message