ariatosca-dev 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 #117: ARIA-163 update node state for stub t...
Date Wed, 03 May 2017 11:08:22 GMT
Github user mxmrlv commented on a diff in the pull request:

    https://github.com/apache/incubator-ariatosca/pull/117#discussion_r114515719
  
    --- Diff: aria/orchestrator/workflows/api/task.py ---
    @@ -87,86 +88,43 @@ def __init__(self,
                                    if ignore_failure is None else ignore_failure)
             self.interface_name = interface_name
             self.operation_name = operation_name
    +        self.name = OperationTask.NAME_FORMAT.format(type=actor_type,
    +                                                     name=actor.name,
    +                                                     interface=self.interface_name,
    +                                                     operation=self.operation_name)
    +        self.is_stub = self.is_empty(self.actor, self.interface_name, self.operation_name)
    +        if self.is_stub:
    +            return
     
             operation = self.actor.interfaces[self.interface_name].operations[self.operation_name]
             self.plugin = operation.plugin
             self.inputs = modeling_utils.create_inputs(inputs or {}, operation.inputs)
             self.implementation = operation.implementation
    -        self.name = OperationTask.NAME_FORMAT.format(type=actor_type,
    -                                                     name=actor.name,
    -                                                     interface=self.interface_name,
    -                                                     operation=self.operation_name)
     
         def __repr__(self):
             return self.name
     
    -    @classmethod
    -    def for_node(cls,
    -                 node,
    -                 interface_name,
    -                 operation_name,
    -                 max_attempts=None,
    -                 retry_interval=None,
    -                 ignore_failure=None,
    -                 inputs=None):
    +    def __new__(cls, actor, interface_name, operation_name, *args, **kwargs):
             """
    -        Creates an operation on a node.
    -
    -        :param node: The node on which to run the operation
    -        :param interface_name: The interface name
    -        :param operation_name: The operation name within the interface
    -        :param max_attempts: The maximum number of attempts in case the operation fails
    -                             (if not specified the defaults it taken from the workflow
context)
    -        :param retry_interval: The interval in seconds between attempts when the operation
fails
    -                               (if not specified the defaults it taken from the workflow
context)
    -        :param ignore_failure: Whether to ignore failures
    -                               (if not specified the defaults it taken from the workflow
context)
    -        :param inputs: Additional operation inputs
    +        Returns a new operation task if the operation exists in the node, otherwise returns
None.
             """
    +        try:
    +            cls.is_empty(actor, interface_name, operation_name)
    +            return super(OperationTask, cls).__new__(cls)
    --- End diff --
    
    super(BaseTask, ...)


---
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