[Slack] Notifications from the ASF team for June 1st, 2017 at 8:17 AM
Hi ARIA TOSCA, You have a new direct message from the ASF team (https://the-asf.slack.com/x-185534614710-190396332897/). --- @digestai View in the archives: https://the-asf.slack.com/x-185534614710-190396332897/archives/D5E4SCANM/p1496293281798907 Digest.AI (8:01 AM, June 1st) Hi ARIA, *Here’s your digest for June 1st 2017* There are 23 messages yesterday, and the most active user is sblackmon *#ariatosca* @emblemparade: [UPDATE] remaining fixes, then merged and closed ARIA-149, ARIA-121, and ARIA-190. works with maxim on debugging issues with openstack plugin/hello world. we believe that the issue is not not in aria proper but rather in the plugin adapter. we'll continue working on it. * * * You can snooze these notifications for an hour: https://the-asf.slack.com/unsub/U5FFQJ2LW-5a1cb74d28-notify-mute-1h eight hours: https://the-asf.slack.com/unsub/U5FFQJ2LW-796e6535e1-notify-mute-8h a day: https://the-asf.slack.com/unsub/U5FFQJ2LW-4e6e073ada-notify-mute-1d three days: https://the-asf.slack.com/unsub/U5FFQJ2LW-806a2d8aa0-notify-mute-3d or the next week: https://the-asf.slack.com/unsub/U5FFQJ2LW-6adc840c34-notify-mute-7d. You can also turn email notifications off: https://the-asf.slack.com/unsub/U5FFQJ2LW-64de78982b-notify. For more detailed preferences, see your account page: https://the-asf.slack.com/account.
[1/3] incubator-ariatosca git commit: ARIA-149 Enhance operation configuration [Forced Update!]
Repository: incubator-ariatosca Updated Branches: refs/heads/master 25ce830b7 -> 9174f9469 (forced update) http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/9174f946/tests/orchestrator/workflows/api/test_task.py -- diff --git a/tests/orchestrator/workflows/api/test_task.py b/tests/orchestrator/workflows/api/test_task.py index 642c785..9d91b6b 100644 --- a/tests/orchestrator/workflows/api/test_task.py +++ b/tests/orchestrator/workflows/api/test_task.py @@ -44,15 +44,15 @@ class TestOperationTask(object): plugin = mock.models.create_plugin('test_plugin', '0.1') ctx.model.node.update(plugin) -inputs = {'test_input': True} +arguments = {'test_input': True} interface = mock.models.create_interface( ctx.service, interface_name, operation_name, operation_kwargs=dict(plugin=plugin, - implementation='op_path', - inputs=inputs),) + function='op_path', + arguments=arguments),) node = ctx.model.node.get_by_name(mock.models.DEPENDENT_NODE_NAME) node.interfaces[interface_name] = interface @@ -66,7 +66,7 @@ class TestOperationTask(object): node, interface_name=interface_name, operation_name=operation_name, -inputs=inputs, +arguments=arguments, max_attempts=max_attempts, retry_interval=retry_interval, ignore_failure=ignore_failure) @@ -77,9 +77,9 @@ class TestOperationTask(object): interface=interface_name, operation=operation_name ) -assert api_task.implementation == 'op_path' +assert api_task.function == 'op_path' assert api_task.actor == node -assert api_task.inputs['test_input'].value is True +assert api_task.arguments['test_input'].value is True assert api_task.retry_interval == retry_interval assert api_task.max_attempts == max_attempts assert api_task.ignore_failure == ignore_failure @@ -92,15 +92,15 @@ class TestOperationTask(object): plugin = mock.models.create_plugin('test_plugin', '0.1') ctx.model.plugin.update(plugin) -inputs = {'test_input': True} +arguments = {'test_input': True} interface = mock.models.create_interface( ctx.service, interface_name, operation_name, operation_kwargs=dict(plugin=plugin, - implementation='op_path', - inputs=inputs) + function='op_path', + arguments=arguments) ) relationship = ctx.model.relationship.list()[0] @@ -113,7 +113,7 @@ class TestOperationTask(object): relationship, interface_name=interface_name, operation_name=operation_name, -inputs=inputs, +arguments=arguments, max_attempts=max_attempts, retry_interval=retry_interval) @@ -123,9 +123,9 @@ class TestOperationTask(object): interface=interface_name, operation=operation_name ) -assert api_task.implementation == 'op_path' +assert api_task.function == 'op_path' assert api_task.actor == relationship -assert api_task.inputs['test_input'].value is True +assert api_task.arguments['test_input'].value is True assert api_task.retry_interval == retry_interval assert api_task.max_attempts == max_attempts assert api_task.plugin.name == 'test_plugin' @@ -137,15 +137,15 @@ class TestOperationTask(object): plugin = mock.models.create_plugin('test_plugin', '0.1') ctx.model.node.update(plugin) -inputs = {'test_input': True} +arguments = {'test_input': True} interface = mock.models.create_interface( ctx.service, interface_name, operation_name, operation_kwargs=dict(plugin=plugin, - implementation='op_path', - inputs=inputs) + function='op_path', + arguments=arguments) ) relationship = ctx.model.relationship.list()[0] @@ -158,7 +158,7 @@ class TestOperationTask(object): relationship, interface_name=interface_name, operation_name=operation_name, -inputs=inputs, +arguments=arguments, max_attempts=max_attempts, retry_interval=retry_interval) @@ -168,9 +
[3/3] incubator-ariatosca git commit: ARIA-149 Enhance operation configuration
ARIA-149 Enhance operation configuration * Also fixes ARIA-121, ARIA-190 * Parse special "dependencies" configuration parameters as YAML and treat as Parameter models, allowing them full use of intrinsic functions, type coersions, and validations * Rename various functions that process "properties" to more generically process "parameters" (properties, inputs, attributes, arguments, etc.) * The "configuration" field in OperationTemplate and Operation models is now now a dict of Parameter models * Add "function" and "arguments" fields to Operation model to preserve user data (in "implementation" and "inputs") and to clearly demarcate orchestration data from user data; update task API accordingly * Some cleanup of parser code touched by this commit * Rename "create_parameters" to "merge_parameter_values" and improve Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/9174f946 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/9174f946 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/9174f946 Branch: refs/heads/master Commit: 9174f9469922c57f9a979c6161bd17a9f3f90c97 Parents: 07d7951 Author: Tal Liron Authored: Thu Apr 20 17:54:47 2017 -0500 Committer: Tal Liron Committed: Wed May 31 16:42:02 2017 -0500 -- aria/cli/commands/services.py | 2 +- aria/cli/execution_logging.py | 6 +- aria/core.py| 14 +- aria/modeling/constraints.py| 28 +++ aria/modeling/contraints.py | 28 --- aria/modeling/exceptions.py | 16 +- aria/modeling/orchestration.py | 14 +- aria/modeling/service_common.py | 7 +- aria/modeling/service_instance.py | 89 +--- aria/modeling/service_template.py | 67 +++--- aria/modeling/utils.py | 114 +- aria/orchestrator/__init__.py | 7 +- aria/orchestrator/context/operation.py | 4 +- aria/orchestrator/decorators.py | 3 +- .../execution_plugin/instantiation.py | 139 +++- aria/orchestrator/workflow_runner.py| 17 +- aria/orchestrator/workflows/api/task.py | 89 +--- .../workflows/builtin/execute_operation.py | 2 +- aria/orchestrator/workflows/core/task.py| 5 +- aria/orchestrator/workflows/events_logging.py | 6 +- aria/orchestrator/workflows/executor/base.py| 4 +- aria/orchestrator/workflows/executor/celery.py | 6 +- aria/orchestrator/workflows/executor/dry.py | 6 +- aria/orchestrator/workflows/executor/process.py | 12 +- aria/orchestrator/workflows/executor/thread.py | 6 +- aria/utils/formatting.py| 4 +- aria/utils/validation.py| 8 +- .../profiles/aria-1.0/aria-1.0.yaml | 8 - .../simple_v1_0/assignments.py | 4 +- .../simple_v1_0/modeling/__init__.py| 72 +-- .../simple_v1_0/modeling/artifacts.py | 2 +- .../simple_v1_0/modeling/capabilities.py| 24 ++- .../simple_v1_0/modeling/constraints.py | 2 +- .../simple_v1_0/modeling/data_types.py | 16 ++ .../simple_v1_0/modeling/functions.py | 4 +- .../simple_v1_0/modeling/interfaces.py | 34 ++- .../simple_v1_0/modeling/parameters.py | 211 +++ .../simple_v1_0/modeling/policies.py| 2 + .../simple_v1_0/modeling/properties.py | 202 -- .../simple_v1_0/modeling/requirements.py| 20 +- .../modeling/substitution_mappings.py | 4 + .../simple_v1_0/templates.py| 13 +- .../aria_extension_tosca/simple_v1_0/types.py | 24 +-- tests/cli/test_services.py | 14 +- tests/mock/models.py| 10 +- tests/mock/topology.py | 12 +- tests/modeling/test_models.py | 12 +- tests/orchestrator/context/test_operation.py| 86 tests/orchestrator/context/test_serialize.py| 6 +- tests/orchestrator/context/test_toolbelt.py | 14 +- .../orchestrator/execution_plugin/test_local.py | 14 +- tests/orchestrator/execution_plugin/test_ssh.py | 16 +- tests/orchestrator/test_workflow_runner.py | 16 +- tests/orchestrator/workflows/api/test_task.py | 40 ++-- .../workflows/builtin/test_execute_operation.py | 2 +- .../orchestrator/workflows/core/test_engine.py | 44 ++-- .../orchestrator/workflows/core/test_events.py | 3 +- tests/orchestrator/workflows/core/test_task.py | 10 +- .../test_task_graph_into_execution_graph.py | 6 +- .../orchestrator/workflows/executor/__init__.py
[2/3] incubator-ariatosca git commit: ARIA-149 Enhance operation configuration
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/9174f946/extensions/aria_extension_tosca/simple_v1_0/modeling/capabilities.py -- diff --git a/extensions/aria_extension_tosca/simple_v1_0/modeling/capabilities.py b/extensions/aria_extension_tosca/simple_v1_0/modeling/capabilities.py index 6df7177..a90a9fc 100644 --- a/extensions/aria_extension_tosca/simple_v1_0/modeling/capabilities.py +++ b/extensions/aria_extension_tosca/simple_v1_0/modeling/capabilities.py @@ -16,8 +16,9 @@ from aria.utils.collections import deepcopy_with_locators, OrderedDict from aria.parser.validation import Issue -from .properties import (convert_property_definitions_to_values, merge_raw_property_definitions, - get_assigned_and_defined_property_values) +from .parameters import (convert_parameter_definitions_to_values, merge_raw_parameter_definitions, + get_assigned_and_defined_parameter_values) + # # CapabilityType @@ -38,6 +39,7 @@ def get_inherited_valid_source_types(context, presentation): return valid_source_types + # # NodeType # @@ -92,6 +94,7 @@ def get_inherited_capability_definitions(context, presentation, for_presentation return capability_definitions + # # NodeTemplate # @@ -127,8 +130,9 @@ def get_template_capabilities(context, presentation): capability_assignment = capability_assignments[capability_name] # Assign properties -values = get_assigned_and_defined_property_values(context, - our_capability_assignment) +values = get_assigned_and_defined_parameter_values(context, + our_capability_assignment, + 'property') if values: capability_assignment._raw['properties'] = values else: @@ -139,6 +143,7 @@ def get_template_capabilities(context, presentation): return capability_assignments + # # Utils # @@ -150,24 +155,25 @@ def convert_capability_from_definition_to_assignment(context, presentation, cont properties = presentation.properties if properties is not None: -raw['properties'] = convert_property_definitions_to_values(context, properties) +raw['properties'] = convert_parameter_definitions_to_values(context, properties) # TODO attributes return CapabilityAssignment(name=presentation._name, raw=raw, container=container) + def merge_capability_definition_from_type(context, presentation, capability_definition): raw_properties = OrderedDict() # Merge properties from type the_type = capability_definition._get_type(context) type_property_defintions = the_type._get_properties(context) -merge_raw_property_definitions(context, presentation, raw_properties, type_property_defintions, - 'properties') +merge_raw_parameter_definitions(context, presentation, raw_properties, type_property_defintions, +'properties') # Merge our properties -merge_raw_property_definitions(context, presentation, raw_properties, - capability_definition.properties, 'properties') +merge_raw_parameter_definitions(context, presentation, raw_properties, +capability_definition.properties, 'properties') if raw_properties: capability_definition._raw['properties'] = raw_properties http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/9174f946/extensions/aria_extension_tosca/simple_v1_0/modeling/constraints.py -- diff --git a/extensions/aria_extension_tosca/simple_v1_0/modeling/constraints.py b/extensions/aria_extension_tosca/simple_v1_0/modeling/constraints.py index 7c99eab..9a30cc1 100644 --- a/extensions/aria_extension_tosca/simple_v1_0/modeling/constraints.py +++ b/extensions/aria_extension_tosca/simple_v1_0/modeling/constraints.py @@ -15,7 +15,7 @@ import re -from aria.modeling.contraints import NodeTemplateConstraint +from aria.modeling.constraints import NodeTemplateConstraint from aria.modeling.utils import NodeTemplateContainerHolder from aria.modeling.functions import evaluate from aria.parser import implements_specification http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/9174f946/extensions/aria_extension_tosca/simple_v1_0/modeling/data_types.py -- diff --git a/extensions/aria_extension_tosca/simple_v1_0/modeling/data_types.py b/extensions/aria_extension_tosca/simple_v1_0/modeling/data_types.py index 3952785..c0d79e5 100644 --- a/extensions/aria_ext
[1/3] incubator-ariatosca git commit: ARIA-149 Enhance operation configuration
Repository: incubator-ariatosca Updated Branches: refs/heads/master 07d79513a -> 25ce830b7 http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/25ce830b/tests/orchestrator/workflows/api/test_task.py -- diff --git a/tests/orchestrator/workflows/api/test_task.py b/tests/orchestrator/workflows/api/test_task.py index 642c785..9d91b6b 100644 --- a/tests/orchestrator/workflows/api/test_task.py +++ b/tests/orchestrator/workflows/api/test_task.py @@ -44,15 +44,15 @@ class TestOperationTask(object): plugin = mock.models.create_plugin('test_plugin', '0.1') ctx.model.node.update(plugin) -inputs = {'test_input': True} +arguments = {'test_input': True} interface = mock.models.create_interface( ctx.service, interface_name, operation_name, operation_kwargs=dict(plugin=plugin, - implementation='op_path', - inputs=inputs),) + function='op_path', + arguments=arguments),) node = ctx.model.node.get_by_name(mock.models.DEPENDENT_NODE_NAME) node.interfaces[interface_name] = interface @@ -66,7 +66,7 @@ class TestOperationTask(object): node, interface_name=interface_name, operation_name=operation_name, -inputs=inputs, +arguments=arguments, max_attempts=max_attempts, retry_interval=retry_interval, ignore_failure=ignore_failure) @@ -77,9 +77,9 @@ class TestOperationTask(object): interface=interface_name, operation=operation_name ) -assert api_task.implementation == 'op_path' +assert api_task.function == 'op_path' assert api_task.actor == node -assert api_task.inputs['test_input'].value is True +assert api_task.arguments['test_input'].value is True assert api_task.retry_interval == retry_interval assert api_task.max_attempts == max_attempts assert api_task.ignore_failure == ignore_failure @@ -92,15 +92,15 @@ class TestOperationTask(object): plugin = mock.models.create_plugin('test_plugin', '0.1') ctx.model.plugin.update(plugin) -inputs = {'test_input': True} +arguments = {'test_input': True} interface = mock.models.create_interface( ctx.service, interface_name, operation_name, operation_kwargs=dict(plugin=plugin, - implementation='op_path', - inputs=inputs) + function='op_path', + arguments=arguments) ) relationship = ctx.model.relationship.list()[0] @@ -113,7 +113,7 @@ class TestOperationTask(object): relationship, interface_name=interface_name, operation_name=operation_name, -inputs=inputs, +arguments=arguments, max_attempts=max_attempts, retry_interval=retry_interval) @@ -123,9 +123,9 @@ class TestOperationTask(object): interface=interface_name, operation=operation_name ) -assert api_task.implementation == 'op_path' +assert api_task.function == 'op_path' assert api_task.actor == relationship -assert api_task.inputs['test_input'].value is True +assert api_task.arguments['test_input'].value is True assert api_task.retry_interval == retry_interval assert api_task.max_attempts == max_attempts assert api_task.plugin.name == 'test_plugin' @@ -137,15 +137,15 @@ class TestOperationTask(object): plugin = mock.models.create_plugin('test_plugin', '0.1') ctx.model.node.update(plugin) -inputs = {'test_input': True} +arguments = {'test_input': True} interface = mock.models.create_interface( ctx.service, interface_name, operation_name, operation_kwargs=dict(plugin=plugin, - implementation='op_path', - inputs=inputs) + function='op_path', + arguments=arguments) ) relationship = ctx.model.relationship.list()[0] @@ -158,7 +158,7 @@ class TestOperationTask(object): relationship, interface_name=interface_name, operation_name=operation_name, -inputs=inputs, +arguments=arguments, max_attempts=max_attempts, retry_interval=retry_interval) @@ -168,9 +168,9 @@ class T
[2/3] incubator-ariatosca git commit: ARIA-149 Enhance operation configuration
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/25ce830b/extensions/aria_extension_tosca/simple_v1_0/modeling/capabilities.py -- diff --git a/extensions/aria_extension_tosca/simple_v1_0/modeling/capabilities.py b/extensions/aria_extension_tosca/simple_v1_0/modeling/capabilities.py index 6df7177..a90a9fc 100644 --- a/extensions/aria_extension_tosca/simple_v1_0/modeling/capabilities.py +++ b/extensions/aria_extension_tosca/simple_v1_0/modeling/capabilities.py @@ -16,8 +16,9 @@ from aria.utils.collections import deepcopy_with_locators, OrderedDict from aria.parser.validation import Issue -from .properties import (convert_property_definitions_to_values, merge_raw_property_definitions, - get_assigned_and_defined_property_values) +from .parameters import (convert_parameter_definitions_to_values, merge_raw_parameter_definitions, + get_assigned_and_defined_parameter_values) + # # CapabilityType @@ -38,6 +39,7 @@ def get_inherited_valid_source_types(context, presentation): return valid_source_types + # # NodeType # @@ -92,6 +94,7 @@ def get_inherited_capability_definitions(context, presentation, for_presentation return capability_definitions + # # NodeTemplate # @@ -127,8 +130,9 @@ def get_template_capabilities(context, presentation): capability_assignment = capability_assignments[capability_name] # Assign properties -values = get_assigned_and_defined_property_values(context, - our_capability_assignment) +values = get_assigned_and_defined_parameter_values(context, + our_capability_assignment, + 'property') if values: capability_assignment._raw['properties'] = values else: @@ -139,6 +143,7 @@ def get_template_capabilities(context, presentation): return capability_assignments + # # Utils # @@ -150,24 +155,25 @@ def convert_capability_from_definition_to_assignment(context, presentation, cont properties = presentation.properties if properties is not None: -raw['properties'] = convert_property_definitions_to_values(context, properties) +raw['properties'] = convert_parameter_definitions_to_values(context, properties) # TODO attributes return CapabilityAssignment(name=presentation._name, raw=raw, container=container) + def merge_capability_definition_from_type(context, presentation, capability_definition): raw_properties = OrderedDict() # Merge properties from type the_type = capability_definition._get_type(context) type_property_defintions = the_type._get_properties(context) -merge_raw_property_definitions(context, presentation, raw_properties, type_property_defintions, - 'properties') +merge_raw_parameter_definitions(context, presentation, raw_properties, type_property_defintions, +'properties') # Merge our properties -merge_raw_property_definitions(context, presentation, raw_properties, - capability_definition.properties, 'properties') +merge_raw_parameter_definitions(context, presentation, raw_properties, +capability_definition.properties, 'properties') if raw_properties: capability_definition._raw['properties'] = raw_properties http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/25ce830b/extensions/aria_extension_tosca/simple_v1_0/modeling/constraints.py -- diff --git a/extensions/aria_extension_tosca/simple_v1_0/modeling/constraints.py b/extensions/aria_extension_tosca/simple_v1_0/modeling/constraints.py index 7c99eab..9a30cc1 100644 --- a/extensions/aria_extension_tosca/simple_v1_0/modeling/constraints.py +++ b/extensions/aria_extension_tosca/simple_v1_0/modeling/constraints.py @@ -15,7 +15,7 @@ import re -from aria.modeling.contraints import NodeTemplateConstraint +from aria.modeling.constraints import NodeTemplateConstraint from aria.modeling.utils import NodeTemplateContainerHolder from aria.modeling.functions import evaluate from aria.parser import implements_specification http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/25ce830b/extensions/aria_extension_tosca/simple_v1_0/modeling/data_types.py -- diff --git a/extensions/aria_extension_tosca/simple_v1_0/modeling/data_types.py b/extensions/aria_extension_tosca/simple_v1_0/modeling/data_types.py index 3952785..c0d79e5 100644 --- a/extensions/aria_ext
[3/3] incubator-ariatosca git commit: ARIA-149 Enhance operation configuration
ARIA-149 Enhance operation configuration * Also fixes ARIA-121, ARIA-190 * Parse special "dependencies" configuration parameters as YAML and treat as Parameter models, allowing them full use of intrinsic functions, type coersions, and validations * Rename various functions that process "properties" to more generically process "parameters" (properties, inputs, attributes, arguments, etc.) * The "configuration" field in OperationTemplate and Operation models is now now a dict of Parameter models * Add "function" and "arguments" fields to Operation model to preserve user data (in "implementation" and "inputs") and to clearly demarcate orchestration data from user data; update task API accordingly * Some cleanup of parser code touched by this commit * Rename "create_parameters" to "merge_parameter_values" and improve Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/25ce830b Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/25ce830b Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/25ce830b Branch: refs/heads/master Commit: 25ce830b77f8b76e3a30576ccb5b00d5f4acfe72 Parents: 07d7951 Author: Tal Liron Authored: Thu Apr 20 17:54:47 2017 -0500 Committer: Tal Liron Committed: Wed May 31 15:15:56 2017 -0500 -- aria/cli/commands/services.py | 2 +- aria/cli/execution_logging.py | 6 +- aria/core.py| 14 +- aria/modeling/constraints.py| 28 +++ aria/modeling/contraints.py | 28 --- aria/modeling/exceptions.py | 16 +- aria/modeling/orchestration.py | 14 +- aria/modeling/service_common.py | 7 +- aria/modeling/service_instance.py | 89 +--- aria/modeling/service_template.py | 67 +++--- aria/modeling/utils.py | 114 +- aria/orchestrator/__init__.py | 7 +- aria/orchestrator/context/operation.py | 4 +- aria/orchestrator/decorators.py | 3 +- .../execution_plugin/instantiation.py | 139 +++- aria/orchestrator/workflow_runner.py| 17 +- aria/orchestrator/workflows/api/task.py | 89 +--- .../workflows/builtin/execute_operation.py | 2 +- aria/orchestrator/workflows/core/task.py| 5 +- aria/orchestrator/workflows/events_logging.py | 6 +- aria/orchestrator/workflows/executor/base.py| 4 +- aria/orchestrator/workflows/executor/celery.py | 6 +- aria/orchestrator/workflows/executor/dry.py | 6 +- aria/orchestrator/workflows/executor/process.py | 12 +- aria/orchestrator/workflows/executor/thread.py | 6 +- aria/utils/formatting.py| 4 +- aria/utils/validation.py| 8 +- .../profiles/aria-1.0/aria-1.0.yaml | 8 - .../simple_v1_0/assignments.py | 4 +- .../simple_v1_0/modeling/__init__.py| 72 +-- .../simple_v1_0/modeling/artifacts.py | 2 +- .../simple_v1_0/modeling/capabilities.py| 24 ++- .../simple_v1_0/modeling/constraints.py | 2 +- .../simple_v1_0/modeling/data_types.py | 16 ++ .../simple_v1_0/modeling/functions.py | 4 +- .../simple_v1_0/modeling/interfaces.py | 34 ++- .../simple_v1_0/modeling/parameters.py | 211 +++ .../simple_v1_0/modeling/policies.py| 2 + .../simple_v1_0/modeling/properties.py | 202 -- .../simple_v1_0/modeling/requirements.py| 20 +- .../modeling/substitution_mappings.py | 4 + .../simple_v1_0/templates.py| 13 +- .../aria_extension_tosca/simple_v1_0/types.py | 24 +-- tests/cli/test_services.py | 14 +- tests/mock/models.py| 10 +- tests/mock/topology.py | 12 +- tests/modeling/test_models.py | 12 +- tests/orchestrator/context/test_operation.py| 86 tests/orchestrator/context/test_serialize.py| 6 +- tests/orchestrator/context/test_toolbelt.py | 14 +- .../orchestrator/execution_plugin/test_local.py | 14 +- tests/orchestrator/execution_plugin/test_ssh.py | 16 +- tests/orchestrator/test_workflow_runner.py | 16 +- tests/orchestrator/workflows/api/test_task.py | 40 ++-- .../workflows/builtin/test_execute_operation.py | 2 +- .../orchestrator/workflows/core/test_engine.py | 44 ++-- .../orchestrator/workflows/core/test_events.py | 3 +- tests/orchestrator/workflows/core/test_task.py | 10 +- .../test_task_graph_into_execution_graph.py | 6 +- .../orchestrator/workflows/executor/__init__.py
[2/3] incubator-ariatosca git commit: ARIA-149 Enhance operation configuration
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/25ce830b/extensions/aria_extension_tosca/simple_v1_0/modeling/capabilities.py -- diff --git a/extensions/aria_extension_tosca/simple_v1_0/modeling/capabilities.py b/extensions/aria_extension_tosca/simple_v1_0/modeling/capabilities.py index 6df7177..a90a9fc 100644 --- a/extensions/aria_extension_tosca/simple_v1_0/modeling/capabilities.py +++ b/extensions/aria_extension_tosca/simple_v1_0/modeling/capabilities.py @@ -16,8 +16,9 @@ from aria.utils.collections import deepcopy_with_locators, OrderedDict from aria.parser.validation import Issue -from .properties import (convert_property_definitions_to_values, merge_raw_property_definitions, - get_assigned_and_defined_property_values) +from .parameters import (convert_parameter_definitions_to_values, merge_raw_parameter_definitions, + get_assigned_and_defined_parameter_values) + # # CapabilityType @@ -38,6 +39,7 @@ def get_inherited_valid_source_types(context, presentation): return valid_source_types + # # NodeType # @@ -92,6 +94,7 @@ def get_inherited_capability_definitions(context, presentation, for_presentation return capability_definitions + # # NodeTemplate # @@ -127,8 +130,9 @@ def get_template_capabilities(context, presentation): capability_assignment = capability_assignments[capability_name] # Assign properties -values = get_assigned_and_defined_property_values(context, - our_capability_assignment) +values = get_assigned_and_defined_parameter_values(context, + our_capability_assignment, + 'property') if values: capability_assignment._raw['properties'] = values else: @@ -139,6 +143,7 @@ def get_template_capabilities(context, presentation): return capability_assignments + # # Utils # @@ -150,24 +155,25 @@ def convert_capability_from_definition_to_assignment(context, presentation, cont properties = presentation.properties if properties is not None: -raw['properties'] = convert_property_definitions_to_values(context, properties) +raw['properties'] = convert_parameter_definitions_to_values(context, properties) # TODO attributes return CapabilityAssignment(name=presentation._name, raw=raw, container=container) + def merge_capability_definition_from_type(context, presentation, capability_definition): raw_properties = OrderedDict() # Merge properties from type the_type = capability_definition._get_type(context) type_property_defintions = the_type._get_properties(context) -merge_raw_property_definitions(context, presentation, raw_properties, type_property_defintions, - 'properties') +merge_raw_parameter_definitions(context, presentation, raw_properties, type_property_defintions, +'properties') # Merge our properties -merge_raw_property_definitions(context, presentation, raw_properties, - capability_definition.properties, 'properties') +merge_raw_parameter_definitions(context, presentation, raw_properties, +capability_definition.properties, 'properties') if raw_properties: capability_definition._raw['properties'] = raw_properties http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/25ce830b/extensions/aria_extension_tosca/simple_v1_0/modeling/constraints.py -- diff --git a/extensions/aria_extension_tosca/simple_v1_0/modeling/constraints.py b/extensions/aria_extension_tosca/simple_v1_0/modeling/constraints.py index 7c99eab..9a30cc1 100644 --- a/extensions/aria_extension_tosca/simple_v1_0/modeling/constraints.py +++ b/extensions/aria_extension_tosca/simple_v1_0/modeling/constraints.py @@ -15,7 +15,7 @@ import re -from aria.modeling.contraints import NodeTemplateConstraint +from aria.modeling.constraints import NodeTemplateConstraint from aria.modeling.utils import NodeTemplateContainerHolder from aria.modeling.functions import evaluate from aria.parser import implements_specification http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/25ce830b/extensions/aria_extension_tosca/simple_v1_0/modeling/data_types.py -- diff --git a/extensions/aria_extension_tosca/simple_v1_0/modeling/data_types.py b/extensions/aria_extension_tosca/simple_v1_0/modeling/data_types.py index 3952785..c0d79e5 100644 --- a/extensions/aria_ext
[3/3] incubator-ariatosca git commit: ARIA-149 Enhance operation configuration
ARIA-149 Enhance operation configuration * Also fixes ARIA-121, ARIA-190 * Parse special "dependencies" configuration parameters as YAML and treat as Parameter models, allowing them full use of intrinsic functions, type coersions, and validations * Rename various functions that process "properties" to more generically process "parameters" (properties, inputs, attributes, arguments, etc.) * The "configuration" field in OperationTemplate and Operation models is now now a dict of Parameter models * Add "function" and "arguments" fields to Operation model to preserve user data (in "implementation" and "inputs") and to clearly demarcate orchestration data from user data; update task API accordingly * Some cleanup of parser code touched by this commit * Rename "create_parameters" to "merge_parameter_values" and improve Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/25ce830b Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/25ce830b Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/25ce830b Branch: refs/heads/ARIA-149-functions-in-operation-configuration Commit: 25ce830b77f8b76e3a30576ccb5b00d5f4acfe72 Parents: 07d7951 Author: Tal Liron Authored: Thu Apr 20 17:54:47 2017 -0500 Committer: Tal Liron Committed: Wed May 31 15:15:56 2017 -0500 -- aria/cli/commands/services.py | 2 +- aria/cli/execution_logging.py | 6 +- aria/core.py| 14 +- aria/modeling/constraints.py| 28 +++ aria/modeling/contraints.py | 28 --- aria/modeling/exceptions.py | 16 +- aria/modeling/orchestration.py | 14 +- aria/modeling/service_common.py | 7 +- aria/modeling/service_instance.py | 89 +--- aria/modeling/service_template.py | 67 +++--- aria/modeling/utils.py | 114 +- aria/orchestrator/__init__.py | 7 +- aria/orchestrator/context/operation.py | 4 +- aria/orchestrator/decorators.py | 3 +- .../execution_plugin/instantiation.py | 139 +++- aria/orchestrator/workflow_runner.py| 17 +- aria/orchestrator/workflows/api/task.py | 89 +--- .../workflows/builtin/execute_operation.py | 2 +- aria/orchestrator/workflows/core/task.py| 5 +- aria/orchestrator/workflows/events_logging.py | 6 +- aria/orchestrator/workflows/executor/base.py| 4 +- aria/orchestrator/workflows/executor/celery.py | 6 +- aria/orchestrator/workflows/executor/dry.py | 6 +- aria/orchestrator/workflows/executor/process.py | 12 +- aria/orchestrator/workflows/executor/thread.py | 6 +- aria/utils/formatting.py| 4 +- aria/utils/validation.py| 8 +- .../profiles/aria-1.0/aria-1.0.yaml | 8 - .../simple_v1_0/assignments.py | 4 +- .../simple_v1_0/modeling/__init__.py| 72 +-- .../simple_v1_0/modeling/artifacts.py | 2 +- .../simple_v1_0/modeling/capabilities.py| 24 ++- .../simple_v1_0/modeling/constraints.py | 2 +- .../simple_v1_0/modeling/data_types.py | 16 ++ .../simple_v1_0/modeling/functions.py | 4 +- .../simple_v1_0/modeling/interfaces.py | 34 ++- .../simple_v1_0/modeling/parameters.py | 211 +++ .../simple_v1_0/modeling/policies.py| 2 + .../simple_v1_0/modeling/properties.py | 202 -- .../simple_v1_0/modeling/requirements.py| 20 +- .../modeling/substitution_mappings.py | 4 + .../simple_v1_0/templates.py| 13 +- .../aria_extension_tosca/simple_v1_0/types.py | 24 +-- tests/cli/test_services.py | 14 +- tests/mock/models.py| 10 +- tests/mock/topology.py | 12 +- tests/modeling/test_models.py | 12 +- tests/orchestrator/context/test_operation.py| 86 tests/orchestrator/context/test_serialize.py| 6 +- tests/orchestrator/context/test_toolbelt.py | 14 +- .../orchestrator/execution_plugin/test_local.py | 14 +- tests/orchestrator/execution_plugin/test_ssh.py | 16 +- tests/orchestrator/test_workflow_runner.py | 16 +- tests/orchestrator/workflows/api/test_task.py | 40 ++-- .../workflows/builtin/test_execute_operation.py | 2 +- .../orchestrator/workflows/core/test_engine.py | 44 ++-- .../orchestrator/workflows/core/test_events.py | 3 +- tests/orchestrator/workflows/core/test_task.py | 10 +- .../test_task_graph_into_execution_graph.py | 6 +- .../orche
[1/3] incubator-ariatosca git commit: ARIA-149 Enhance operation configuration [Forced Update!]
Repository: incubator-ariatosca Updated Branches: refs/heads/ARIA-149-functions-in-operation-configuration b602f1455 -> 25ce830b7 (forced update) http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/25ce830b/tests/orchestrator/workflows/api/test_task.py -- diff --git a/tests/orchestrator/workflows/api/test_task.py b/tests/orchestrator/workflows/api/test_task.py index 642c785..9d91b6b 100644 --- a/tests/orchestrator/workflows/api/test_task.py +++ b/tests/orchestrator/workflows/api/test_task.py @@ -44,15 +44,15 @@ class TestOperationTask(object): plugin = mock.models.create_plugin('test_plugin', '0.1') ctx.model.node.update(plugin) -inputs = {'test_input': True} +arguments = {'test_input': True} interface = mock.models.create_interface( ctx.service, interface_name, operation_name, operation_kwargs=dict(plugin=plugin, - implementation='op_path', - inputs=inputs),) + function='op_path', + arguments=arguments),) node = ctx.model.node.get_by_name(mock.models.DEPENDENT_NODE_NAME) node.interfaces[interface_name] = interface @@ -66,7 +66,7 @@ class TestOperationTask(object): node, interface_name=interface_name, operation_name=operation_name, -inputs=inputs, +arguments=arguments, max_attempts=max_attempts, retry_interval=retry_interval, ignore_failure=ignore_failure) @@ -77,9 +77,9 @@ class TestOperationTask(object): interface=interface_name, operation=operation_name ) -assert api_task.implementation == 'op_path' +assert api_task.function == 'op_path' assert api_task.actor == node -assert api_task.inputs['test_input'].value is True +assert api_task.arguments['test_input'].value is True assert api_task.retry_interval == retry_interval assert api_task.max_attempts == max_attempts assert api_task.ignore_failure == ignore_failure @@ -92,15 +92,15 @@ class TestOperationTask(object): plugin = mock.models.create_plugin('test_plugin', '0.1') ctx.model.plugin.update(plugin) -inputs = {'test_input': True} +arguments = {'test_input': True} interface = mock.models.create_interface( ctx.service, interface_name, operation_name, operation_kwargs=dict(plugin=plugin, - implementation='op_path', - inputs=inputs) + function='op_path', + arguments=arguments) ) relationship = ctx.model.relationship.list()[0] @@ -113,7 +113,7 @@ class TestOperationTask(object): relationship, interface_name=interface_name, operation_name=operation_name, -inputs=inputs, +arguments=arguments, max_attempts=max_attempts, retry_interval=retry_interval) @@ -123,9 +123,9 @@ class TestOperationTask(object): interface=interface_name, operation=operation_name ) -assert api_task.implementation == 'op_path' +assert api_task.function == 'op_path' assert api_task.actor == relationship -assert api_task.inputs['test_input'].value is True +assert api_task.arguments['test_input'].value is True assert api_task.retry_interval == retry_interval assert api_task.max_attempts == max_attempts assert api_task.plugin.name == 'test_plugin' @@ -137,15 +137,15 @@ class TestOperationTask(object): plugin = mock.models.create_plugin('test_plugin', '0.1') ctx.model.node.update(plugin) -inputs = {'test_input': True} +arguments = {'test_input': True} interface = mock.models.create_interface( ctx.service, interface_name, operation_name, operation_kwargs=dict(plugin=plugin, - implementation='op_path', - inputs=inputs) + function='op_path', + arguments=arguments) ) relationship = ctx.model.relationship.list()[0] @@ -158,7 +158,7 @@ class TestOperationTask(object): relationship, interface_name=interface_name, operation_name=operation_name, -inputs=inputs, +arguments=arguments, max_attempts=max_attempts, retr
[2/3] incubator-ariatosca git commit: ARIA-149 Enhance operation configuration
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/b602f145/extensions/aria_extension_tosca/simple_v1_0/modeling/capabilities.py -- diff --git a/extensions/aria_extension_tosca/simple_v1_0/modeling/capabilities.py b/extensions/aria_extension_tosca/simple_v1_0/modeling/capabilities.py index 6df7177..a90a9fc 100644 --- a/extensions/aria_extension_tosca/simple_v1_0/modeling/capabilities.py +++ b/extensions/aria_extension_tosca/simple_v1_0/modeling/capabilities.py @@ -16,8 +16,9 @@ from aria.utils.collections import deepcopy_with_locators, OrderedDict from aria.parser.validation import Issue -from .properties import (convert_property_definitions_to_values, merge_raw_property_definitions, - get_assigned_and_defined_property_values) +from .parameters import (convert_parameter_definitions_to_values, merge_raw_parameter_definitions, + get_assigned_and_defined_parameter_values) + # # CapabilityType @@ -38,6 +39,7 @@ def get_inherited_valid_source_types(context, presentation): return valid_source_types + # # NodeType # @@ -92,6 +94,7 @@ def get_inherited_capability_definitions(context, presentation, for_presentation return capability_definitions + # # NodeTemplate # @@ -127,8 +130,9 @@ def get_template_capabilities(context, presentation): capability_assignment = capability_assignments[capability_name] # Assign properties -values = get_assigned_and_defined_property_values(context, - our_capability_assignment) +values = get_assigned_and_defined_parameter_values(context, + our_capability_assignment, + 'property') if values: capability_assignment._raw['properties'] = values else: @@ -139,6 +143,7 @@ def get_template_capabilities(context, presentation): return capability_assignments + # # Utils # @@ -150,24 +155,25 @@ def convert_capability_from_definition_to_assignment(context, presentation, cont properties = presentation.properties if properties is not None: -raw['properties'] = convert_property_definitions_to_values(context, properties) +raw['properties'] = convert_parameter_definitions_to_values(context, properties) # TODO attributes return CapabilityAssignment(name=presentation._name, raw=raw, container=container) + def merge_capability_definition_from_type(context, presentation, capability_definition): raw_properties = OrderedDict() # Merge properties from type the_type = capability_definition._get_type(context) type_property_defintions = the_type._get_properties(context) -merge_raw_property_definitions(context, presentation, raw_properties, type_property_defintions, - 'properties') +merge_raw_parameter_definitions(context, presentation, raw_properties, type_property_defintions, +'properties') # Merge our properties -merge_raw_property_definitions(context, presentation, raw_properties, - capability_definition.properties, 'properties') +merge_raw_parameter_definitions(context, presentation, raw_properties, +capability_definition.properties, 'properties') if raw_properties: capability_definition._raw['properties'] = raw_properties http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/b602f145/extensions/aria_extension_tosca/simple_v1_0/modeling/constraints.py -- diff --git a/extensions/aria_extension_tosca/simple_v1_0/modeling/constraints.py b/extensions/aria_extension_tosca/simple_v1_0/modeling/constraints.py index 7c99eab..9a30cc1 100644 --- a/extensions/aria_extension_tosca/simple_v1_0/modeling/constraints.py +++ b/extensions/aria_extension_tosca/simple_v1_0/modeling/constraints.py @@ -15,7 +15,7 @@ import re -from aria.modeling.contraints import NodeTemplateConstraint +from aria.modeling.constraints import NodeTemplateConstraint from aria.modeling.utils import NodeTemplateContainerHolder from aria.modeling.functions import evaluate from aria.parser import implements_specification http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/b602f145/extensions/aria_extension_tosca/simple_v1_0/modeling/data_types.py -- diff --git a/extensions/aria_extension_tosca/simple_v1_0/modeling/data_types.py b/extensions/aria_extension_tosca/simple_v1_0/modeling/data_types.py index 3952785..c0d79e5 100644 --- a/extensions/aria_ext
[3/3] incubator-ariatosca git commit: ARIA-149 Enhance operation configuration
ARIA-149 Enhance operation configuration * Also fixes ARIA-121, ARIA-190 * Parse special "dependencies" configuration parameters as YAML and treat as Parameter models, allowing them full use of intrinsic functions, type coersions, and validations * Rename various functions that process "properties" to more generically process "parameters" (properties, inputs, attributes, arguments, etc.) * The "configuration" field in OperationTemplate and Operation models is now now a dict of Parameter models * Add "function" and "arguments" fields to Operation model to preserve user data (in "implementation" and "inputs") and to clearly demarcate orchestration data from user data; update task API accordingly * Some cleanup of parser code touched by this commit * Rename "create_parameters" to "merge_parameter_values" and improve Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/b602f145 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/b602f145 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/b602f145 Branch: refs/heads/ARIA-149-functions-in-operation-configuration Commit: b602f14554ae27853ea17c29a0c3f8f9f3fb37b6 Parents: 07d7951 Author: Tal Liron Authored: Thu Apr 20 17:54:47 2017 -0500 Committer: Tal Liron Committed: Wed May 31 15:09:11 2017 -0500 -- aria/cli/commands/services.py | 2 +- aria/cli/execution_logging.py | 6 +- aria/core.py| 14 +- aria/modeling/constraints.py| 28 +++ aria/modeling/contraints.py | 28 --- aria/modeling/exceptions.py | 16 +- aria/modeling/orchestration.py | 14 +- aria/modeling/service_common.py | 7 +- aria/modeling/service_instance.py | 89 +--- aria/modeling/service_template.py | 67 +++--- aria/modeling/utils.py | 114 +- aria/orchestrator/__init__.py | 7 +- aria/orchestrator/context/operation.py | 4 +- aria/orchestrator/decorators.py | 3 +- .../execution_plugin/instantiation.py | 139 +++- aria/orchestrator/workflow_runner.py| 17 +- aria/orchestrator/workflows/api/task.py | 89 +--- .../workflows/builtin/execute_operation.py | 2 +- aria/orchestrator/workflows/core/task.py| 5 +- aria/orchestrator/workflows/events_logging.py | 6 +- aria/orchestrator/workflows/executor/base.py| 4 +- aria/orchestrator/workflows/executor/celery.py | 6 +- aria/orchestrator/workflows/executor/dry.py | 6 +- aria/orchestrator/workflows/executor/process.py | 12 +- aria/orchestrator/workflows/executor/thread.py | 6 +- aria/utils/formatting.py| 4 +- aria/utils/validation.py| 8 +- .../profiles/aria-1.0/aria-1.0.yaml | 8 - .../simple_v1_0/assignments.py | 4 +- .../simple_v1_0/modeling/__init__.py| 73 +-- .../simple_v1_0/modeling/artifacts.py | 2 +- .../simple_v1_0/modeling/capabilities.py| 24 ++- .../simple_v1_0/modeling/constraints.py | 2 +- .../simple_v1_0/modeling/data_types.py | 16 ++ .../simple_v1_0/modeling/functions.py | 4 +- .../simple_v1_0/modeling/interfaces.py | 34 ++- .../simple_v1_0/modeling/parameters.py | 211 +++ .../simple_v1_0/modeling/policies.py| 2 + .../simple_v1_0/modeling/properties.py | 202 -- .../simple_v1_0/modeling/requirements.py| 20 +- .../modeling/substitution_mappings.py | 4 + .../simple_v1_0/templates.py| 13 +- .../aria_extension_tosca/simple_v1_0/types.py | 24 +-- tests/cli/test_services.py | 14 +- tests/mock/models.py| 10 +- tests/mock/topology.py | 12 +- tests/modeling/test_models.py | 12 +- tests/orchestrator/context/test_operation.py| 86 tests/orchestrator/context/test_serialize.py| 6 +- tests/orchestrator/context/test_toolbelt.py | 14 +- .../orchestrator/execution_plugin/test_local.py | 14 +- tests/orchestrator/execution_plugin/test_ssh.py | 16 +- tests/orchestrator/test_workflow_runner.py | 16 +- tests/orchestrator/workflows/api/test_task.py | 40 ++-- .../workflows/builtin/test_execute_operation.py | 2 +- .../orchestrator/workflows/core/test_engine.py | 44 ++-- .../orchestrator/workflows/core/test_events.py | 3 +- tests/orchestrator/workflows/core/test_task.py | 10 +- .../test_task_graph_into_execution_graph.py | 6 +- .../orche
[1/3] incubator-ariatosca git commit: ARIA-149 Enhance operation configuration [Forced Update!]
Repository: incubator-ariatosca Updated Branches: refs/heads/ARIA-149-functions-in-operation-configuration adf98c990 -> b602f1455 (forced update) http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/b602f145/tests/orchestrator/workflows/api/test_task.py -- diff --git a/tests/orchestrator/workflows/api/test_task.py b/tests/orchestrator/workflows/api/test_task.py index 642c785..9d91b6b 100644 --- a/tests/orchestrator/workflows/api/test_task.py +++ b/tests/orchestrator/workflows/api/test_task.py @@ -44,15 +44,15 @@ class TestOperationTask(object): plugin = mock.models.create_plugin('test_plugin', '0.1') ctx.model.node.update(plugin) -inputs = {'test_input': True} +arguments = {'test_input': True} interface = mock.models.create_interface( ctx.service, interface_name, operation_name, operation_kwargs=dict(plugin=plugin, - implementation='op_path', - inputs=inputs),) + function='op_path', + arguments=arguments),) node = ctx.model.node.get_by_name(mock.models.DEPENDENT_NODE_NAME) node.interfaces[interface_name] = interface @@ -66,7 +66,7 @@ class TestOperationTask(object): node, interface_name=interface_name, operation_name=operation_name, -inputs=inputs, +arguments=arguments, max_attempts=max_attempts, retry_interval=retry_interval, ignore_failure=ignore_failure) @@ -77,9 +77,9 @@ class TestOperationTask(object): interface=interface_name, operation=operation_name ) -assert api_task.implementation == 'op_path' +assert api_task.function == 'op_path' assert api_task.actor == node -assert api_task.inputs['test_input'].value is True +assert api_task.arguments['test_input'].value is True assert api_task.retry_interval == retry_interval assert api_task.max_attempts == max_attempts assert api_task.ignore_failure == ignore_failure @@ -92,15 +92,15 @@ class TestOperationTask(object): plugin = mock.models.create_plugin('test_plugin', '0.1') ctx.model.plugin.update(plugin) -inputs = {'test_input': True} +arguments = {'test_input': True} interface = mock.models.create_interface( ctx.service, interface_name, operation_name, operation_kwargs=dict(plugin=plugin, - implementation='op_path', - inputs=inputs) + function='op_path', + arguments=arguments) ) relationship = ctx.model.relationship.list()[0] @@ -113,7 +113,7 @@ class TestOperationTask(object): relationship, interface_name=interface_name, operation_name=operation_name, -inputs=inputs, +arguments=arguments, max_attempts=max_attempts, retry_interval=retry_interval) @@ -123,9 +123,9 @@ class TestOperationTask(object): interface=interface_name, operation=operation_name ) -assert api_task.implementation == 'op_path' +assert api_task.function == 'op_path' assert api_task.actor == relationship -assert api_task.inputs['test_input'].value is True +assert api_task.arguments['test_input'].value is True assert api_task.retry_interval == retry_interval assert api_task.max_attempts == max_attempts assert api_task.plugin.name == 'test_plugin' @@ -137,15 +137,15 @@ class TestOperationTask(object): plugin = mock.models.create_plugin('test_plugin', '0.1') ctx.model.node.update(plugin) -inputs = {'test_input': True} +arguments = {'test_input': True} interface = mock.models.create_interface( ctx.service, interface_name, operation_name, operation_kwargs=dict(plugin=plugin, - implementation='op_path', - inputs=inputs) + function='op_path', + arguments=arguments) ) relationship = ctx.model.relationship.list()[0] @@ -158,7 +158,7 @@ class TestOperationTask(object): relationship, interface_name=interface_name, operation_name=operation_name, -inputs=inputs, +arguments=arguments, max_attempts=max_attempts, retr
incubator-ariatosca git commit: wip [Forced Update!]
Repository: incubator-ariatosca Updated Branches: refs/heads/ARIA-262-Inconsistent-node-attributes-behavior 700a3568c -> 512dddf14 (forced update) wip Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/512dddf1 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/512dddf1 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/512dddf1 Branch: refs/heads/ARIA-262-Inconsistent-node-attributes-behavior Commit: 512dddf147dfb6bd5c600ceb9390cc94ba8fcbbc Parents: adf7607 Author: max-orlov Authored: Wed May 31 21:07:49 2017 +0300 Committer: max-orlov Committed: Wed May 31 21:09:25 2017 +0300 -- .../context/collection_instrumentation.py | 92 +--- aria/orchestrator/context/common.py | 5 ++ aria/orchestrator/context/operation.py | 22 ++--- 3 files changed, 74 insertions(+), 45 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/512dddf1/aria/orchestrator/context/collection_instrumentation.py -- diff --git a/aria/orchestrator/context/collection_instrumentation.py b/aria/orchestrator/context/collection_instrumentation.py index 91cfd35..00a9227 100644 --- a/aria/orchestrator/context/collection_instrumentation.py +++ b/aria/orchestrator/context/collection_instrumentation.py @@ -18,6 +18,30 @@ from functools import partial from aria.modeling import models +class _Wrapper(object): + +def __init__(self, instrumented_cls, instrumentation_cls, wrapped, **kwargs): +self._instrumented_cls = instrumented_cls +self._instrumentation_cls = instrumentation_cls +self._wrapped = wrapped +self._kwargs = kwargs + +def _wrap(self, value): +from aria.modeling.models import aria_declarative_base +if isinstance(value, self._instrumented_cls): +return Instrument(**self._kwargs) +elif isinstance(value, aria_declarative_base): +return _Wrapper( +self._instrumented_cls, self._instrumentation_cls, value, **self._kwargs) +return value + +def __getattr__(self, item): +return self._wrap(getattr(self._wrapped, item)) + +def __getitem__(self, item): +return self._wrap(self._wrapped[item]) + + class _InstrumentedCollection(object): def __init__(self, @@ -202,41 +226,47 @@ class _InstrumentedList(_InstrumentedCollection, list): return list(self) -class _InstrumentedModel(object): +class Instrument(object): -def __init__(self, field_name, original_model, model_storage): -super(_InstrumentedModel, self).__init__() -self._field_name = field_name +def __init__(self, original_model, model_storage, field_names): +super(Instrument, self).__init__() +self._field_names = field_names self._model_storage = model_storage self._original_model = original_model -self._apply_instrumentation() +self._instrumentation_cls = self._apply_instrumentation() def __getattr__(self, item): -return getattr(self._original_model, item) +return_value = getattr(self._original_model, item) +if isinstance(return_value, (list, dict)): +return _Wrapper(self._original_model.__class__, +self._instrumentation_cls, +return_value, +field_name=self._field_names, +original_model=self._original_model, +model_storage=self._model_storage, +) +return return_value def _apply_instrumentation(self): - -field = getattr(self._original_model, self._field_name) - -# Preserve the original value. e.g. original attributes would be located under -# _attributes -setattr(self, '_{0}'.format(self._field_name), field) - -# set instrumented value -setattr(self, self._field_name, _InstrumentedDict(self._model_storage, - self._original_model, - self._field_name, - field)) - - -def instrument_collection(field_name, func=None): -if func is None: -return partial(instrument_collection, field_name) - -def _wrapper(*args, **kwargs): -original_model = func(*args, **kwargs) -return type('Instrumented{0}'.format(original_model.__class__.__name__), -(_InstrumentedModel, ), -{})(field_name, original_model, args[0].model) - -return _wrapper +for field_name
incubator-ariatosca git commit: wip
Repository: incubator-ariatosca Updated Branches: refs/heads/ARIA-262-Inconsistent-node-attributes-behavior [created] 700a3568c wip Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/700a3568 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/700a3568 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/700a3568 Branch: refs/heads/ARIA-262-Inconsistent-node-attributes-behavior Commit: 700a3568c0389b7d4e476360e258e8368127a6e7 Parents: adf7607 Author: max-orlov Authored: Wed May 31 21:07:49 2017 +0300 Committer: max-orlov Committed: Wed May 31 21:07:49 2017 +0300 -- .../context/collection_instrumentation.py | 92 +--- aria/orchestrator/context/common.py | 5 ++ aria/orchestrator/context/operation.py | 22 ++--- 3 files changed, 74 insertions(+), 45 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/700a3568/aria/orchestrator/context/collection_instrumentation.py -- diff --git a/aria/orchestrator/context/collection_instrumentation.py b/aria/orchestrator/context/collection_instrumentation.py index 91cfd35..00a9227 100644 --- a/aria/orchestrator/context/collection_instrumentation.py +++ b/aria/orchestrator/context/collection_instrumentation.py @@ -18,6 +18,30 @@ from functools import partial from aria.modeling import models +class _Wrapper(object): + +def __init__(self, instrumented_cls, instrumentation_cls, wrapped, **kwargs): +self._instrumented_cls = instrumented_cls +self._instrumentation_cls = instrumentation_cls +self._wrapped = wrapped +self._kwargs = kwargs + +def _wrap(self, value): +from aria.modeling.models import aria_declarative_base +if isinstance(value, self._instrumented_cls): +return Instrument(**self._kwargs) +elif isinstance(value, aria_declarative_base): +return _Wrapper( +self._instrumented_cls, self._instrumentation_cls, value, **self._kwargs) +return value + +def __getattr__(self, item): +return self._wrap(getattr(self._wrapped, item)) + +def __getitem__(self, item): +return self._wrap(self._wrapped[item]) + + class _InstrumentedCollection(object): def __init__(self, @@ -202,41 +226,47 @@ class _InstrumentedList(_InstrumentedCollection, list): return list(self) -class _InstrumentedModel(object): +class Instrument(object): -def __init__(self, field_name, original_model, model_storage): -super(_InstrumentedModel, self).__init__() -self._field_name = field_name +def __init__(self, original_model, model_storage, field_names): +super(Instrument, self).__init__() +self._field_names = field_names self._model_storage = model_storage self._original_model = original_model -self._apply_instrumentation() +self._instrumentation_cls = self._apply_instrumentation() def __getattr__(self, item): -return getattr(self._original_model, item) +return_value = getattr(self._original_model, item) +if isinstance(return_value, (list, dict)): +return _Wrapper(self._original_model.__class__, +self._instrumentation_cls, +return_value, +field_name=self._field_names, +original_model=self._original_model, +model_storage=self._model_storage, +) +return return_value def _apply_instrumentation(self): - -field = getattr(self._original_model, self._field_name) - -# Preserve the original value. e.g. original attributes would be located under -# _attributes -setattr(self, '_{0}'.format(self._field_name), field) - -# set instrumented value -setattr(self, self._field_name, _InstrumentedDict(self._model_storage, - self._original_model, - self._field_name, - field)) - - -def instrument_collection(field_name, func=None): -if func is None: -return partial(instrument_collection, field_name) - -def _wrapper(*args, **kwargs): -original_model = func(*args, **kwargs) -return type('Instrumented{0}'.format(original_model.__class__.__name__), -(_InstrumentedModel, ), -{})(field_name, original_model, args[0].model) - -return _wrapper +for field_name in self._field_names
RE: Query related to substitution mapping
Hi Tal, Thanks for the explanation. I tried having the custom type in a separate file and imported it to both web.yaml and db.yaml. Now in my web.yaml "database" node-template is still an abstract one. To have the node-template "db-app" being substituted in place of "database" in web.yaml I still need to import db.yaml. This was my first question, Do we need to import db.yaml ( which provides the substitutable node-templates ) to web.yaml ( which has the abstract node template ) ? I also tried the below without any custom node-type 1) Created a service-template "st-1" from db.yaml 2) Created a service-template "st-2" from web.yaml 3) Had an abstract node-template "database" ( node-type: tosca.nodes.Database) as part of web.yaml "database" 4) Had an substation mapping of node-type "tosca.nodes.Database" with capability as "database_endpoint" 5) I dint import db.yaml to web.yaml I would expect the ARIA to go through the available service-templates (st-1) which provides the substation capability when I try to create a service from "st-2" ( web.yaml) But it fails here, as it has no target node_template. So it looks like ARIA wants the db.yaml to be imported to have the node-template ? Please find below yaml files and results. Node templates: +++-+---++ | id |name| description | service_template_name | type_name | +++-+---++ | 1 | db_app | | st-1 | tosca.nodes.Database| | 2 | db_server | | st-1 | tosca.nodes.DBMS | | 3 | db_host | | st-1 | tosca.nodes.Compute | | 4 | web_server | | st-2 | tosca.nodes.WebServer| | 5 | web_host | | st-2 | tosca.nodes.Compute | | 6 | web_app | | st-2 | tosca.nodes.WebApplication | | 7 | database | | st-2 | tosca.nodes.Database| +++-+---++ [root@DJ-DEV substitution]# [root@DJ-DEV substitution]# [root@DJ-DEV substitution]# aria services create -t st-2 s1 Creating new service from service template st-2... Validation issues: 5: requirement "host" of node "database_1" has no target node template Web.yaml tosca_definitions_version: tosca_simple_yaml_1_0 topology_template: node_templates: web_app: type: tosca.nodes.WebApplication interfaces: Standard: create: implementation: sample.samplemethod delete: implementation: sample.samplemethod requirements: - host: node: web_server - dependency: node: database web_server: type: tosca.nodes.WebServer interfaces: Standard: create: implementation: sample.samplemethod delete: implementation: sample.samplemethod requirements: - host: node: web_host web_host: type: tosca.nodes.Compute interfaces: Standard: create: implementation: sample.samplemethod delete: implementation: sample.samplemethod database: type: tosca.nodes.Database # type: my.nodes.database properties: name: web_db db.yaml tosca_definitions_version: tosca_simple_yaml_1_0 topology_template: substitution_mappings: node_type: tosca.nodes.Database #node_type: my.nodes.database capabilities: database_endpoint: [ db_app, database_endpoint ] node_templates: db_app: type: tosca.nodes.Database properties: name: sub_map_db interfaces: Standard: create: implementation: sample.samplemethod delete: implementation: sample.samplemethod requirements: - host: node: db_server db_server: type: tosca.nodes.DBMS interfaces: Standard: create: implementation: sample.samplemethod delete: implementation: sample.samplemethod requirements: - host: node: db_host db_host: type: tosca.nodes.Compute interfaces: Standard: create: implementation: sample.samplemethod delete: implementation: sample.samplemethod Regards DJ -Original Message- From: Tal Liron [mailto:t...@gigaspaces.com] Sent: Friday, May 26, 2017 9:40 PM To: dev@ariatosca.incubator.apache.org Subject: Re: Query related to substitution mapping Thanks, DJ. Much clearer now. Also it seems that the Apache mailing list throws away attachments, so we will have to paste things in email. I will clarify