ariatosca-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mxmrlv <...@git.apache.org>
Subject [GitHub] incubator-ariatosca pull request #156: ARIA-278 remove core tasks
Date Tue, 20 Jun 2017 12:10:27 GMT
Github user mxmrlv commented on a diff in the pull request:

    https://github.com/apache/incubator-ariatosca/pull/156#discussion_r122954646
  
    --- Diff: aria/orchestrator/workflows/events_logging.py ---
    @@ -34,54 +34,67 @@ def _get_task_name(task):
     
     
     @events.start_task_signal.connect
    -def _start_task_handler(task, **kwargs):
    -    # If the task has no function this is an empty task.
    -    if task.function:
    -        suffix = 'started...'
    -        logger = task.context.logger.info
    -    else:
    -        suffix = 'has no implementation'
    -        logger = task.context.logger.debug
    +def _start_task_handler(ctx, **kwargs):
    +    with ctx.track_changes:
    +        # If the task has no function this is an empty task.
    +        if ctx.task.function:
    +            suffix = 'started...'
    +            logger = ctx.logger.info
    +        else:
    +            suffix = 'has no implementation'
    +            logger = ctx.logger.debug
    +
    +        logger('{name} {task.interface_name}.{task.operation_name} {suffix}'.format(
    +            name=_get_task_name(ctx.task), task=ctx.task, suffix=suffix))
     
    -    logger('{name} {task.interface_name}.{task.operation_name} {suffix}'.format(
    -        name=_get_task_name(task), task=task, suffix=suffix))
     
     @events.on_success_task_signal.connect
    -def _success_task_handler(task, **kwargs):
    -    if not task.function:
    -        return
    -    task.context.logger.info('{name} {task.interface_name}.{task.operation_name} successful'
    -                             .format(name=_get_task_name(task), task=task))
    +def _success_task_handler(ctx, **kwargs):
    +    with ctx.track_changes:
    +        if not ctx.task.function:
    +            return
    +        ctx.logger.info('{name} {task.interface_name}.{task.operation_name} successful'
    +                        .format(name=_get_task_name(ctx.task), task=ctx.task))
     
     
     @events.on_failure_task_signal.connect
    -def _failure_operation_handler(task, traceback, **kwargs):
    -    task.context.logger.error(
    -        '{name} {task.interface_name}.{task.operation_name} failed'
    -        .format(name=_get_task_name(task), task=task), extra=dict(traceback=traceback)
    -    )
    +def _failure_operation_handler(ctx, traceback, **kwargs):
    +    with ctx.track_changes:
    +        ctx.logger.error(
    +            '{name} {task.interface_name}.{task.operation_name} failed'
    +            .format(name=_get_task_name(ctx.task), task=ctx.task), extra=dict(traceback=traceback)
    +        )
     
     
     @events.start_workflow_signal.connect
     def _start_workflow_handler(context, **kwargs):
    -    context.logger.info("Starting '{ctx.workflow_name}' workflow execution".format(ctx=context))
    +    with context.track_changes:
    +        context.logger.info("Starting '{ctx.workflow_name}' workflow execution".format(ctx=context))
     
     
     @events.on_failure_workflow_signal.connect
     def _failure_workflow_handler(context, **kwargs):
    -    context.logger.info("'{ctx.workflow_name}' workflow execution failed".format(ctx=context))
    +    with context.track_changes:
    +        context.logger.info("'{ctx.workflow_name}' workflow execution failed".format(ctx=context))
     
     
     @events.on_success_workflow_signal.connect
     def _success_workflow_handler(context, **kwargs):
    -    context.logger.info("'{ctx.workflow_name}' workflow execution succeeded".format(ctx=context))
    +    with context.track_changes:
    --- End diff --
    
    remove


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message