ariatosca-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mxm...@apache.org
Subject incubator-ariatosca git commit: reworked the test - preventing infinite loops
Date Sun, 09 Jul 2017 09:18:10 GMT
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-299-Resuming-canceled-execution-with-frozen-task-fails 1e2e793ba -> 2aa82f330


reworked the test - preventing infinite loops


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

Branch: refs/heads/ARIA-299-Resuming-canceled-execution-with-frozen-task-fails
Commit: 2aa82f33000712de15b737ca006b5de60502f96b
Parents: 1e2e793
Author: max-orlov <maxim@gigaspaces.com>
Authored: Sun Jul 9 12:18:01 2017 +0300
Committer: max-orlov <maxim@gigaspaces.com>
Committed: Sun Jul 9 12:18:01 2017 +0300

----------------------------------------------------------------------
 aria/orchestrator/workflows/core/events_handler.py | 6 +++---
 tests/orchestrator/test_workflow_runner.py         | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/2aa82f33/aria/orchestrator/workflows/core/events_handler.py
----------------------------------------------------------------------
diff --git a/aria/orchestrator/workflows/core/events_handler.py b/aria/orchestrator/workflows/core/events_handler.py
index 7e5eb81..eb6f271 100644
--- a/aria/orchestrator/workflows/core/events_handler.py
+++ b/aria/orchestrator/workflows/core/events_handler.py
@@ -115,9 +115,9 @@ def _workflow_cancelled(workflow_context, *args, **kwargs):
             _log_tried_to_cancel_execution_but_it_already_ended(workflow_context, execution.status)
         else:
             # Any non ended task would be put back to pending state
-            # for task in execution.tasks:
-            #     if not task.has_ended():
-            #         task.status = task.PENDING
+            for task in execution.tasks:
+                if not task.has_ended():
+                    task.status = task.PENDING
             execution.status = execution.CANCELLED
             execution.ended_at = datetime.utcnow()
 

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/2aa82f33/tests/orchestrator/test_workflow_runner.py
----------------------------------------------------------------------
diff --git a/tests/orchestrator/test_workflow_runner.py b/tests/orchestrator/test_workflow_runner.py
index 6951a7f..3527f34 100644
--- a/tests/orchestrator/test_workflow_runner.py
+++ b/tests/orchestrator/test_workflow_runner.py
@@ -538,8 +538,8 @@ def mock_failed_first_task(ctx):
 
     if ctx.node.attributes['invocations'] == 2:
         custom_events['is_active'].set()
-        # stuck the thread
-        while True:
+        # unfreeze the thread only when all of the invocations are done
+        while ctx.node.attributes['invocations'] < ctx.task.max_attempts - 1:
             pass
 
     elif ctx.node.attributes['invocations'] == ctx.task.max_attempts - 1:


Mime
View raw message