ariatosca-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mxm...@apache.org
Subject [2/2] incubator-ariatosca git commit: added better relationship printing
Date Thu, 20 Apr 2017 09:13:19 GMT
added better relationship printing


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

Branch: refs/heads/ARIA-138-Make-logging-more-informative
Commit: d4380fb8fbd671ceb8c9eeda6386ab41604653e4
Parents: cec57cd
Author: max-orlov <maxim@gigaspaces.com>
Authored: Thu Apr 20 11:57:28 2017 +0300
Committer: max-orlov <maxim@gigaspaces.com>
Committed: Thu Apr 20 12:10:40 2017 +0300

----------------------------------------------------------------------
 aria/cli/commands/executions.py               |  2 +-
 aria/cli/execution_logging.py                 |  6 ++----
 aria/orchestrator/workflows/events_logging.py | 20 ++++++++++++++------
 aria/orchestrator/workflows/executor/dry.py   | 14 ++++++++++----
 4 files changed, 27 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/d4380fb8/aria/cli/commands/executions.py
----------------------------------------------------------------------
diff --git a/aria/cli/commands/executions.py b/aria/cli/commands/executions.py
index 3b17abf..1ab5aed 100644
--- a/aria/cli/commands/executions.py
+++ b/aria/cli/commands/executions.py
@@ -16,11 +16,11 @@
 import os
 
 from .. import helptexts
-from aria.cli import execution_logging
 from .. import table
 from .. import utils
 from ..core import aria
 from .. import logger as cli_logger
+from .. import execution_logging
 from ...modeling.models import Execution
 from ...orchestrator.workflow_runner import WorkflowRunner
 from ...orchestrator.workflows.executor.dry import DryExecutor

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/d4380fb8/aria/cli/execution_logging.py
----------------------------------------------------------------------
diff --git a/aria/cli/execution_logging.py b/aria/cli/execution_logging.py
index bd05549..4099aff 100644
--- a/aria/cli/execution_logging.py
+++ b/aria/cli/execution_logging.py
@@ -13,7 +13,6 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-import os
 from StringIO import StringIO
 
 from . import logger
@@ -26,11 +25,11 @@ DEFAULT_FORMATTING = {
         'timestamp': '%H:%M:%S'
     },
     logger.MEDIUM_VERBOSE: {
-        'message': '{timestamp} | {item.level[0]} | {item.msg} | {implementation}',
+        'message': '{timestamp} | {item.level[0]} | {implementation} | {item.msg} ',
         'timestamp': '%H:%M:%S'
     },
     logger.HIGH_VERBOSE: {
-        'message': '{timestamp} | {item.level[0]} | {item.msg} | {implementation}({inputs})',
+        'message': '{timestamp} | {item.level[0]} | {implementation}({inputs}) | {item.msg}
',
         'timestamp': '%H:%M:%S'
     },
 }
@@ -78,4 +77,3 @@ def drain(iterator):
         log(item)
         any_logs = True
     return any_logs
-

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/d4380fb8/aria/orchestrator/workflows/events_logging.py
----------------------------------------------------------------------
diff --git a/aria/orchestrator/workflows/events_logging.py b/aria/orchestrator/workflows/events_logging.py
index 1bc5a1e..d13c7be 100644
--- a/aria/orchestrator/workflows/events_logging.py
+++ b/aria/orchestrator/workflows/events_logging.py
@@ -24,23 +24,31 @@ Implementation of logger handlers for workflow and operation events.
 from .. import events
 
 
+def _get_task_name(task):
+    if hasattr(task.actor, 'source_node'):
+        return '{source_node.name}->{target_node.name}'.format(
+            source_node=task.actor.source_node, target_node=task.actor.target_node)
+    else:
+        return task.actor.name
+
+
 @events.start_task_signal.connect
 def _start_task_handler(task, **kwargs):
-    task.context.logger.info('{actor.name} {task.interface_name}.{task.operation_name} started...'
-                             .format(actor=task.actor, task=task))
+    task.context.logger.info('{name} {task.interface_name}.{task.operation_name} started...'
+                             .format(name=_get_task_name(task), task=task))
 
 
 @events.on_success_task_signal.connect
 def _success_task_handler(task, **kwargs):
-    task.context.logger.info('{actor.name} {task.interface_name}.{task.operation_name} successful'
-                             .format(actor=task.actor, task=task))
+    task.context.logger.info('{name} {task.interface_name}.{task.operation_name} successful'
+                             .format(name=_get_task_name(task), task=task))
 
 
 @events.on_failure_task_signal.connect
 def _failure_operation_handler(task, traceback, **kwargs):
     task.context.logger.error(
-        '{actor.name} {task.interface_name}.{task.operation_name} failed'
-        .format(actor=task.actor, task=task), extra=dict(traceback=traceback)
+        '{name} {task.interface_name}.{task.operation_name} failed'
+        .format(name=_get_task_name(task), task=task), extra=dict(traceback=traceback)
     )
 
 @events.start_workflow_signal.connect

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/d4380fb8/aria/orchestrator/workflows/executor/dry.py
----------------------------------------------------------------------
diff --git a/aria/orchestrator/workflows/executor/dry.py b/aria/orchestrator/workflows/executor/dry.py
index ce18580..e1261bb 100644
--- a/aria/orchestrator/workflows/executor/dry.py
+++ b/aria/orchestrator/workflows/executor/dry.py
@@ -34,13 +34,19 @@ class DryExecutor(BaseExecutor):
             task.started_at = datetime.utcnow()
             task.status = task.STARTED
 
+        if hasattr(task.actor, 'source_node'):
+            name = '{source_node.name}->{target_node.name}'.format(
+                source_node=task.actor.source_node, target_node=task.actor.target_node)
+        else:
+            name = task.actor.name
+
         task.context.logger.info(
-            '<dry> {actor.name} {task.interface_name}.{task.operation_name} started...'
-            .format(actor=task.actor, task=task))
+            '<dry> {name} {task.interface_name}.{task.operation_name} started...'
+            .format(name=name, task=task))
 
         task.context.logger.info(
-            '<dry> {actor.name} {task.interface_name}.{task.operation_name} successful'
-            .format(actor=task.actor, task=task))
+            '<dry> {name} {task.interface_name}.{task.operation_name} successful'
+            .format(name=name, task=task))
 
         # updating the task manually instead of calling self._task_succeeded(task),
         # to avoid any side effects raising that event might cause


Mime
View raw message