You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ariatosca.apache.org by mx...@apache.org on 2017/06/20 08:53:41 UTC

incubator-ariatosca git commit: fixed logging issue [Forced Update!]

Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-236-Resumable-workflow-executions f75b9ae7b -> c21e97d9d (forced update)


fixed logging issue


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

Branch: refs/heads/ARIA-236-Resumable-workflow-executions
Commit: c21e97d9d5f1115facdbbb815890f279b6a78d0f
Parents: 4d74419
Author: max-orlov <ma...@gigaspaces.com>
Authored: Tue Jun 20 11:51:14 2017 +0300
Committer: max-orlov <ma...@gigaspaces.com>
Committed: Tue Jun 20 11:53:36 2017 +0300

----------------------------------------------------------------------
 aria/cli/commands/executions.py | 5 ++++-
 aria/cli/logger.py              | 4 ++--
 tests/modeling/test_models.py   | 5 ++---
 3 files changed, 8 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/c21e97d9/aria/cli/commands/executions.py
----------------------------------------------------------------------
diff --git a/aria/cli/commands/executions.py b/aria/cli/commands/executions.py
index cfa211e..f2f8221 100644
--- a/aria/cli/commands/executions.py
+++ b/aria/cli/commands/executions.py
@@ -187,7 +187,10 @@ def _run_execution(workflow_runner, logger, model_storage, dry, mark_pattern):
     logger.info('Starting {0}execution. Press Ctrl+C cancel'.format('dry ' if dry else ''))
     execution_thread.start()
 
-    log_iterator = cli_logger.ModelLogIterator(model_storage, workflow_runner.execution_id)
+    last_task_id = workflow_runner.execution.logs[-1].id if workflow_runner.execution.logs else 0
+    log_iterator = cli_logger.ModelLogIterator(model_storage,
+                                               workflow_runner.execution_id,
+                                               offset=last_task_id)
     try:
         while execution_thread.is_alive():
             execution_logging.log_list(log_iterator, mark_pattern=mark_pattern)

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/c21e97d9/aria/cli/logger.py
----------------------------------------------------------------------
diff --git a/aria/cli/logger.py b/aria/cli/logger.py
index 5de3701..96f3fb3 100644
--- a/aria/cli/logger.py
+++ b/aria/cli/logger.py
@@ -115,8 +115,8 @@ class Logging(object):
 
 class ModelLogIterator(object):
 
-    def __init__(self, model_storage, execution_id, filters=None, sort=None):
-        self._last_visited_id = 0
+    def __init__(self, model_storage, execution_id, filters=None, sort=None, offset=0):
+        self._last_visited_id = offset
         self._model_storage = model_storage
         self._execution_id = execution_id
         self._additional_filters = filters or {}

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/c21e97d9/tests/modeling/test_models.py
----------------------------------------------------------------------
diff --git a/tests/modeling/test_models.py b/tests/modeling/test_models.py
index 464f432..bbc7352 100644
--- a/tests/modeling/test_models.py
+++ b/tests/modeling/test_models.py
@@ -314,7 +314,7 @@ class TestExecution(object):
                                    Execution.CANCELLING],
             Execution.FAILED: [Execution.FAILED],
             Execution.SUCCEEDED: [Execution.SUCCEEDED],
-            Execution.CANCELLED: [Execution.CANCELLED]
+            Execution.CANCELLED: [Execution.CANCELLED, Execution.PENDING]
         }
 
         invalid_transitions = {
@@ -334,8 +334,7 @@ class TestExecution(object):
                                   Execution.FAILED,
                                   Execution.CANCELLED,
                                   Execution.CANCELLING],
-            Execution.CANCELLED: [Execution.PENDING,
-                                  Execution.STARTED,
+            Execution.CANCELLED: [Execution.STARTED,
                                   Execution.FAILED,
                                   Execution.SUCCEEDED,
                                   Execution.CANCELLING],