ariatosca-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tliron <...@git.apache.org>
Subject [GitHub] incubator-ariatosca pull request #72: ARIA-105 integrate modeling
Date Mon, 20 Mar 2017 16:08:15 GMT
Github user tliron commented on a diff in the pull request:

    https://github.com/apache/incubator-ariatosca/pull/72#discussion_r106943057
  
    --- Diff: aria/orchestrator/workflows/api/task.py ---
    @@ -92,144 +93,133 @@ def __init__(self,
                                    if ignore_failure is None else ignore_failure)
             self.runs_on = runs_on
     
    -    @classmethod
    -    def _merge_inputs(cls, operation_inputs, additional_inputs=None):
    -        final_inputs = dict((p.name, p.as_raw['value']) for p in operation_inputs)
    -        final_inputs.update(additional_inputs or {})
    -        return final_inputs
    +        # Wrap inputs
    +        if inputs:
    +            for k, v in inputs.iteritems():
    +                if not isinstance(v, models.Parameter):
    +                    inputs[k] = models.Parameter.wrap(k, v)
    +
    +        # TODO: These extra inputs should likely be stored as a separate entry in the
task model,
    +        # because they are different from the operation inputs. The two kinds of inputs
should also
    +        # not be merged.
    +
    +        if interface_name or operation_name:
    +            operation = OperationTask._get_operation(actor.interfaces, interface_name,
    +                                                     operation_name)
    +            if operation is None:
    +                raise exceptions.TaskException(
    +                    'Could not find operation "{0}" on interface "{1}" for {2} "{3}"'
    +                    .format(operation_name, interface_name, actor_type, actor.name))
    +
    +            self.plugin = None
    +            if operation.plugin_specification:
    +                self.plugin = OperationTask._find_plugin(operation.plugin_specification)
    +                if self.plugin is None:
    +                    raise exceptions.TaskException(
    +                        'Could not find plugin of operation "{0}" on interface "{1}"
for {2} "{3}"'
    +                        .format(operation_name, interface_name, actor_type, actor.name))
    +
    +            self.implementation = operation.implementation
    +            self.inputs = OperationTask._merge_inputs(operation.inputs, inputs)
    +
    +            self.name = OperationTask.NAME_FORMAT.format(type=actor_type,
    +                                                         name=actor.name,
    +                                                         interface=interface_name,
    +                                                         operation=operation_name)
    +        else:
    --- End diff --
    
    We have quite a few tests that instantiate `OperationTask` "from scratch" using raw arguments,
instead of calling `for_node` and `for_relationship`. In order to support those I needed to
allow for this separate codepath.


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