[jira] [Created] (ARIA-103) Remove Clint dependency

2017-02-09 Thread Tal Liron (JIRA)
Tal Liron created ARIA-103:
--

 Summary: Remove Clint dependency
 Key: ARIA-103
 URL: https://issues.apache.org/jira/browse/ARIA-103
 Project: AriaTosca
  Issue Type: Task
Reporter: Tal Liron
Assignee: Tal Liron
Priority: Minor


After some experimentation in other projects I came to the conclusion that 
Clint is not a very good/stable library. It can easily be replaced with a mix 
of Blessings+Colorama, which will be more minimal and also work fine on 
Windows. Our API won't have to change, so nothing will break.

See my Apache-licensed code here:

https://github.com/tliron/ronin/blob/master/ronin/utils/messages.py



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[2/6] incubator-ariatosca git commit: ARIA-44 Merge parser and storage models

2017-02-09 Thread emblemparade
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/3c53ea24/aria/storage/type.py
--
diff --git a/aria/storage/type.py b/aria/storage/type.py
deleted file mode 100644
index ac695b1..000
--- a/aria/storage/type.py
+++ /dev/null
@@ -1,299 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License.  You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import json
-from collections import namedtuple
-
-from sqlalchemy import (
-TypeDecorator,
-VARCHAR,
-event
-)
-from sqlalchemy.ext import mutable
-
-from . import exceptions
-
-
-class _MutableType(TypeDecorator):
-"""
-Dict representation of type.
-"""
-@property
-def python_type(self):
-raise NotImplementedError
-
-def process_literal_param(self, value, dialect):
-pass
-
-impl = VARCHAR
-
-def process_bind_param(self, value, dialect):
-if value is not None:
-value = json.dumps(value)
-return value
-
-def process_result_value(self, value, dialect):
-if value is not None:
-value = json.loads(value)
-return value
-
-
-class Dict(_MutableType):
-@property
-def python_type(self):
-return dict
-
-
-class List(_MutableType):
-@property
-def python_type(self):
-return list
-
-
-class _StrictDictMixin(object):
-
-@classmethod
-def coerce(cls, key, value):
-"Convert plain dictionaries to MutableDict."
-try:
-if not isinstance(value, cls):
-if isinstance(value, dict):
-for k, v in value.items():
-cls._assert_strict_key(k)
-cls._assert_strict_value(v)
-return cls(value)
-return mutable.MutableDict.coerce(key, value)
-else:
-return value
-except ValueError as e:
-raise exceptions.StorageError('SQL Storage error: 
{0}'.format(str(e)))
-
-def __setitem__(self, key, value):
-self._assert_strict_key(key)
-self._assert_strict_value(value)
-super(_StrictDictMixin, self).__setitem__(key, value)
-
-def setdefault(self, key, value):
-self._assert_strict_key(key)
-self._assert_strict_value(value)
-super(_StrictDictMixin, self).setdefault(key, value)
-
-def update(self, *args, **kwargs):
-for k, v in kwargs.items():
-self._assert_strict_key(k)
-self._assert_strict_value(v)
-super(_StrictDictMixin, self).update(*args, **kwargs)
-
-@classmethod
-def _assert_strict_key(cls, key):
-if cls._key_cls is not None and not isinstance(key, cls._key_cls):
-raise exceptions.StorageError("Key type was set strictly to {0}, 
but was {1}".format(
-cls._key_cls, type(key)
-))
-
-@classmethod
-def _assert_strict_value(cls, value):
-if cls._value_cls is not None and not isinstance(value, 
cls._value_cls):
-raise exceptions.StorageError("Value type was set strictly to {0}, 
but was {1}".format(
-cls._value_cls, type(value)
-))
-
-
-class _MutableDict(mutable.MutableDict):
-"""
-Enables tracking for dict values.
-"""
-
-@classmethod
-def coerce(cls, key, value):
-"Convert plain dictionaries to MutableDict."
-try:
-return mutable.MutableDict.coerce(key, value)
-except ValueError as e:
-raise exceptions.StorageError('SQL Storage error: 
{0}'.format(str(e)))
-
-
-class _StrictListMixin(object):
-
-@classmethod
-def coerce(cls, key, value):
-"Convert plain dictionaries to MutableDict."
-try:
-if not isinstance(value, cls):
-if isinstance(value, list):
-for item in value:
-cls._assert_item(item)
-return cls(value)
-return mutable.MutableList.coerce(key, value)
-else:
-return value
-except ValueError as e:
-raise exceptions.StorageError('SQL Storage error: 
{0}'.format(str(e)))
-
-def __setitem__(self, index, value):
-"""Detect list 

[1/6] incubator-ariatosca git commit: ARIA-44 Merge parser and storage models [Forced Update!]

2017-02-09 Thread emblemparade
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-44-Merge-parser-and-storage-models efc4dae7d -> 3c53ea244 
(forced update)


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/3c53ea24/tests/orchestrator/workflows/core/test_task.py
--
diff --git a/tests/orchestrator/workflows/core/test_task.py 
b/tests/orchestrator/workflows/core/test_task.py
index b39a81f..26564c5 100644
--- a/tests/orchestrator/workflows/core/test_task.py
+++ b/tests/orchestrator/workflows/core/test_task.py
@@ -28,30 +28,43 @@ from aria.orchestrator.workflows import (
 
 from tests import mock, storage
 
+OP_NAME = 'tosca.interfaces.node.lifecycle.Standard.create'
+RELATIONSHIP_OP_NAME = 'tosca.interfaces.relationship.Configure.pre_configure'
+
 
 @pytest.fixture
 def ctx(tmpdir):
 context = mock.context.simple(str(tmpdir))
+
+relationship = context.model.relationship.list()[0]
+relationship.interfaces = [
+mock.models.get_interface(RELATIONSHIP_OP_NAME, edge='source'),
+mock.models.get_interface(RELATIONSHIP_OP_NAME, edge='target')
+]
+context.model.relationship.update(relationship)
+
+dependent_node = 
context.model.node.get_by_name(mock.models.DEPENDENCY_NODE_INSTANCE_NAME)
+dependent_node.interfaces = [mock.models.get_interface(OP_NAME)]
+context.model.node.update(dependent_node)
+
 yield context
 storage.release_sqlite_storage(context.model)
 
 
 class TestOperationTask(object):
 
-def _create_node_operation_task(self, ctx, node_instance):
+def _create_node_operation_task(self, ctx, node):
 with workflow_context.current.push(ctx):
-api_task = api.task.OperationTask.node_instance(
-instance=node_instance,
+api_task = api.task.OperationTask.node(
+instance=node,
 name='tosca.interfaces.node.lifecycle.Standard.create')
 core_task = core.task.OperationTask(api_task=api_task)
 return api_task, core_task
 
-def _create_relationship_operation_task(self, ctx, relationship_instance, 
operation_end):
+def _create_relationship_operation_task(self, ctx, relationship, 
operation_name, edge):
 with workflow_context.current.push(ctx):
-api_task = api.task.OperationTask.relationship_instance(
-instance=relationship_instance,
-
name='tosca.interfaces.relationship.Configure.pre_configure_source',
-operation_end=operation_end)
+api_task = api.task.OperationTask.relationship(
+instance=relationship, name=operation_name, edge=edge)
 core_task = core.task.OperationTask(api_task=api_task)
 return api_task, core_task
 
@@ -60,45 +73,47 @@ class TestOperationTask(object):
 storage_plugin_other = mock.models.get_plugin(package_name='p0', 
package_version='0.0')
 ctx.model.plugin.put(storage_plugin_other)
 ctx.model.plugin.put(storage_plugin)
-node_instance = ctx.model.node_instance.get_by_name(
-mock.models.DEPENDENCY_NODE_INSTANCE_NAME)
-node = node_instance.node
+node = 
ctx.model.node.get_by_name(mock.models.DEPENDENCY_NODE_INSTANCE_NAME)
+node_template = node.node_template
 plugin_name = 'plugin1'
-node.plugins = [{'name': plugin_name,
- 'package_name': 'p1',
- 'package_version': '0.1'}]
-node.operations['tosca.interfaces.node.lifecycle.Standard.create'] = 
{'plugin': plugin_name}
-api_task, core_task = self._create_node_operation_task(ctx, 
node_instance)
+node_template.plugins = [{'name': 'plugin1',
+  'package_name': 'p1',
+  'package_version': '0.1'}]
+node.interfaces = [mock.models.get_interface(
+'tosca.interfaces.node.lifecycle.Standard.create',
+operation_kwargs=dict(plugin='plugin1')
+)]
+ctx.model.node_template.update(node_template)
+ctx.model.node.update(node)
+api_task, core_task = self._create_node_operation_task(ctx, node)
 storage_task = ctx.model.task.get_by_name(core_task.name)
 assert storage_task.plugin_name == plugin_name
 assert storage_task.execution_name == ctx.execution.name
-assert storage_task.runs_on.id == core_task.context.node_instance.id
+assert storage_task.runs_on == core_task.context.node
 assert core_task.model_task == storage_task
 assert core_task.name == api_task.name
-assert core_task.operation_mapping == api_task.operation_mapping
-assert core_task.actor == api_task.actor == node_instance
+assert core_task.implementation == api_task.implementation
+assert core_task.actor == api_task.actor == node
 assert core_task.inputs == api_task.inputs == 

[5/6] incubator-ariatosca git commit: ARIA-44 Merge parser and storage models

2017-02-09 Thread emblemparade
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/3c53ea24/aria/storage/base_model.py
--
diff --git a/aria/storage/base_model.py b/aria/storage/base_model.py
deleted file mode 100644
index f7d0e5b..000
--- a/aria/storage/base_model.py
+++ /dev/null
@@ -1,757 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License.  You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-"""
-Aria's storage.models module
-Path: aria.storage.models
-
-models module holds aria's models.
-
-classes:
-* Field - represents a single field.
-* IterField - represents an iterable field.
-* Model - abstract model implementation.
-* Snapshot - snapshots implementation model.
-* Deployment - deployment implementation model.
-* DeploymentUpdateStep - deployment update step implementation model.
-* DeploymentUpdate - deployment update implementation model.
-* DeploymentModification - deployment modification implementation model.
-* Execution - execution implementation model.
-* Node - node implementation model.
-* Relationship - relationship implementation model.
-* NodeInstance - node instance implementation model.
-* RelationshipInstance - relationship instance implementation model.
-* Plugin - plugin implementation model.
-"""
-from collections import namedtuple
-from datetime import datetime
-
-from sqlalchemy.ext.associationproxy import association_proxy
-from sqlalchemy.ext.declarative import declared_attr
-from sqlalchemy import (
-Column,
-Integer,
-Text,
-DateTime,
-Boolean,
-Enum,
-String,
-Float,
-orm,
-)
-from sqlalchemy.ext.orderinglist import ordering_list
-
-from ..orchestrator.exceptions import TaskAbortException, TaskRetryException
-from .structure import ModelMixin
-from .type import (
-List,
-Dict
-)
-
-__all__ = (
-'BlueprintBase',
-'DeploymentBase',
-'DeploymentUpdateStepBase',
-'DeploymentUpdateBase',
-'DeploymentModificationBase',
-'ExecutionBase',
-'NodeBase',
-'RelationshipBase',
-'NodeInstanceBase',
-'RelationshipInstanceBase',
-'PluginBase',
-'TaskBase'
-)
-
-#pylint: disable=no-self-argument, abstract-method
-
-
-class BlueprintBase(ModelMixin):
-"""
-Blueprint model representation.
-"""
-__tablename__ = 'blueprints'
-
-created_at = Column(DateTime, nullable=False, index=True)
-main_file_name = Column(Text, nullable=False)
-plan = Column(Dict, nullable=False)
-updated_at = Column(DateTime)
-description = Column(Text)
-
-
-class DeploymentBase(ModelMixin):
-"""
-Deployment model representation.
-"""
-__tablename__ = 'deployments'
-
-_private_fields = ['blueprint_fk']
-
-created_at = Column(DateTime, nullable=False, index=True)
-description = Column(Text)
-inputs = Column(Dict)
-groups = Column(Dict)
-permalink = Column(Text)
-policy_triggers = Column(Dict)
-policy_types = Column(Dict)
-outputs = Column(Dict)
-scaling_groups = Column(Dict)
-updated_at = Column(DateTime)
-workflows = Column(Dict)
-
-@declared_attr
-def blueprint_fk(cls):
-return cls.foreign_key(BlueprintBase, nullable=False)
-
-@declared_attr
-def blueprint(cls):
-return cls.one_to_many_relationship('blueprint_fk')
-
-@declared_attr
-def blueprint_name(cls):
-return association_proxy('blueprint', cls.name_column_name())
-
-
-class ExecutionBase(ModelMixin):
-"""
-Execution model representation.
-"""
-# Needed only for pylint. the id will be populated by sqlalcehmy and the 
proper column.
-__tablename__ = 'executions'
-_private_fields = ['deployment_fk']
-
-TERMINATED = 'terminated'
-FAILED = 'failed'
-CANCELLED = 'cancelled'
-PENDING = 'pending'
-STARTED = 'started'
-CANCELLING = 'cancelling'
-FORCE_CANCELLING = 'force_cancelling'
-
-STATES = [TERMINATED, FAILED, CANCELLED, PENDING, STARTED, CANCELLING, 
FORCE_CANCELLING]
-END_STATES = [TERMINATED, FAILED, CANCELLED]
-ACTIVE_STATES = [state for state in STATES if state not in END_STATES]
-
-VALID_TRANSITIONS = {
-PENDING: [STARTED, CANCELLED],
-STARTED: 

[jira] [Commented] (ARIA-44) Merge parser and storage models

2017-02-09 Thread ASF subversion and git services (JIRA)

[ 
https://issues.apache.org/jira/browse/ARIA-44?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15859919#comment-15859919
 ] 

ASF subversion and git services commented on ARIA-44:
-

Commit 3c53ea24413745b7243dd467ffc1249c9126c3d1 in incubator-ariatosca's branch 
refs/heads/ARIA-44-Merge-parser-and-storage-models from mxmrlv
[ https://git-wip-us.apache.org/repos/asf?p=incubator-ariatosca.git;h=3c53ea2 ]

ARIA-44 Merge parser and storage models


> Merge parser and storage models
> ---
>
> Key: ARIA-44
> URL: https://issues.apache.org/jira/browse/ARIA-44
> Project: AriaTosca
>  Issue Type: Task
>Reporter: Ran Ziv
>Assignee: Maxim Orlov
>
> Currently there are separate but similar models in both the parser component 
> and the storage package.
> There should be a single set of models over at the storage package instead.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[3/6] incubator-ariatosca git commit: ARIA-44 Merge parser and storage models

2017-02-09 Thread emblemparade
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/3c53ea24/aria/storage/modeling/template_elements.py
--
diff --git a/aria/storage/modeling/template_elements.py 
b/aria/storage/modeling/template_elements.py
new file mode 100644
index 000..e9a2d24
--- /dev/null
+++ b/aria/storage/modeling/template_elements.py
@@ -0,0 +1,1387 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+from copy import deepcopy
+from types import FunctionType
+
+from sqlalchemy import (
+Column,
+Text,
+Integer,
+DateTime,
+Boolean,
+)
+from sqlalchemy.ext.associationproxy import association_proxy
+from sqlalchemy.ext.declarative import declared_attr
+
+from aria.parser import validation
+from aria.utils import collections, formatting, console
+
+from . import (
+utils,
+instance_elements,
+structure,
+type as aria_type
+)
+
+# pylint: disable=no-self-argument, no-member, abstract-method
+
+
+# region Element templates
+
+
+class ServiceTemplateBase(structure.ModelMixin):
+
+__tablename__ = 'service_template'
+
+__private_fields__ = ['substitution_template_fk']
+
+description = Column(Text)
+metadata = Column(Text)
+
+# region orchestrator required columns
+
+created_at = Column(DateTime, nullable=False, index=True)
+main_file_name = Column(Text)
+plan = Column(aria_type.Dict, nullable=False)
+updated_at = Column(DateTime)
+
+# endregion
+
+# region foreign keys
+@declared_attr
+def substitution_template_fk(cls):
+return cls.foreign_key('substitution_template', nullable=True)
+
+# endregion
+
+# region one-to-one relationships
+@declared_attr
+def substitution_template(cls):
+return cls.one_to_one_relationship('substitution_template')
+# endregion
+
+# region many-to-many relationships
+
+@declared_attr
+def inputs(cls):
+return cls.many_to_many_relationship('parameter', 
table_prefix='inputs')
+
+@declared_attr
+def outputs(cls):
+return cls.many_to_many_relationship('parameter', 
table_prefix='outputs')
+
+# endregion
+
+@property
+def as_raw(self):
+return collections.OrderedDict((
+('description', self.description),
+('metadata', formatting.as_raw(self.metadata)),
+('node_templates', formatting.as_raw_list(self.node_templates)),
+('group_templates', formatting.as_raw_list(self.group_templates)),
+('policy_templates', 
formatting.as_raw_list(self.policy_templates)),
+('substitution_template', 
formatting.as_raw(self.substitution_template)),
+('inputs', formatting.as_raw_dict(self.inputs)),
+('outputs', formatting.as_raw_dict(self.outputs)),
+('operation_templates', 
formatting.as_raw_list(self.operation_templates
+
+def instantiate(self, context, container):
+service_instance = instance_elements.ServiceInstanceBase()
+context.modeling.instance = service_instance
+
+service_instance.description = deepcopy_with_locators(self.description)
+
+if self.metadata is not None:
+service_instance.metadata = self.metadata.instantiate(context, 
container)
+
+for node_template in self.node_templates.itervalues():
+for _ in range(node_template.default_instances):
+node = node_template.instantiate(context, container)
+service_instance.nodes[node.id] = node
+
+utils.instantiate_dict(context, self, service_instance.groups, 
self.group_templates)
+utils.instantiate_dict(context, self, service_instance.policies, 
self.policy_templates)
+utils.instantiate_dict(context, self, service_instance.operations, 
self.operation_templates)
+
+if self.substitution_template is not None:
+service_instance.substitution = 
self.substitution_template.instantiate(context,
+   
container)
+
+utils.instantiate_dict(context, self, service_instance.inputs, 
self.inputs)
+utils.instantiate_dict(context, self, 

[6/6] incubator-ariatosca git commit: ARIA-44 Merge parser and storage models

2017-02-09 Thread emblemparade
ARIA-44 Merge parser and storage 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/3c53ea24
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/3c53ea24
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/3c53ea24

Branch: refs/heads/ARIA-44-Merge-parser-and-storage-models
Commit: 3c53ea24413745b7243dd467ffc1249c9126c3d1
Parents: 1498ad3
Author: mxmrlv 
Authored: Thu Jan 19 11:39:36 2017 +0200
Committer: Tal Liron 
Committed: Thu Feb 9 11:59:47 2017 -0600

--
 aria/__init__.py|   49 +-
 aria/cli/args_parser.py |4 +-
 aria/cli/commands.py|   15 +-
 aria/orchestrator/context/common.py |   22 +-
 aria/orchestrator/context/operation.py  |   43 +-
 aria/orchestrator/context/toolbelt.py   |2 +-
 aria/orchestrator/context/workflow.py   |   22 +-
 aria/orchestrator/runner.py |   11 +-
 aria/orchestrator/workflows/api/task.py |  149 +-
 .../workflows/builtin/execute_operation.py  |   54 +-
 aria/orchestrator/workflows/builtin/heal.py |   14 +-
 aria/orchestrator/workflows/builtin/install.py  |   16 +-
 aria/orchestrator/workflows/builtin/start.py|6 +-
 aria/orchestrator/workflows/builtin/stop.py |6 +-
 .../orchestrator/workflows/builtin/uninstall.py |   18 +-
 aria/orchestrator/workflows/builtin/utils.py|   52 +-
 .../orchestrator/workflows/builtin/workflows.py |  175 ++-
 aria/orchestrator/workflows/core/engine.py  |2 +-
 aria/orchestrator/workflows/core/task.py|   26 +-
 aria/orchestrator/workflows/executor/process.py |   14 +-
 aria/orchestrator/workflows/executor/thread.py  |2 +-
 aria/parser/modeling/__init__.py|8 +-
 aria/parser/modeling/storage.py |  224 ++-
 aria/parser/modeling/utils.py   |4 +-
 aria/storage/__init__.py|   13 +-
 aria/storage/api.py |6 +-
 aria/storage/base_model.py  |  757 --
 aria/storage/core.py|7 +-
 aria/storage/instrumentation.py |   15 +-
 aria/storage/model.py   |  110 --
 aria/storage/modeling/__init__.py   |   35 +
 aria/storage/modeling/elements.py   |  106 ++
 aria/storage/modeling/instance_elements.py  | 1288 
 aria/storage/modeling/model.py  |  219 +++
 aria/storage/modeling/orchestrator_elements.py  |  468 ++
 aria/storage/modeling/structure.py  |  320 
 aria/storage/modeling/template_elements.py  | 1387 ++
 aria/storage/modeling/type.py   |  302 
 aria/storage/modeling/utils.py  |  139 ++
 aria/storage/sql_mapi.py|6 +-
 aria/storage/structure.py   |  190 ---
 aria/storage/type.py|  299 
 aria/storage_initializer.py |  135 ++
 aria/utils/application.py   |   24 +-
 .../profiles/tosca-simple-1.0/groups.yaml   |2 +-
 tests/mock/context.py   |4 +-
 tests/mock/models.py|  123 +-
 tests/mock/topology.py  |   99 +-
 tests/orchestrator/context/test_operation.py|  125 +-
 .../context/test_resource_render.py |2 +-
 tests/orchestrator/context/test_serialize.py|   18 +-
 tests/orchestrator/context/test_toolbelt.py |   75 +-
 tests/orchestrator/context/test_workflow.py |   14 +-
 .../orchestrator/execution_plugin/test_local.py |   63 +-
 tests/orchestrator/execution_plugin/test_ssh.py |   21 +-
 tests/orchestrator/test_runner.py   |   11 +-
 tests/orchestrator/workflows/__init__.py|2 +-
 tests/orchestrator/workflows/api/test_task.py   |   83 +-
 .../workflows/builtin/test_execute_operation.py |   11 +-
 .../orchestrator/workflows/builtin/test_heal.py |8 +-
 .../orchestrator/workflows/core/test_engine.py  |   25 +-
 tests/orchestrator/workflows/core/test_task.py  |   80 +-
 .../test_task_graph_into_exececution_graph.py   |   20 +-
 .../workflows/executor/test_executor.py |9 +-
 .../workflows/executor/test_process_executor.py |8 +-
 .../executor/test_process_executor_extension.py |   15 +-
 .../test_process_executor_tracked_changes.py|   51 +-
 tests/resources/scripts/test_ssh.sh |   30 +-
 .../service_templates/node-cellar/workflows.py  |9 +-
 tests/storage/__init__.py   |   11 +-
 tests/storage/test_instrumentation.py   |   17 +-
 tests/storage/test_model_storage.py 

[4/6] incubator-ariatosca git commit: ARIA-44 Merge parser and storage models

2017-02-09 Thread emblemparade
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/3c53ea24/aria/storage/modeling/model.py
--
diff --git a/aria/storage/modeling/model.py b/aria/storage/modeling/model.py
new file mode 100644
index 000..62b90b3
--- /dev/null
+++ b/aria/storage/modeling/model.py
@@ -0,0 +1,219 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+from sqlalchemy.ext.declarative import declarative_base
+
+from . import (
+template_elements,
+instance_elements,
+orchestrator_elements,
+elements,
+structure,
+)
+
+__all__ = (
+'aria_declarative_base',
+
+'Parameter',
+
+'MappingTemplate',
+'InterfaceTemplate',
+'OperationTemplate',
+'ServiceTemplate',
+'NodeTemplate',
+'GroupTemplate',
+'ArtifactTemplate',
+'PolicyTemplate',
+'GroupPolicyTemplate',
+'GroupPolicyTriggerTemplate',
+'RequirementTemplate',
+'CapabilityTemplate',
+
+'Mapping',
+'Substitution',
+'ServiceInstance',
+'Node',
+'Relationship',
+'Artifact',
+'Group',
+'Interface',
+'Operation',
+'Capability',
+'Policy',
+'GroupPolicy',
+'GroupPolicyTrigger',
+
+'Execution',
+'ServiceInstanceUpdate',
+'ServiceInstanceUpdateStep',
+'ServiceInstanceModification',
+'Plugin',
+'Task'
+)
+
+aria_declarative_base = declarative_base(cls=structure.ModelIDMixin)
+
+# pylint: disable=abstract-method
+
+# region elements
+
+
+class Parameter(aria_declarative_base, elements.ParameterBase):
+pass
+
+# endregion
+
+# region template models
+
+
+class MappingTemplate(aria_declarative_base, 
template_elements.MappingTemplateBase):
+pass
+
+
+class SubstitutionTemplate(aria_declarative_base, 
template_elements.SubstitutionTemplateBase):
+pass
+
+
+class InterfaceTemplate(aria_declarative_base, 
template_elements.InterfaceTemplateBase):
+pass
+
+
+class OperationTemplate(aria_declarative_base, 
template_elements.OperationTemplateBase):
+pass
+
+
+class ServiceTemplate(aria_declarative_base, 
template_elements.ServiceTemplateBase):
+pass
+
+
+class NodeTemplate(aria_declarative_base, template_elements.NodeTemplateBase):
+pass
+
+
+class GroupTemplate(aria_declarative_base, 
template_elements.GroupTemplateBase):
+pass
+
+
+class ArtifactTemplate(aria_declarative_base, 
template_elements.ArtifactTemplateBase):
+pass
+
+
+class PolicyTemplate(aria_declarative_base, 
template_elements.PolicyTemplateBase):
+pass
+
+
+class GroupPolicyTemplate(aria_declarative_base, 
template_elements.GroupPolicyTemplateBase):
+pass
+
+
+class GroupPolicyTriggerTemplate(aria_declarative_base,
+ 
template_elements.GroupPolicyTriggerTemplateBase):
+pass
+
+
+class RequirementTemplate(aria_declarative_base, 
template_elements.RequirementTemplateBase):
+pass
+
+
+class CapabilityTemplate(aria_declarative_base, 
template_elements.CapabilityTemplateBase):
+pass
+
+
+# endregion
+
+# region instance models
+
+class Mapping(aria_declarative_base, instance_elements.MappingBase):
+pass
+
+
+class Substitution(aria_declarative_base, instance_elements.SubstitutionBase):
+pass
+
+
+class ServiceInstance(aria_declarative_base, 
instance_elements.ServiceInstanceBase):
+pass
+
+
+class Node(aria_declarative_base, instance_elements.NodeBase):
+pass
+
+
+class Relationship(aria_declarative_base, instance_elements.RelationshipBase):
+pass
+
+
+class Artifact(aria_declarative_base, instance_elements.ArtifactBase):
+pass
+
+
+class Group(aria_declarative_base, instance_elements.GroupBase):
+pass
+
+
+class Interface(aria_declarative_base, instance_elements.InterfaceBase):
+pass
+
+
+class Operation(aria_declarative_base, instance_elements.OperationBase):
+pass
+
+
+class Capability(aria_declarative_base, instance_elements.CapabilityBase):
+pass
+
+
+class Policy(aria_declarative_base, instance_elements.PolicyBase):
+pass
+
+
+class GroupPolicy(aria_declarative_base, instance_elements.GroupPolicyBase):
+pass
+
+
+class GroupPolicyTrigger(aria_declarative_base, 
instance_elements.GroupPolicyTriggerBase):
+pass
+
+
+# endregion
+
+# 

[05/11] incubator-ariatosca git commit: ARIA-44 Merge parser and storage models

2017-02-09 Thread mxmrlv
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/2b3276bb/aria/storage/modeling/template_elements.py
--
diff --git a/aria/storage/modeling/template_elements.py 
b/aria/storage/modeling/template_elements.py
new file mode 100644
index 000..17cc292
--- /dev/null
+++ b/aria/storage/modeling/template_elements.py
@@ -0,0 +1,1348 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+from copy import deepcopy
+from types import FunctionType
+
+from sqlalchemy import (
+Column,
+Text,
+Integer,
+DateTime,
+Boolean,
+)
+from sqlalchemy.ext.associationproxy import association_proxy
+from sqlalchemy.ext.declarative import declared_attr
+
+from aria.parser import validation
+from aria.utils import collections, formatting, console
+
+from . import (
+utils,
+instance_elements,
+structure,
+type as aria_type
+)
+
+# pylint: disable=no-self-argument, no-member, abstract-method
+
+
+# region Element templates
+
+
+class ServiceTemplateBase(structure.ModelMixin):
+
+__tablename__ = 'service_template'
+
+description = Column(Text)
+metadata = Column(Text)
+
+# region orchestrator required columns
+
+created_at = Column(DateTime, nullable=False, index=True)
+main_file_name = Column(Text)
+plan = Column(aria_type.Dict)
+updated_at = Column(DateTime)
+
+# endregion
+
+# region foreign keys
+@declared_attr
+def substitution_template_fk(cls):
+return cls.foreign_key('substitution_template', nullable=True)
+
+# endregion
+
+# region one-to-one relationships
+@declared_attr
+def substitution_template(cls):
+return cls.one_to_one_relationship('substitution_template')
+# endregion
+
+# region many-to-many relationships
+
+@declared_attr
+def inputs(cls):
+return cls.many_to_many_relationship('parameter', 
table_prefix='inputs')
+
+@declared_attr
+def outputs(cls):
+return cls.many_to_many_relationship('parameter', 
table_prefix='outputs')
+
+# endregion
+
+@property
+def as_raw(self):
+return collections.OrderedDict((
+('description', self.description),
+('metadata', formatting.as_raw(self.metadata)),
+('node_templates', formatting.as_raw_list(self.node_templates)),
+('group_templates', formatting.as_raw_list(self.group_templates)),
+('policy_templates', 
formatting.as_raw_list(self.policy_templates)),
+('substitution_template', 
formatting.as_raw(self.substitution_template)),
+('inputs', formatting.as_raw_dict(self.inputs)),
+('outputs', formatting.as_raw_dict(self.outputs)),
+('operation_templates', 
formatting.as_raw_list(self.operation_templates
+
+def instantiate(self, context, container):
+service_instance = instance_elements.ServiceInstanceBase()
+context.modeling.instance = service_instance
+
+service_instance.description = deepcopy_with_locators(self.description)
+
+if self.metadata is not None:
+service_instance.metadata = self.metadata.instantiate(context, 
container)
+
+for node_template in self.node_templates.itervalues():
+for _ in range(node_template.default_instances):
+node = node_template.instantiate(context, container)
+service_instance.nodes[node.id] = node
+
+utils.instantiate_dict(context, self, service_instance.groups, 
self.group_templates)
+utils.instantiate_dict(context, self, service_instance.policies, 
self.policy_templates)
+utils.instantiate_dict(context, self, service_instance.operations, 
self.operation_templates)
+
+if self.substitution_template is not None:
+service_instance.substitution = 
self.substitution_template.instantiate(context,
+   
container)
+
+utils.instantiate_dict(context, self, service_instance.inputs, 
self.inputs)
+utils.instantiate_dict(context, self, service_instance.outputs, 
self.outputs)
+
+for name, the_input in 

[03/11] incubator-ariatosca git commit: ARIA-44 Merge parser and storage models

2017-02-09 Thread mxmrlv
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/2b3276bb/tests/orchestrator/workflows/executor/test_executor.py
--
diff --git a/tests/orchestrator/workflows/executor/test_executor.py 
b/tests/orchestrator/workflows/executor/test_executor.py
index d983fe9..580bf8b 100644
--- a/tests/orchestrator/workflows/executor/test_executor.py
+++ b/tests/orchestrator/workflows/executor/test_executor.py
@@ -28,7 +28,7 @@ except ImportError:
 _celery = None
 app = None
 
-from aria.storage import model
+from aria.storage.modeling import model
 from aria.orchestrator import events
 from aria.orchestrator.workflows.executor import (
 thread,
@@ -43,7 +43,7 @@ def test_execute(executor):
 expected_value = 'value'
 successful_task = MockTask(mock_successful_task)
 failing_task = MockTask(mock_failing_task)
-task_with_inputs = MockTask(mock_task_with_input, inputs={'input': 
expected_value})
+task_with_inputs = MockTask(mock_task_with_input, 
inputs=dict(input='value'))
 
 for task in [successful_task, failing_task, task_with_inputs]:
 executor.execute(task)
@@ -105,8 +105,9 @@ class MockTask(object):
 self.exception = None
 self.id = str(uuid.uuid4())
 name = func.__name__
-operation = 
'tests.orchestrator.workflows.executor.test_executor.{name}'.format(name=name)
-self.operation_mapping = operation
+implementation = 
'tests.orchestrator.workflows.executor.test_executor.{name}'.format(
+name=name)
+self.implementation = implementation
 self.logger = logging.getLogger()
 self.name = name
 self.inputs = inputs or {}

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/2b3276bb/tests/orchestrator/workflows/executor/test_process_executor.py
--
diff --git a/tests/orchestrator/workflows/executor/test_process_executor.py 
b/tests/orchestrator/workflows/executor/test_process_executor.py
index ff5dce6..e904eb3 100644
--- a/tests/orchestrator/workflows/executor/test_process_executor.py
+++ b/tests/orchestrator/workflows/executor/test_process_executor.py
@@ -42,7 +42,7 @@ class TestProcessExecutor(object):
 
 def test_plugin_execution(self, executor, mock_plugin):
 task = MockTask(plugin=mock_plugin,
-operation='mock_plugin1.operation')
+implementation='mock_plugin1.operation')
 
 queue = Queue.Queue()
 
@@ -131,11 +131,11 @@ class MockTask(object):
 
 INFINITE_RETRIES = aria_model.Task.INFINITE_RETRIES
 
-def __init__(self, plugin, operation):
+def __init__(self, plugin, implementation):
 self.id = str(uuid.uuid4())
-self.operation_mapping = operation
+self.implementation = implementation
 self.logger = logging.getLogger()
-self.name = operation
+self.name = implementation
 self.inputs = {}
 self.context = MockContext()
 self.retry_count = 0

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/2b3276bb/tests/orchestrator/workflows/executor/test_process_executor_extension.py
--
diff --git 
a/tests/orchestrator/workflows/executor/test_process_executor_extension.py 
b/tests/orchestrator/workflows/executor/test_process_executor_extension.py
index 18957f1..cf9c071 100644
--- a/tests/orchestrator/workflows/executor/test_process_executor_extension.py
+++ b/tests/orchestrator/workflows/executor/test_process_executor_extension.py
@@ -30,14 +30,17 @@ def test_decorate_extension(context, executor):
 inputs = {'input1': 1, 'input2': 2}
 
 def get_node_instance(ctx):
-return 
ctx.model.node_instance.get_by_name(mock.models.DEPENDENCY_NODE_INSTANCE_NAME)
+return 
ctx.model.node.get_by_name(mock.models.DEPENDENCY_NODE_INSTANCE_NAME)
 
 @workflow
 def mock_workflow(ctx, graph):
 node_instance = get_node_instance(ctx)
 op = 'test.op'
-op_dict = {'operation': '{0}.{1}'.format(__name__, 
_mock_operation.__name__)}
-node_instance.node.operations['test.op'] = op_dict
+node_instance.interfaces = [mock.models.get_interface(
+op,
+operation_kwargs=dict(implementation='{0}.{1}'.format(__name__,
+  
_mock_operation.__name__))
+)]
 task = api.task.OperationTask.node_instance(instance=node_instance, 
name=op, inputs=inputs)
 graph.add_tasks(task)
 return graph
@@ -55,7 +58,7 @@ class MockProcessExecutorExtension(object):
 def decorate(self):
 def decorator(function):
 def wrapper(ctx, **operation_inputs):
-ctx.node_instance.runtime_properties['out'] = 
{'wrapper_inputs': operation_inputs}
+

[02/11] incubator-ariatosca git commit: ARIA-42-Generic-ctx-serialization-mechanism

2017-02-09 Thread mxmrlv
ARIA-42-Generic-ctx-serialization-mechanism


Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/1498ad39
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/1498ad39
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/1498ad39

Branch: refs/heads/ARIA-44-Merge-parser-and-storage-models
Commit: 1498ad397bcbed5a69c01f6d512a251e375792c7
Parents: d35d09a
Author: mxmrlv 
Authored: Wed Feb 1 16:16:01 2017 +0200
Committer: mxmrlv 
Committed: Thu Feb 9 11:00:23 2017 +0200

--
 aria/__init__.py| 25 +++---
 aria/orchestrator/context/operation.py  | 27 ++
 aria/orchestrator/context/serialization.py  | 95 
 aria/orchestrator/runner.py | 70 ---
 aria/orchestrator/workflows/executor/process.py | 11 +--
 aria/storage/api.py |  3 +-
 aria/storage/core.py| 55 ++--
 aria/storage/sql_mapi.py| 35 +++-
 setup.py|  2 +-
 tests/mock/context.py   | 32 ---
 tests/orchestrator/context/test_operation.py|  7 +-
 .../context/test_resource_render.py |  3 +-
 tests/orchestrator/context/test_serialize.py| 19 ++--
 tests/orchestrator/context/test_toolbelt.py |  2 +-
 tests/orchestrator/context/test_workflow.py |  6 +-
 .../orchestrator/execution_plugin/test_local.py |  4 +-
 tests/orchestrator/execution_plugin/test_ssh.py |  4 +-
 tests/orchestrator/workflows/api/test_task.py   |  4 +-
 .../workflows/builtin/test_execute_operation.py |  2 +-
 .../orchestrator/workflows/builtin/test_heal.py |  2 +-
 .../workflows/builtin/test_install.py   |  2 +-
 .../workflows/builtin/test_uninstall.py |  2 +-
 .../orchestrator/workflows/core/test_engine.py  |  2 +-
 tests/orchestrator/workflows/core/test_task.py  |  2 +-
 .../test_task_graph_into_exececution_graph.py   |  4 +-
 .../workflows/executor/test_executor.py |  9 +-
 .../workflows/executor/test_process_executor.py | 26 --
 .../executor/test_process_executor_extension.py |  2 +-
 .../test_process_executor_tracked_changes.py|  2 +-
 tests/storage/__init__.py   | 41 +++--
 tests/storage/test_instrumentation.py   |  9 +-
 tests/storage/test_model_storage.py |  7 +-
 tests/storage/test_models.py|  4 +-
 tests/storage/test_structures.py| 11 +--
 tests/utils/test_plugin.py  |  6 +-
 35 files changed, 254 insertions(+), 283 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/1498ad39/aria/__init__.py
--
diff --git a/aria/__init__.py b/aria/__init__.py
index 248aa1a..8b87473 100644
--- a/aria/__init__.py
+++ b/aria/__init__.py
@@ -57,7 +57,7 @@ def install_aria_extensions():
 extension.init()
 
 
-def application_model_storage(api, api_kwargs=None):
+def application_model_storage(api, api_kwargs=None, initiator=None, 
initiator_kwargs=None):
 """
 Initiate model storage
 """
@@ -78,19 +78,20 @@ def application_model_storage(api, api_kwargs=None):
 storage.model.Execution,
 storage.model.Task,
 ]
-# if api not in _model_storage:
-return storage.ModelStorage(api, items=models, api_kwargs=api_kwargs or {})
+return storage.ModelStorage(api_cls=api,
+api_kwargs=api_kwargs,
+items=models,
+initiator=initiator,
+initiator_kwargs=initiator_kwargs or {})
 
 
-def application_resource_storage(api, api_kwargs=None):
+def application_resource_storage(api, api_kwargs=None, initiator=None, 
initiator_kwargs=None):
 """
 Initiate resource storage
 """
-return storage.ResourceStorage(
-api,
-api_kwargs=api_kwargs or {},
-items=[
-'blueprint',
-'deployment',
-'plugin',
-])
+
+return storage.ResourceStorage(api_cls=api,
+   api_kwargs=api_kwargs,
+   items=['blueprint', 'deployment', 'plugin'],
+   initiator=initiator,
+   initiator_kwargs=initiator_kwargs)

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/1498ad39/aria/orchestrator/context/operation.py
--
diff --git a/aria/orchestrator/context/operation.py 

[09/11] incubator-ariatosca git commit: added private fields back to the models

2017-02-09 Thread mxmrlv
added private fields back to the 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/7dc36924
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/7dc36924
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/7dc36924

Branch: refs/heads/ARIA-44-Merge-parser-and-storage-models
Commit: 7dc3692469aa6d726b07d0fd50187194b4b46eee
Parents: 2b3276b
Author: mxmrlv 
Authored: Wed Feb 8 21:00:56 2017 +0200
Committer: mxmrlv 
Committed: Thu Feb 9 13:20:30 2017 +0200

--
 aria/storage/modeling/instance_elements.py | 42 -
 aria/storage/modeling/orchestrator_elements.py | 13 +--
 aria/storage/modeling/structure.py |  2 +-
 aria/storage/modeling/template_elements.py | 39 +++
 4 files changed, 91 insertions(+), 5 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/7dc36924/aria/storage/modeling/instance_elements.py
--
diff --git a/aria/storage/modeling/instance_elements.py 
b/aria/storage/modeling/instance_elements.py
index 9c5e750..7b8fe14 100644
--- a/aria/storage/modeling/instance_elements.py
+++ b/aria/storage/modeling/instance_elements.py
@@ -41,6 +41,9 @@ from . import (
 class ServiceInstanceBase(structure.ModelMixin):
 __tablename__ = 'service_instance'
 
+__private_fields__ = ['substituion_fk',
+  'service_template_fk']
+
 description = Column(Text)
 _metadata = Column(Text)
 
@@ -166,6 +169,10 @@ class OperationBase(structure.ModelMixin):
 * :code:`inputs`: Dict of :class:`Parameter`
 """
 __tablename__ = 'operation'
+
+__private_fields__ = ['service_template_fk',
+  'interface_instance_fk']
+
 # region foreign_keys
 
 @declared_attr
@@ -254,6 +261,12 @@ class InterfaceBase(structure.ModelMixin):
 * :code:`operations`: Dict of :class:`Operation`
 """
 __tablename__ = 'interface'
+
+__private_fields__ = ['group_fk',
+  'node_fk',
+  'relationship_fk']
+
+
 # region foreign_keys
 @declared_attr
 def group_fk(cls):
@@ -346,6 +359,9 @@ class CapabilityBase(structure.ModelMixin):
 * :code:`properties`: Dict of :class:`Parameter`
 """
 __tablename__ = 'capability'
+
+__private_fields__ = ['node_fk']
+
 # region foreign_keys
 @declared_attr
 def node_fk(cls):
@@ -358,7 +374,6 @@ class CapabilityBase(structure.ModelMixin):
 max_occurrences = Column(Integer, default=None) # optional
 occurrences = Column(Integer, default=0)
 
-
 # region many-to-one relationships
 @declared_attr
 def node(cls):
@@ -435,6 +450,9 @@ class ArtifactBase(structure.ModelMixin):
 * :code:`properties`: Dict of :class:`Parameter`
 """
 __tablename__ = 'artifact'
+
+__private_fields__ = ['node_fk']
+
 # region foreign_keys
 
 @declared_attr
@@ -519,7 +537,11 @@ class PolicyBase(structure.ModelMixin):
 * :code:`target_group_ids`: Must be represented in the 
:class:`ServiceInstance`
 """
 __tablename__ = 'policy'
+
+__private_fields__ = ['service_instance_fk']
+
 # region foreign_keys
+
 @declared_attr
 def service_instance_fk(cls):
 return cls.foreign_key('service_instance')
@@ -592,7 +614,11 @@ class GroupPolicyBase(structure.ModelMixin):
 * :code:`triggers`: Dict of :class:`GroupPolicyTrigger`
 """
 __tablename__ = 'group_policy'
+
+__private_fields__ = ['group_fk']
+
 # region foreign_keys
+
 @declared_attr
 def group_fk(cls):
 return cls.foreign_key('group')
@@ -662,6 +688,9 @@ class GroupPolicyTriggerBase(structure.ModelMixin):
 * :code:`properties`: Dict of :class:`Parameter`
 """
 __tablename__ = 'group_policy_trigger'
+
+__private_fields__ = ['group_policy_fk']
+
 # region foreign keys
 
 @declared_attr
@@ -752,6 +781,7 @@ class SubstitutionBase(structure.ModelMixin):
 * :code:`requirements`: Dict of :class:`Mapping`
 """
 __tablename__ = 'substitution'
+
 node_type_name = Column(Text)
 
 # region many-to-many relationships
@@ -822,6 +852,10 @@ class NodeBase(structure.ModelMixin):
 """
 __tablename__ = 'node'
 
+__private_fields__ = ['service_instance_fk',
+  'host_fk',
+  'node_template_fk']
+
 # region foreign_keys
 @declared_attr
 def service_instance_fk(cls):
@@ -1035,6 +1069,9 @@ class GroupBase(structure.ModelMixin):
 * :code:`member_group_ids`: Must be represented in the 
:class:`ServiceInstance`
 """
 __tablename__ = 'group'
+
+

[01/11] incubator-ariatosca git commit: ARIA-99 Straightforward end-to-end tests for parser and built-in workflow [Forced Update!]

2017-02-09 Thread mxmrlv
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-44-Merge-parser-and-storage-models 45b29fd54 -> efc4dae7d 
(forced update)


ARIA-99 Straightforward end-to-end tests for parser and built-in workflow


Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/d35d09a3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/d35d09a3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/d35d09a3

Branch: refs/heads/ARIA-44-Merge-parser-and-storage-models
Commit: d35d09a35422add7c3ee34053add05f41b8de1ba
Parents: e282f23
Author: Tal Liron 
Authored: Fri Feb 3 13:32:46 2017 -0600
Committer: Tal Liron 
Committed: Wed Feb 8 11:32:52 2017 -0600

--
 aria/cli/cli.py |   4 +-
 aria/parser/loading/request.py  |   9 +-
 aria/parser/loading/uri.py  |   5 +-
 aria/storage/filesystem_rapi.py |   2 +-
 aria/utils/uris.py  |  22 +-
 tests/conftest.py   |  23 ++
 tests/end2end/test_orchestrator.py  |  60 
 tests/end2end/test_parser.py|  40 +++
 tests/orchestrator/conftest.py  |  23 --
 tests/parser/__init__.py|  14 +
 tests/parser/service_templates.py   |  30 ++
 tests/parser/utils.py   |  78 +
 .../service_templates/node-cellar/inputs.yaml   |   3 +
 .../node-cellar/node-cellar.yaml| 299 +++
 .../node-cellar/types/aria.yaml |  93 ++
 .../node-cellar/types/mongodb.yaml  |  73 +
 .../node-cellar/types/nginx.yaml|  27 ++
 .../node-cellar/types/nodejs.yaml   |  69 +
 .../node-cellar/types/openstack.yaml| 201 +
 .../service_templates/node-cellar/types/os.yaml |  75 +
 .../service_templates/node-cellar/workflows.py  |  19 ++
 21 files changed, 1137 insertions(+), 32 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/d35d09a3/aria/cli/cli.py
--
diff --git a/aria/cli/cli.py b/aria/cli/cli.py
index 20ace2c..8d014b3 100644
--- a/aria/cli/cli.py
+++ b/aria/cli/cli.py
@@ -17,7 +17,9 @@
 CLI Entry point
 """
 
+import os
 import logging
+import tempfile
 
 from .. import install_aria_extensions
 from ..logger import (
@@ -100,7 +102,7 @@ def main():
 create_logger(
 handlers=[
 create_console_log_handler(),
-create_file_log_handler(file_path='/tmp/aria_cli.log'),
+
create_file_log_handler(file_path=os.path.join(tempfile.gettempdir(), 
'aria_cli.log')),
 ],
 level=logging.INFO)
 with AriaCli() as aria:

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/d35d09a3/aria/parser/loading/request.py
--
diff --git a/aria/parser/loading/request.py b/aria/parser/loading/request.py
index 6ebabfc..a809347 100644
--- a/aria/parser/loading/request.py
+++ b/aria/parser/loading/request.py
@@ -13,8 +13,11 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+import os
+import tempfile
+
 from requests import Session
-from requests.exceptions import ConnectionError
+from requests.exceptions import (ConnectionError, InvalidSchema)
 from cachecontrol import CacheControl
 from cachecontrol.caches import FileCache
 
@@ -22,7 +25,7 @@ from .exceptions import LoaderException, 
DocumentNotFoundException
 from .loader import Loader
 
 SESSION = None
-SESSION_CACHE_PATH = '/tmp'
+SESSION_CACHE_PATH = os.path.join(tempfile.gettempdir(), 'aria_requests')
 
 
 class RequestLoader(Loader):
@@ -53,6 +56,8 @@ class RequestLoader(Loader):
 
 try:
 self._response = SESSION.get(self.uri, headers=self.headers)
+except InvalidSchema as e:
+raise DocumentNotFoundException('document not found: "%s"' % 
self.uri, cause=e)
 except ConnectionError as e:
 raise LoaderException('request connection error: "%s"' % self.uri, 
cause=e)
 except Exception as e:

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/d35d09a3/aria/parser/loading/uri.py
--
diff --git a/aria/parser/loading/uri.py b/aria/parser/loading/uri.py
index f0cde3a..1b23bf6 100644
--- a/aria/parser/loading/uri.py
+++ b/aria/parser/loading/uri.py
@@ -66,8 +66,9 @@ class UriTextLoader(Loader):
 except DocumentNotFoundException:
 # Try prefixes in order
 for 

[11/11] incubator-ariatosca git commit: brought back most of the model tests and reabsed

2017-02-09 Thread mxmrlv
brought back most of the model tests and reabsed


Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/efc4dae7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/efc4dae7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/efc4dae7

Branch: refs/heads/ARIA-44-Merge-parser-and-storage-models
Commit: efc4dae7de7be37ce429bbad5f6acd92eff31573
Parents: 7dc3692
Author: mxmrlv 
Authored: Thu Feb 9 16:48:44 2017 +0200
Committer: mxmrlv 
Committed: Thu Feb 9 16:48:44 2017 +0200

--
 aria/orchestrator/context/operation.py  |   2 +-
 aria/orchestrator/context/workflow.py   |  10 +-
 aria/orchestrator/workflows/api/task.py |   6 +-
 .../workflows/builtin/execute_operation.py  |  54 +-
 aria/orchestrator/workflows/builtin/heal.py |   8 +-
 aria/orchestrator/workflows/builtin/install.py  |   6 +-
 .../orchestrator/workflows/builtin/uninstall.py |   2 +-
 aria/orchestrator/workflows/builtin/utils.py|  12 +-
 aria/parser/modeling/storage.py |   4 +-
 aria/storage/modeling/__init__.py   |   2 -
 aria/storage/modeling/elements.py   |   5 +-
 aria/storage/modeling/instance_elements.py  |  17 +-
 aria/storage/modeling/model.py  |  76 +--
 aria/storage/modeling/orchestrator_elements.py  |  12 +-
 aria/storage/modeling/template_elements.py  |   2 +-
 aria/storage/sql_mapi.py|   6 +-
 aria/storage_initializer.py |  10 +-
 aria/utils/application.py   |  10 +-
 tests/mock/context.py   |   4 +-
 tests/orchestrator/context/test_operation.py|   8 +-
 tests/orchestrator/context/test_serialize.py|   3 +-
 tests/orchestrator/context/test_toolbelt.py |   4 +-
 .../orchestrator/execution_plugin/test_local.py |   2 +-
 tests/orchestrator/execution_plugin/test_ssh.py |   2 +-
 tests/orchestrator/test_runner.py   |   4 +-
 tests/orchestrator/workflows/api/test_task.py   |   8 +-
 .../workflows/builtin/test_execute_operation.py |  11 +-
 .../orchestrator/workflows/builtin/test_heal.py |   8 +-
 .../orchestrator/workflows/core/test_engine.py  |   2 +-
 tests/orchestrator/workflows/core/test_task.py  |   4 +-
 .../test_task_graph_into_exececution_graph.py   |  12 +-
 .../executor/test_process_executor_extension.py |   2 +-
 .../test_process_executor_tracked_changes.py|   6 +-
 .../service_templates/node-cellar/workflows.py  |   4 +-
 tests/storage/__init__.py   |  33 +-
 tests/storage/test_instrumentation.py   |   6 +-
 tests/storage/test_model_storage.py |   2 +-
 tests/storage/test_models.py| 626 ---
 tests/storage/test_structures.py|  14 +-
 39 files changed, 459 insertions(+), 550 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/efc4dae7/aria/orchestrator/context/operation.py
--
diff --git a/aria/orchestrator/context/operation.py 
b/aria/orchestrator/context/operation.py
index d16a8ee..c5ac8f0 100644
--- a/aria/orchestrator/context/operation.py
+++ b/aria/orchestrator/context/operation.py
@@ -79,7 +79,7 @@ class BaseOperationContext(BaseContext):
 context_cls = self.__class__
 context_dict = {
 'name': self.name,
-'deployment_id': self._deployment_id,
+'service_instance_id': self._service_instance_id,
 'task_id': self._task_id,
 'actor_id': self._actor_id,
 'workdir': self._workdir,

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/efc4dae7/aria/orchestrator/context/workflow.py
--
diff --git a/aria/orchestrator/context/workflow.py 
b/aria/orchestrator/context/workflow.py
index 4a8d94f..00ed974 100644
--- a/aria/orchestrator/context/workflow.py
+++ b/aria/orchestrator/context/workflow.py
@@ -83,11 +83,11 @@ class WorkflowContext(BaseContext):
 """
 Iterator over nodes
 """
-key = 
'deployment_{0}'.format(self.model.node_template.model_cls.name_column_name())
+key = 
'service_instance_{0}'.format(self.model.node_template.model_cls.name_column_name())
 
-return self.model.node.iter(
+return self.model.node_template.iter(
 filters={
-key: getattr(self.service_instance, 
self.service_instance.node_template())
+key: getattr(self.service_instance, 
self.service_instance.name_column_name())
 }
 )
 
@@ -96,8 +96,8 @@ class WorkflowContext(BaseContext):
 

[jira] [Closed] (ARIA-42) Implement full blown mechanism for serializing an operation context

2017-02-09 Thread Ran Ziv (JIRA)

 [ 
https://issues.apache.org/jira/browse/ARIA-42?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Ran Ziv closed ARIA-42.
---

> Implement full blown mechanism for serializing an operation context
> ---
>
> Key: ARIA-42
> URL: https://issues.apache.org/jira/browse/ARIA-42
> Project: AriaTosca
>  Issue Type: Story
>Reporter: Dan Kilman
>Assignee: Maxim Orlov
> Fix For: 0.1.0
>
>
> The current mechanism at 
> aria/orchestration/workflows/context/serialization.py is very limited.
> It serializes/deserializes the context.model and context.resource with hard 
> coded knowledge of the actual implementation involved and even how they were 
> initialized. Specifically:
> The model storage initialized is always expected to be sqlachemy based with 
> no additional engine configuration (i.e. only the engine url is used to 
> re-construct the sqlalchemy engine), similar logic applies to the 
> instantiated sqlalchemy session.
> The resource storage initialized is always the file based resource storage.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[incubator-ariatosca] Git Push Summary

2017-02-09 Thread mxmrlv
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-42-Generic-ctx-serialization-mechanism [deleted] 1498ad397


[jira] [Commented] (ARIA-42) Implement full blown mechanism for serializing an operation context

2017-02-09 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/ARIA-42?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15859249#comment-15859249
 ] 

ASF GitHub Bot commented on ARIA-42:


Github user asfgit closed the pull request at:

https://github.com/apache/incubator-ariatosca/pull/68


> Implement full blown mechanism for serializing an operation context
> ---
>
> Key: ARIA-42
> URL: https://issues.apache.org/jira/browse/ARIA-42
> Project: AriaTosca
>  Issue Type: Story
>Reporter: Dan Kilman
>Assignee: Maxim Orlov
>
> The current mechanism at 
> aria/orchestration/workflows/context/serialization.py is very limited.
> It serializes/deserializes the context.model and context.resource with hard 
> coded knowledge of the actual implementation involved and even how they were 
> initialized. Specifically:
> The model storage initialized is always expected to be sqlachemy based with 
> no additional engine configuration (i.e. only the engine url is used to 
> re-construct the sqlalchemy engine), similar logic applies to the 
> instantiated sqlalchemy session.
> The resource storage initialized is always the file based resource storage.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Commented] (ARIA-42) Implement full blown mechanism for serializing an operation context

2017-02-09 Thread ASF subversion and git services (JIRA)

[ 
https://issues.apache.org/jira/browse/ARIA-42?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15859248#comment-15859248
 ] 

ASF subversion and git services commented on ARIA-42:
-

Commit 1498ad397bcbed5a69c01f6d512a251e375792c7 in incubator-ariatosca's branch 
refs/heads/master from mxmrlv
[ https://git-wip-us.apache.org/repos/asf?p=incubator-ariatosca.git;h=1498ad3 ]

ARIA-42-Generic-ctx-serialization-mechanism


> Implement full blown mechanism for serializing an operation context
> ---
>
> Key: ARIA-42
> URL: https://issues.apache.org/jira/browse/ARIA-42
> Project: AriaTosca
>  Issue Type: Story
>Reporter: Dan Kilman
>Assignee: Maxim Orlov
>
> The current mechanism at 
> aria/orchestration/workflows/context/serialization.py is very limited.
> It serializes/deserializes the context.model and context.resource with hard 
> coded knowledge of the actual implementation involved and even how they were 
> initialized. Specifically:
> The model storage initialized is always expected to be sqlachemy based with 
> no additional engine configuration (i.e. only the engine url is used to 
> re-construct the sqlalchemy engine), similar logic applies to the 
> instantiated sqlalchemy session.
> The resource storage initialized is always the file based resource storage.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[GitHub] incubator-ariatosca pull request #68: ARIA-42-Generic-ctx-serialization-mech...

2017-02-09 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/incubator-ariatosca/pull/68


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


incubator-ariatosca git commit: ARIA-42-Generic-ctx-serialization-mechanism

2017-02-09 Thread mxmrlv
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/master d35d09a35 -> 1498ad397


ARIA-42-Generic-ctx-serialization-mechanism


Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/1498ad39
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/1498ad39
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/1498ad39

Branch: refs/heads/master
Commit: 1498ad397bcbed5a69c01f6d512a251e375792c7
Parents: d35d09a
Author: mxmrlv 
Authored: Wed Feb 1 16:16:01 2017 +0200
Committer: mxmrlv 
Committed: Thu Feb 9 11:00:23 2017 +0200

--
 aria/__init__.py| 25 +++---
 aria/orchestrator/context/operation.py  | 27 ++
 aria/orchestrator/context/serialization.py  | 95 
 aria/orchestrator/runner.py | 70 ---
 aria/orchestrator/workflows/executor/process.py | 11 +--
 aria/storage/api.py |  3 +-
 aria/storage/core.py| 55 ++--
 aria/storage/sql_mapi.py| 35 +++-
 setup.py|  2 +-
 tests/mock/context.py   | 32 ---
 tests/orchestrator/context/test_operation.py|  7 +-
 .../context/test_resource_render.py |  3 +-
 tests/orchestrator/context/test_serialize.py| 19 ++--
 tests/orchestrator/context/test_toolbelt.py |  2 +-
 tests/orchestrator/context/test_workflow.py |  6 +-
 .../orchestrator/execution_plugin/test_local.py |  4 +-
 tests/orchestrator/execution_plugin/test_ssh.py |  4 +-
 tests/orchestrator/workflows/api/test_task.py   |  4 +-
 .../workflows/builtin/test_execute_operation.py |  2 +-
 .../orchestrator/workflows/builtin/test_heal.py |  2 +-
 .../workflows/builtin/test_install.py   |  2 +-
 .../workflows/builtin/test_uninstall.py |  2 +-
 .../orchestrator/workflows/core/test_engine.py  |  2 +-
 tests/orchestrator/workflows/core/test_task.py  |  2 +-
 .../test_task_graph_into_exececution_graph.py   |  4 +-
 .../workflows/executor/test_executor.py |  9 +-
 .../workflows/executor/test_process_executor.py | 26 --
 .../executor/test_process_executor_extension.py |  2 +-
 .../test_process_executor_tracked_changes.py|  2 +-
 tests/storage/__init__.py   | 41 +++--
 tests/storage/test_instrumentation.py   |  9 +-
 tests/storage/test_model_storage.py |  7 +-
 tests/storage/test_models.py|  4 +-
 tests/storage/test_structures.py| 11 +--
 tests/utils/test_plugin.py  |  6 +-
 35 files changed, 254 insertions(+), 283 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/1498ad39/aria/__init__.py
--
diff --git a/aria/__init__.py b/aria/__init__.py
index 248aa1a..8b87473 100644
--- a/aria/__init__.py
+++ b/aria/__init__.py
@@ -57,7 +57,7 @@ def install_aria_extensions():
 extension.init()
 
 
-def application_model_storage(api, api_kwargs=None):
+def application_model_storage(api, api_kwargs=None, initiator=None, 
initiator_kwargs=None):
 """
 Initiate model storage
 """
@@ -78,19 +78,20 @@ def application_model_storage(api, api_kwargs=None):
 storage.model.Execution,
 storage.model.Task,
 ]
-# if api not in _model_storage:
-return storage.ModelStorage(api, items=models, api_kwargs=api_kwargs or {})
+return storage.ModelStorage(api_cls=api,
+api_kwargs=api_kwargs,
+items=models,
+initiator=initiator,
+initiator_kwargs=initiator_kwargs or {})
 
 
-def application_resource_storage(api, api_kwargs=None):
+def application_resource_storage(api, api_kwargs=None, initiator=None, 
initiator_kwargs=None):
 """
 Initiate resource storage
 """
-return storage.ResourceStorage(
-api,
-api_kwargs=api_kwargs or {},
-items=[
-'blueprint',
-'deployment',
-'plugin',
-])
+
+return storage.ResourceStorage(api_cls=api,
+   api_kwargs=api_kwargs,
+   items=['blueprint', 'deployment', 'plugin'],
+   initiator=initiator,
+   initiator_kwargs=initiator_kwargs)

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/1498ad39/aria/orchestrator/context/operation.py
--
diff --git 

[2/2] incubator-ariatosca git commit: ARIA-42-Generic-ctx-serialization-mechanism

2017-02-09 Thread mxmrlv
ARIA-42-Generic-ctx-serialization-mechanism


Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/1498ad39
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/1498ad39
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/1498ad39

Branch: refs/heads/ARIA-42-Generic-ctx-serialization-mechanism
Commit: 1498ad397bcbed5a69c01f6d512a251e375792c7
Parents: d35d09a
Author: mxmrlv 
Authored: Wed Feb 1 16:16:01 2017 +0200
Committer: mxmrlv 
Committed: Thu Feb 9 11:00:23 2017 +0200

--
 aria/__init__.py| 25 +++---
 aria/orchestrator/context/operation.py  | 27 ++
 aria/orchestrator/context/serialization.py  | 95 
 aria/orchestrator/runner.py | 70 ---
 aria/orchestrator/workflows/executor/process.py | 11 +--
 aria/storage/api.py |  3 +-
 aria/storage/core.py| 55 ++--
 aria/storage/sql_mapi.py| 35 +++-
 setup.py|  2 +-
 tests/mock/context.py   | 32 ---
 tests/orchestrator/context/test_operation.py|  7 +-
 .../context/test_resource_render.py |  3 +-
 tests/orchestrator/context/test_serialize.py| 19 ++--
 tests/orchestrator/context/test_toolbelt.py |  2 +-
 tests/orchestrator/context/test_workflow.py |  6 +-
 .../orchestrator/execution_plugin/test_local.py |  4 +-
 tests/orchestrator/execution_plugin/test_ssh.py |  4 +-
 tests/orchestrator/workflows/api/test_task.py   |  4 +-
 .../workflows/builtin/test_execute_operation.py |  2 +-
 .../orchestrator/workflows/builtin/test_heal.py |  2 +-
 .../workflows/builtin/test_install.py   |  2 +-
 .../workflows/builtin/test_uninstall.py |  2 +-
 .../orchestrator/workflows/core/test_engine.py  |  2 +-
 tests/orchestrator/workflows/core/test_task.py  |  2 +-
 .../test_task_graph_into_exececution_graph.py   |  4 +-
 .../workflows/executor/test_executor.py |  9 +-
 .../workflows/executor/test_process_executor.py | 26 --
 .../executor/test_process_executor_extension.py |  2 +-
 .../test_process_executor_tracked_changes.py|  2 +-
 tests/storage/__init__.py   | 41 +++--
 tests/storage/test_instrumentation.py   |  9 +-
 tests/storage/test_model_storage.py |  7 +-
 tests/storage/test_models.py|  4 +-
 tests/storage/test_structures.py| 11 +--
 tests/utils/test_plugin.py  |  6 +-
 35 files changed, 254 insertions(+), 283 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/1498ad39/aria/__init__.py
--
diff --git a/aria/__init__.py b/aria/__init__.py
index 248aa1a..8b87473 100644
--- a/aria/__init__.py
+++ b/aria/__init__.py
@@ -57,7 +57,7 @@ def install_aria_extensions():
 extension.init()
 
 
-def application_model_storage(api, api_kwargs=None):
+def application_model_storage(api, api_kwargs=None, initiator=None, 
initiator_kwargs=None):
 """
 Initiate model storage
 """
@@ -78,19 +78,20 @@ def application_model_storage(api, api_kwargs=None):
 storage.model.Execution,
 storage.model.Task,
 ]
-# if api not in _model_storage:
-return storage.ModelStorage(api, items=models, api_kwargs=api_kwargs or {})
+return storage.ModelStorage(api_cls=api,
+api_kwargs=api_kwargs,
+items=models,
+initiator=initiator,
+initiator_kwargs=initiator_kwargs or {})
 
 
-def application_resource_storage(api, api_kwargs=None):
+def application_resource_storage(api, api_kwargs=None, initiator=None, 
initiator_kwargs=None):
 """
 Initiate resource storage
 """
-return storage.ResourceStorage(
-api,
-api_kwargs=api_kwargs or {},
-items=[
-'blueprint',
-'deployment',
-'plugin',
-])
+
+return storage.ResourceStorage(api_cls=api,
+   api_kwargs=api_kwargs,
+   items=['blueprint', 'deployment', 'plugin'],
+   initiator=initiator,
+   initiator_kwargs=initiator_kwargs)

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/1498ad39/aria/orchestrator/context/operation.py
--
diff --git a/aria/orchestrator/context/operation.py 

[jira] [Commented] (ARIA-42) Implement full blown mechanism for serializing an operation context

2017-02-09 Thread ASF subversion and git services (JIRA)

[ 
https://issues.apache.org/jira/browse/ARIA-42?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15859234#comment-15859234
 ] 

ASF subversion and git services commented on ARIA-42:
-

Commit 1498ad397bcbed5a69c01f6d512a251e375792c7 in incubator-ariatosca's branch 
refs/heads/ARIA-42-Generic-ctx-serialization-mechanism from mxmrlv
[ https://git-wip-us.apache.org/repos/asf?p=incubator-ariatosca.git;h=1498ad3 ]

ARIA-42-Generic-ctx-serialization-mechanism


> Implement full blown mechanism for serializing an operation context
> ---
>
> Key: ARIA-42
> URL: https://issues.apache.org/jira/browse/ARIA-42
> Project: AriaTosca
>  Issue Type: Story
>Reporter: Dan Kilman
>Assignee: Maxim Orlov
>
> The current mechanism at 
> aria/orchestration/workflows/context/serialization.py is very limited.
> It serializes/deserializes the context.model and context.resource with hard 
> coded knowledge of the actual implementation involved and even how they were 
> initialized. Specifically:
> The model storage initialized is always expected to be sqlachemy based with 
> no additional engine configuration (i.e. only the engine url is used to 
> re-construct the sqlalchemy engine), similar logic applies to the 
> instantiated sqlalchemy session.
> The resource storage initialized is always the file based resource storage.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[1/2] incubator-ariatosca git commit: ARIA-99 Straightforward end-to-end tests for parser and built-in workflow [Forced Update!]

2017-02-09 Thread mxmrlv
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-42-Generic-ctx-serialization-mechanism 6311e453f -> 1498ad397 
(forced update)


ARIA-99 Straightforward end-to-end tests for parser and built-in workflow


Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/d35d09a3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/d35d09a3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/d35d09a3

Branch: refs/heads/ARIA-42-Generic-ctx-serialization-mechanism
Commit: d35d09a35422add7c3ee34053add05f41b8de1ba
Parents: e282f23
Author: Tal Liron 
Authored: Fri Feb 3 13:32:46 2017 -0600
Committer: Tal Liron 
Committed: Wed Feb 8 11:32:52 2017 -0600

--
 aria/cli/cli.py |   4 +-
 aria/parser/loading/request.py  |   9 +-
 aria/parser/loading/uri.py  |   5 +-
 aria/storage/filesystem_rapi.py |   2 +-
 aria/utils/uris.py  |  22 +-
 tests/conftest.py   |  23 ++
 tests/end2end/test_orchestrator.py  |  60 
 tests/end2end/test_parser.py|  40 +++
 tests/orchestrator/conftest.py  |  23 --
 tests/parser/__init__.py|  14 +
 tests/parser/service_templates.py   |  30 ++
 tests/parser/utils.py   |  78 +
 .../service_templates/node-cellar/inputs.yaml   |   3 +
 .../node-cellar/node-cellar.yaml| 299 +++
 .../node-cellar/types/aria.yaml |  93 ++
 .../node-cellar/types/mongodb.yaml  |  73 +
 .../node-cellar/types/nginx.yaml|  27 ++
 .../node-cellar/types/nodejs.yaml   |  69 +
 .../node-cellar/types/openstack.yaml| 201 +
 .../service_templates/node-cellar/types/os.yaml |  75 +
 .../service_templates/node-cellar/workflows.py  |  19 ++
 21 files changed, 1137 insertions(+), 32 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/d35d09a3/aria/cli/cli.py
--
diff --git a/aria/cli/cli.py b/aria/cli/cli.py
index 20ace2c..8d014b3 100644
--- a/aria/cli/cli.py
+++ b/aria/cli/cli.py
@@ -17,7 +17,9 @@
 CLI Entry point
 """
 
+import os
 import logging
+import tempfile
 
 from .. import install_aria_extensions
 from ..logger import (
@@ -100,7 +102,7 @@ def main():
 create_logger(
 handlers=[
 create_console_log_handler(),
-create_file_log_handler(file_path='/tmp/aria_cli.log'),
+
create_file_log_handler(file_path=os.path.join(tempfile.gettempdir(), 
'aria_cli.log')),
 ],
 level=logging.INFO)
 with AriaCli() as aria:

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/d35d09a3/aria/parser/loading/request.py
--
diff --git a/aria/parser/loading/request.py b/aria/parser/loading/request.py
index 6ebabfc..a809347 100644
--- a/aria/parser/loading/request.py
+++ b/aria/parser/loading/request.py
@@ -13,8 +13,11 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+import os
+import tempfile
+
 from requests import Session
-from requests.exceptions import ConnectionError
+from requests.exceptions import (ConnectionError, InvalidSchema)
 from cachecontrol import CacheControl
 from cachecontrol.caches import FileCache
 
@@ -22,7 +25,7 @@ from .exceptions import LoaderException, 
DocumentNotFoundException
 from .loader import Loader
 
 SESSION = None
-SESSION_CACHE_PATH = '/tmp'
+SESSION_CACHE_PATH = os.path.join(tempfile.gettempdir(), 'aria_requests')
 
 
 class RequestLoader(Loader):
@@ -53,6 +56,8 @@ class RequestLoader(Loader):
 
 try:
 self._response = SESSION.get(self.uri, headers=self.headers)
+except InvalidSchema as e:
+raise DocumentNotFoundException('document not found: "%s"' % 
self.uri, cause=e)
 except ConnectionError as e:
 raise LoaderException('request connection error: "%s"' % self.uri, 
cause=e)
 except Exception as e:

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/d35d09a3/aria/parser/loading/uri.py
--
diff --git a/aria/parser/loading/uri.py b/aria/parser/loading/uri.py
index f0cde3a..1b23bf6 100644
--- a/aria/parser/loading/uri.py
+++ b/aria/parser/loading/uri.py
@@ -66,8 +66,9 @@ class UriTextLoader(Loader):
 except DocumentNotFoundException:
 # Try prefixes in order
 

[jira] [Commented] (ARIA-99) Straightforward end-to-end tests for parser and built-in workflow

2017-02-09 Thread ASF subversion and git services (JIRA)

[ 
https://issues.apache.org/jira/browse/ARIA-99?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15859233#comment-15859233
 ] 

ASF subversion and git services commented on ARIA-99:
-

Commit d35d09a35422add7c3ee34053add05f41b8de1ba in incubator-ariatosca's branch 
refs/heads/ARIA-42-Generic-ctx-serialization-mechanism from [~emblemparade]
[ https://git-wip-us.apache.org/repos/asf?p=incubator-ariatosca.git;h=d35d09a ]

ARIA-99 Straightforward end-to-end tests for parser and built-in workflow


> Straightforward end-to-end tests for parser and built-in workflow
> -
>
> Key: ARIA-99
> URL: https://issues.apache.org/jira/browse/ARIA-99
> Project: AriaTosca
>  Issue Type: Task
>Reporter: Tal Liron
>Assignee: Tal Liron
>Priority: Minor
>
> The idea is to start with a comprehensive blueprint and end up with valid 
> results. Essentially all mechanisms in ARIA will be tested except for the 
> actual CLI package -- the tests will simulate what happens when a user enters 
> a CLI command.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Assigned] (ARIA-88) Add blueprint examples

2017-02-09 Thread Ran Ziv (JIRA)

 [ 
https://issues.apache.org/jira/browse/ARIA-88?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Ran Ziv reassigned ARIA-88:
---

Assignee: Tal Liron

> Add blueprint examples
> --
>
> Key: ARIA-88
> URL: https://issues.apache.org/jira/browse/ARIA-88
> Project: AriaTosca
>  Issue Type: Story
>Reporter: Ran Ziv
>Assignee: Tal Liron
>Priority: Minor
>




--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Assigned] (ARIA-83) Store built-in YAMLs in TOSCA extension

2017-02-09 Thread Ran Ziv (JIRA)

 [ 
https://issues.apache.org/jira/browse/ARIA-83?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Ran Ziv reassigned ARIA-83:
---

Assignee: Tal Liron

> Store built-in YAMLs in TOSCA extension
> ---
>
> Key: ARIA-83
> URL: https://issues.apache.org/jira/browse/ARIA-83
> Project: AriaTosca
>  Issue Type: Story
>Reporter: Ran Ziv
>Assignee: Tal Liron
>
> The built-in YAMLs (plugin/workflow policy definitions, built-in workflow 
> policies, execution plugin's types and policy) should sit under the TOSCA 
> extension to be easily importable.
> (This also includes first writing the execution plugin's types and policy)



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)