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 2016/10/19 13:04:36 UTC

incubator-ariatosca git commit: pylint-aria-events

Repository: incubator-ariatosca
Updated Branches:
  refs/heads/pylint-aria-events 66bf8139f -> 4d10d1030


pylint-aria-events


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

Branch: refs/heads/pylint-aria-events
Commit: 4d10d1030c5eefecb691a45bbea60de869db7662
Parents: 66bf813
Author: mxmrlv <mx...@gmail.com>
Authored: Wed Oct 19 16:03:31 2016 +0300
Committer: mxmrlv <mx...@gmail.com>
Committed: Wed Oct 19 16:04:22 2016 +0300

----------------------------------------------------------------------
 .pylintrc                                    |  1 -
 aria/events/__init__.py                      | 28 +++++++++++++++++++++++
 aria/events/builtin_event_handler.py         | 14 +++++++++---
 aria/events/workflow_engine_event_handler.py | 20 +++++++++++-----
 4 files changed, 53 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/4d10d103/.pylintrc
----------------------------------------------------------------------
diff --git a/.pylintrc b/.pylintrc
index 7619956..f8e62db 100644
--- a/.pylintrc
+++ b/.pylintrc
@@ -405,5 +405,4 @@ overgeneral-exceptions=Exception
 
 
 [pre-commit-hook]
-params=--reports=no
 limit=9.5

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/4d10d103/aria/events/__init__.py
----------------------------------------------------------------------
diff --git a/aria/events/__init__.py b/aria/events/__init__.py
index c9d7b20..031777d 100644
--- a/aria/events/__init__.py
+++ b/aria/events/__init__.py
@@ -13,6 +13,25 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+"""
+Aria's events Sub-Package
+Path: aria.events
+
+Events package provides events mechanism for different executions in aria.
+
+
+1. storage_event_handler: implementation of storage handlers for workflow and operation events.
+2. logger_event_handler: implementation of logger handlers for workflow and operation events.
+
+API:
+    * start_task_signal
+    * on_success_task_signal
+    * on_failure_task_signal
+    * start_workflow_signal
+    * on_success_workflow_signal
+    * on_failure_workflow_signal
+"""
+
 import os
 
 from blinker import signal
@@ -20,6 +39,15 @@ from blinker import signal
 from ..tools.plugin import plugin_installer
 
 
+__all__ = (
+    'start_task_signal',
+    'on_success_task_signal',
+    'on_failure_task_signal',
+    'start_workflow_signal',
+    'on_success_workflow_signal',
+    'on_failure_workflow_signal'
+)
+
 # workflow engine task signals:
 start_task_signal = signal('start_task_signal')
 on_success_task_signal = signal('success_task_signal')

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/4d10d103/aria/events/builtin_event_handler.py
----------------------------------------------------------------------
diff --git a/aria/events/builtin_event_handler.py b/aria/events/builtin_event_handler.py
index 404cc01..ec3238f 100644
--- a/aria/events/builtin_event_handler.py
+++ b/aria/events/builtin_event_handler.py
@@ -13,6 +13,14 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+"""
+Aria's events Sub-Package
+Path: aria.events.storage_event_handler
+
+Implementation of storage handlers for workflow and operation events.
+"""
+
+
 from datetime import datetime
 
 from . import (
@@ -54,13 +62,13 @@ def _task_succeeded(task, *args, **kwargs):
 
 @start_workflow_signal.connect
 def _workflow_started(workflow_context, *args, **kwargs):
-    Execution = workflow_context.storage.execution.model_cls
-    execution = Execution(
+    execution_cls = workflow_context.storage.execution.model_cls
+    execution = execution_cls(
         id=workflow_context.execution_id,
         deployment_id=workflow_context.deployment_id,
         workflow_id=workflow_context.workflow_id,
         blueprint_id=workflow_context.blueprint_id,
-        status=Execution.PENDING,
+        status=execution_cls.PENDING,
         started_at=datetime.utcnow(),
         parameters=workflow_context.parameters,
     )

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/4d10d103/aria/events/workflow_engine_event_handler.py
----------------------------------------------------------------------
diff --git a/aria/events/workflow_engine_event_handler.py b/aria/events/workflow_engine_event_handler.py
index 6916206..60138e1 100644
--- a/aria/events/workflow_engine_event_handler.py
+++ b/aria/events/workflow_engine_event_handler.py
@@ -13,6 +13,14 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+
+"""
+Aria's events Sub-Package
+Path: aria.events.storage_event_handler
+
+Implementation of logger handlers for workflow and operation events.
+"""
+
 from . import (
     start_task_signal,
     on_success_task_signal,
@@ -24,37 +32,37 @@ from . import (
 
 
 @start_task_signal.connect
-def start_task_handler(task, **kwargs):
+def _start_task_handler(task, **kwargs):
     task.logger.debug(
         'Event: Starting task: {task.name}'.format(task=task))
 
 
 @on_success_task_signal.connect
-def success_task_handler(task, **kwargs):
+def _success_task_handler(task, **kwargs):
     task.logger.debug(
         'Event: Task success: {task.name}'.format(task=task))
 
 
 @on_failure_task_signal.connect
-def failure_operation_handler(task, **kwargs):
+def _failure_operation_handler(task, **kwargs):
     task.logger.error(
         'Event: Task failure: {task.name}'.format(task=task),
         exc_info=kwargs.get('exception', True))
 
 
 @start_workflow_signal.connect
-def start_workflow_handler(context, **kwargs):
+def _start_workflow_handler(context, **kwargs):
     context.logger.debug(
         'Event: Starting workflow: {context.name}'.format(context=context))
 
 
 @on_failure_workflow_signal.connect
-def failure_workflow_handler(context, **kwargs):
+def _failure_workflow_handler(context, **kwargs):
     context.logger.debug(
         'Event: Workflow failure: {context.name}'.format(context=context))
 
 
 @on_success_workflow_signal.connect
-def success_workflow_handler(context, **kwargs):
+def _success_workflow_handler(context, **kwargs):
     context.logger.debug(
         'Event: Workflow success: {context.name}'.format(context=context))