ariatosca-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dankil...@apache.org
Subject [04/11] incubator-ariatosca git commit: add global task max retries and retry interval to workflow context and specific ones to tasks
Date Tue, 08 Nov 2016 12:29:12 GMT
add global task max retries and retry interval to workflow context and specific ones to tasks


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

Branch: refs/heads/ARIA-10-task-retries
Commit: bd6f3932093bec3d93d89786a850c9440c09b31d
Parents: 0d03eeb
Author: Dan Kilman <dank@gigaspaces.com>
Authored: Tue Nov 8 12:05:32 2016 +0200
Committer: Dan Kilman <dank@gigaspaces.com>
Committed: Tue Nov 8 12:05:32 2016 +0200

----------------------------------------------------------------------
 aria/context/workflow.py    | 4 ++++
 aria/workflows/api/task.py  | 8 +++++++-
 aria/workflows/core/task.py | 3 ++-
 3 files changed, 13 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/bd6f3932/aria/context/workflow.py
----------------------------------------------------------------------
diff --git a/aria/context/workflow.py b/aria/context/workflow.py
index 8183d42..41ecb74 100644
--- a/aria/context/workflow.py
+++ b/aria/context/workflow.py
@@ -47,6 +47,8 @@ class WorkflowContext(logger.LoggerMixin):
             workflow_id,
             execution_id=None,
             parameters=None,
+            task_max_retries=0,
+            task_retry_interval=0,
             **kwargs):
         super(WorkflowContext, self).__init__(**kwargs)
         self.name = name
@@ -57,6 +59,8 @@ class WorkflowContext(logger.LoggerMixin):
         self.workflow_id = workflow_id
         self.execution_id = execution_id or str(uuid4())
         self.parameters = parameters or {}
+        self.task_max_retries = task_max_retries
+        self.task_retry_interval = task_retry_interval
 
     def __repr__(self):
         return (

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/bd6f3932/aria/workflows/api/task.py
----------------------------------------------------------------------
diff --git a/aria/workflows/api/task.py b/aria/workflows/api/task.py
index 1070d99..ca62cf7 100644
--- a/aria/workflows/api/task.py
+++ b/aria/workflows/api/task.py
@@ -14,7 +14,7 @@
 # limitations under the License.
 
 """
-Provides the tasks to be enterd into the task graph
+Provides the tasks to be entered into the task graph
 """
 from uuid import uuid4
 
@@ -58,6 +58,8 @@ class OperationTask(BaseTask):
                  name,
                  operation_details,
                  node_instance,
+                 max_retries=None,
+                 retry_interval=None,
                  inputs=None):
         """
         Creates an operation task using the name, details, node instance and any additional
kwargs.
@@ -71,6 +73,10 @@ class OperationTask(BaseTask):
         self.operation_details = operation_details
         self.node_instance = node_instance
         self.inputs = inputs or {}
+        self.max_retries = (self.workflow_context.task_max_retries
+                            if max_retries is None else max_retries)
+        self.retry_interval = (self.workflow_context.task_retry_interval
+                               if retry_interval is None else retry_interval)
 
 
 class WorkflowTask(BaseTask):

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/bd6f3932/aria/workflows/core/task.py
----------------------------------------------------------------------
diff --git a/aria/workflows/core/task.py b/aria/workflows/core/task.py
index 926957c..2574c4b 100644
--- a/aria/workflows/core/task.py
+++ b/aria/workflows/core/task.py
@@ -96,7 +96,8 @@ class OperationTask(BaseTask, logger.LoggerMixin):
             inputs=api_task.inputs,
             status=task_model.PENDING,
             execution_id=self.workflow_context.execution_id,
-            max_retries=self.workflow_context.parameters.get('max_retries', 1),
+            max_retries=api_task.max_retries,
+            retry_interval=api_task.retry_interval,
         )
         self.workflow_context.model.task.store(task)
         self._task_id = task.id


Mime
View raw message