ariatosca-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dankilman <...@git.apache.org>
Subject [GitHub] incubator-ariatosca pull request #20: ARIA-9-API-for-operation-context
Date Tue, 15 Nov 2016 14:40:38 GMT
Github user dankilman commented on a diff in the pull request:

    https://github.com/apache/incubator-ariatosca/pull/20#discussion_r88026271
  
    --- Diff: aria/workflows/api/task.py ---
    @@ -86,64 +89,45 @@ def __init__(self,
             self.ignore_failure = (self.workflow_context._task_ignore_failure
                                    if ignore_failure is None else ignore_failure)
     
    -
    -class NodeOperationTask(_OperationTask):
    -    """
    -    Represents a node based operation
    -    """
    -    def __init__(self,
    -                 actor,
    -                 name,
    -                 *args,
    -                 **kwargs):
    +    @classmethod
    +    def node_instance(cls, actor, name, inputs=None, *args, **kwargs):
             """
    -        Represents a relationship based operation
    +        Represents a node based operation
     
             :param actor: the node of which this operation belongs to.
             :param name: the name of the operation.
             """
             assert isinstance(actor, storage.models.NodeInstance)
    -        assert 'operation_details' not in kwargs
    -        operation_mapping = actor.node.operations[name].get('operation', '')
    -        operation_inputs = actor.node.operations[name].get('inputs', {})
    -        operation_inputs.update(kwargs.pop('inputs', {}) or {})
    -        super(NodeOperationTask, self).__init__(name=name,
    -                                                actor=actor,
    -                                                operation_mapping=operation_mapping,
    -                                                inputs=operation_inputs,
    -                                                *args,
    -                                                **kwargs)
    -
    -
    -class RelationshipOperationTask(_OperationTask):
    -    """
    -    Represents a relationship based operation
    -    """
    -    def __init__(self,
    -                 actor,
    -                 name,
    -                 target,
    -                 *args,
    -                 **kwargs):
    +        operation_details = actor.node.operations[name]
    +        operation_inputs = operation_details.get('inputs', {})
    +        operation_inputs.update(inputs or {})
    +        return cls(name=name,
    +                   actor=actor,
    +                   operation_mapping=operation_details.get('operation', ''),
    +                   inputs=operation_inputs,
    +                   *args,
    +                   **kwargs)
    +
    +    @classmethod
    +    def relationship_instance(cls, name, actor, operation_end, inputs=None, *args, **kwargs):
             """
             Represents a relationship based operation
     
    -        :param actor: the relationship of which this operation belongs to.
    +        :param actor: the node of which this operation belongs to.
             :param name: the name of the operation.
    -        :param target: whether this is a source or target operation.
    +        :param operation_end: source or target end of the relationship
    --- End diff --
    
    real names


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