[1/3] incubator-ariatosca git commit: Add types to modeling, plus many fixes to models
Repository: incubator-ariatosca Updated Branches: refs/heads/ARIA-105-integrate-modeling 58aac8da2 -> daa2d538b http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/daa2d538/extensions/aria_extension_tosca/simple_v1_0/modeling/__init__.py -- diff --git a/extensions/aria_extension_tosca/simple_v1_0/modeling/__init__.py b/extensions/aria_extension_tosca/simple_v1_0/modeling/__init__.py index 44e3cc5..c55ccdd 100644 --- a/extensions/aria_extension_tosca/simple_v1_0/modeling/__init__.py +++ b/extensions/aria_extension_tosca/simple_v1_0/modeling/__init__.py @@ -17,8 +17,7 @@ import re from types import FunctionType from datetime import datetime -from aria.parser.modeling import Type, RelationshipType, PolicyType -from aria.modeling.models import (ServiceTemplate, NodeTemplate, +from aria.modeling.models import (Type, ServiceTemplate, NodeTemplate, RequirementTemplate, RelationshipTemplate, CapabilityTemplate, GroupTemplate, PolicyTemplate, SubstitutionTemplate, SubstitutionTemplateMapping, InterfaceTemplate, OperationTemplate, @@ -29,7 +28,7 @@ from ..data_types import coerce_value def create_service_template_model(context): # pylint: disable=too-many-locals,too-many-branches model = ServiceTemplate(created_at=datetime.now(), -main_file_name='') +main_file_name=str(context.presentation.location)) model.description = context.presentation.get('service_template', 'description', 'value') @@ -47,27 +46,32 @@ def create_service_template_model(context): # pylint: disable=too-many-locals,to # Types create_types(context, context.modeling.node_types, - context.presentation.get('service_template', 'node_types')) + context.presentation.get('service_template', 'node_types'), + 'node') create_types(context, context.modeling.group_types, - context.presentation.get('service_template', 'group_types')) + context.presentation.get('service_template', 'group_types'), + 'group') create_types(context, - context.modeling.capability_types, - context.presentation.get('service_template', 'capability_types')) + context.modeling.policy_types, + context.presentation.get('service_template', 'policy_types'), + 'policy') create_types(context, context.modeling.relationship_types, context.presentation.get('service_template', 'relationship_types'), - create_relationship_type_model) + 'relationship') create_types(context, - context.modeling.policy_types, - context.presentation.get('service_template', 'policy_types'), - create_policy_type_model) -create_types(context, - context.modeling.artifact_types, - context.presentation.get('service_template', 'artifact_types')) + context.modeling.capability_types, + context.presentation.get('service_template', 'capability_types'), + 'capability') create_types(context, context.modeling.interface_types, - context.presentation.get('service_template', 'interface_types')) + context.presentation.get('service_template', 'interface_types'), + 'interface') +create_types(context, + context.modeling.artifact_types, + context.presentation.get('service_template', 'artifact_types'), + 'artifact') # Topology template topology_template = context.presentation.get('service_template', 'topology_template') @@ -77,13 +81,10 @@ def create_service_template_model(context): # pylint: disable=too-many-locals,to create_parameter_models_from_values(model.outputs, topology_template._get_output_values(context)) -# Policy templates -# (We need to do this before node and group templates, because we need plugins populated) +# Plugins policies = context.presentation.get('service_template', 'topology_template', 'policies') if policies: for policy in policies.itervalues(): - model.policy_templates.append(create_policy_template_model(context, policy)) - if context.modeling.policy_types.get_role(policy.type) == 'plugin': model.plugins[policy._name] = create_plugin_model(context, policy) @@ -93,6 +94,8 @@ def create_service_template_model(context): # pylint: disable=too-many-locals,to if node_templates: for node_template in
[3/3] incubator-ariatosca git commit: Add types to modeling, plus many fixes to models
Add types to modeling, plus many fixes to models Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/daa2d538 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/daa2d538 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/daa2d538 Branch: refs/heads/ARIA-105-integrate-modeling Commit: daa2d538b590e38ff97dcec2e721a011c37b3e15 Parents: 58aac8d Author: Tal LironAuthored: Thu Mar 2 20:15:12 2017 -0600 Committer: Tal Liron Committed: Thu Mar 2 20:15:12 2017 -0600 -- aria/VERSION.py | 4 +- aria/__init__.py| 40 +- aria/cli/commands.py| 3 +- aria/exceptions.py | 4 +- aria/modeling/bases.py | 309 + aria/modeling/misc.py | 208 ++ aria/modeling/models.py | 163 +++-- aria/modeling/orchestration.py | 166 ++--- aria/modeling/service.py| 467 ++--- aria/modeling/service_template.py | 664 --- aria/modeling/types.py | 6 + aria/orchestrator/__init__.py | 2 +- aria/orchestrator/workflows/api/task.py | 4 +- aria/orchestrator/workflows/builtin/utils.py| 1 - .../workflows/core/events_handler.py| 2 +- aria/orchestrator/workflows/dry.py | 2 +- aria/orchestrator/workflows/events_logging.py | 2 +- aria/parser/consumption/style.py| 2 +- aria/parser/modeling/__init__.py| 8 +- aria/parser/modeling/context.py | 31 +- aria/storage/__init__.py| 10 +- aria/storage/core.py| 10 +- docs/requirements.txt | 4 +- .../simple_v1_0/modeling/__init__.py| 418 ++-- 24 files changed, 1392 insertions(+), 1138 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/daa2d538/aria/VERSION.py -- diff --git a/aria/VERSION.py b/aria/VERSION.py index 7e11072..9ce332c 100644 --- a/aria/VERSION.py +++ b/aria/VERSION.py @@ -14,8 +14,8 @@ # limitations under the License. """ -Aria Version module: -* version: Aria Package version +ARIA Version module: +* version: ARIA Package version """ version = '0.1.0' # pylint: disable=C0103 http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/daa2d538/aria/__init__.py -- diff --git a/aria/__init__.py b/aria/__init__.py index 7e5da07..4675fc8 100644 --- a/aria/__init__.py +++ b/aria/__init__.py @@ -14,7 +14,7 @@ # limitations under the License. """ -Aria top level package +ARIA top level package """ import pkgutil @@ -62,45 +62,9 @@ def application_model_storage(api, api_kwargs=None, initiator=None, initiator_kw """ Initiate model storage """ -models_to_register = [ -modeling.models.ServiceTemplate, -modeling.models.NodeTemplate, -modeling.models.GroupTemplate, -modeling.models.PolicyTemplate, -modeling.models.SubstitutionTemplate, -modeling.models.SubstitutionTemplateMapping, -modeling.models.RequirementTemplate, -modeling.models.RelationshipTemplate, -modeling.models.CapabilityTemplate, -modeling.models.InterfaceTemplate, -modeling.models.OperationTemplate, -modeling.models.ArtifactTemplate, - -modeling.models.Parameter, -modeling.models.Metadata, - -modeling.models.Service, -modeling.models.Node, -modeling.models.Group, -modeling.models.Policy, -modeling.models.SubstitutionMapping, -modeling.models.Substitution, -modeling.models.Relationship, -modeling.models.Capability, -modeling.models.Interface, -modeling.models.Operation, -modeling.models.Artifact, - -modeling.models.Execution, -modeling.models.ServiceUpdate, -modeling.models.ServiceUpdateStep, -modeling.models.ServiceModification, -modeling.models.Plugin, -modeling.models.Task -] return storage.ModelStorage(api_cls=api, api_kwargs=api_kwargs, -items=models_to_register, +items=modeling.models.models_to_register, initiator=initiator, initiator_kwargs=initiator_kwargs or {})
[2/3] incubator-ariatosca git commit: Add types to modeling, plus many fixes to models
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/daa2d538/aria/modeling/service_template.py -- diff --git a/aria/modeling/service_template.py b/aria/modeling/service_template.py index 081829e..b4c15bb 100644 --- a/aria/modeling/service_template.py +++ b/aria/modeling/service_template.py @@ -13,11 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines, no-self-argument, no-member, abstract-method from __future__ import absolute_import # so we can import standard 'types' - from copy import deepcopy from types import FunctionType from datetime import datetime @@ -30,32 +29,16 @@ from sqlalchemy import ( ) from sqlalchemy.ext.declarative import declared_attr -from ..storage import exceptions from ..parser import validation -from ..parser.modeling import utils as parser_utils from ..utils import collections, formatting, console -from .service import _InstanceModelMixin +from .bases import TemplateModelMixin from . import ( utils, types as modeling_types ) -# pylint: disable=no-self-argument, no-member, abstract-method - - - -class _TemplateModelMixin(_InstanceModelMixin): -""" -Mixin for :class:`ServiceTemplate` models. - -All model models can be instantiated into :class:`ServiceInstance` models. -""" - -def instantiate(self, context, container): -raise NotImplementedError - -class ServiceTemplateBase(_TemplateModelMixin): +class ServiceTemplateBase(TemplateModelMixin): """ A service template is a normalized blueprint from which :class:`ServiceInstance` instances can be created. @@ -64,6 +47,7 @@ class ServiceTemplateBase(_TemplateModelMixin): also be created programmatically. :ivar description: Human-readable description +:vartype description: string :ivar meta_data: Dict of :class:`Metadata` :ivar node_templates: List of :class:`NodeTemplate` :ivar group_templates: List of :class:`GroupTemplate` @@ -74,16 +58,14 @@ class ServiceTemplateBase(_TemplateModelMixin): :ivar operation_templates: Dict of :class:`OperationTemplate` """ -__tablename__ = 'service_template' # redundancy for PyLint: SqlAlchemy injects this - -__private_fields__ = ['substitution_template_fk'] +__tablename__ = 'service_template' description = Column(Text) @declared_attr def meta_data(cls): # Warning! We cannot use the attr name "metadata" because it's used by SqlAlchemy! -return cls.many_to_many_relationship('metadata', key_column_name='name') +return cls.many_to_many_relationship('metadata', dict_key='name') @declared_attr def node_templates(cls): @@ -104,18 +86,18 @@ class ServiceTemplateBase(_TemplateModelMixin): @declared_attr def inputs(cls): return cls.many_to_many_relationship('parameter', table_prefix='inputs', - key_column_name='name') + dict_key='name') @declared_attr def outputs(cls): return cls.many_to_many_relationship('parameter', table_prefix='outputs', - key_column_name='name') + dict_key='name') @declared_attr def operation_templates(cls): -return cls.one_to_many_relationship('operation_template', key_column_name='name') +return cls.one_to_many_relationship('operation_template', dict_key='name') -# region orchestrator required columns +# region orchestration created_at = Column(DateTime, nullable=False, index=True) updated_at = Column(DateTime) @@ -123,12 +105,14 @@ class ServiceTemplateBase(_TemplateModelMixin): @declared_attr def plugins(cls): -return cls.one_to_many_relationship('plugin', key_column_name='name') +return cls.one_to_many_relationship('plugin', dict_key='name') # endregion # region foreign keys +__private_fields__ = ['substitution_template_fk'] + # ServiceTemplate one-to-one to SubstitutionTemplate @declared_attr def substitution_template_fk(cls): @@ -143,6 +127,13 @@ class ServiceTemplateBase(_TemplateModelMixin): return node_template return None +def get_group_template(self, group_template_name): +if self.group_templates: +for group_template in self.group_templates: +if group_template.name == group_template_name: +return group_template +return None + @property def as_raw(self): return collections.OrderedDict(( @@ -232,13 +223,12 @@ class ServiceTemplateBase(_TemplateModelMixin): utils.dump_dict_values(context, self.operation_templates, 'Operation
Re: Board Report March 2017
I believe most of the folks could be at 'Mobile World Congress' at Barcelona this week, hence the silence. Could we wait till the weekend for the report to be filed? On Thu, Mar 2, 2017 at 7:46 AM, John D. Amentwrote: > Is anyone available to fill this out? > > On Tue, Feb 28, 2017 at 5:22 PM Suneel Marthi > wrote: > > > @Ran @Arthur > > > > Created a template here > > > > > > https://cwiki.apache.org/confluence/display/ARIATOSCA/ > Podling+Report+2017-03 > > > > > > Report's due for posting on March 1. > > >
Re: Board Report March 2017
Is anyone available to fill this out? On Tue, Feb 28, 2017 at 5:22 PM Suneel Marthiwrote: > @Ran @Arthur > > Created a template here > > > https://cwiki.apache.org/confluence/display/ARIATOSCA/Podling+Report+2017-03 > > > Report's due for posting on March 1. >