[2/2] incubator-ariatosca git commit: wip
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/bfae4f39 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/bfae4f39 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/bfae4f39 Branch: refs/heads/ARIA-278-Remove-core-tasks Commit: bfae4f39c5d0496c76306d41c0463a1d8c19298d Parents: 2149a5e Author: max-orlov Authored: Sun Jun 11 19:05:35 2017 +0300 Committer: max-orlov Committed: Sun Jun 18 17:48:29 2017 +0300 -- aria/modeling/orchestration.py | 145 +++--- aria/orchestrator/context/operation.py | 7 + aria/orchestrator/context/workflow.py | 21 ++ aria/orchestrator/workflow_runner.py| 24 +- aria/orchestrator/workflows/core/__init__.py| 2 +- aria/orchestrator/workflows/core/engine.py | 211 +++ .../workflows/core/events_handler.py| 138 +- aria/orchestrator/workflows/core/task.py| 271 --- aria/orchestrator/workflows/core/translation.py | 109 aria/orchestrator/workflows/events_logging.py | 63 +++-- aria/orchestrator/workflows/executor/base.py| 36 +-- aria/orchestrator/workflows/executor/dry.py | 57 ++-- aria/orchestrator/workflows/executor/process.py | 18 +- aria/orchestrator/workflows/executor/thread.py | 18 +- tests/__init__.py | 2 + tests/end2end/testenv.py| 3 + tests/orchestrator/context/__init__.py | 9 +- tests/orchestrator/context/test_operation.py| 26 +- tests/orchestrator/context/test_serialize.py| 6 +- .../orchestrator/execution_plugin/test_local.py | 10 +- tests/orchestrator/execution_plugin/test_ssh.py | 10 +- tests/orchestrator/test_workflow_runner.py | 43 ++- .../orchestrator/workflows/core/test_engine.py | 23 +- .../orchestrator/workflows/core/test_events.py | 21 +- tests/orchestrator/workflows/core/test_task.py | 31 +-- .../test_task_graph_into_execution_graph.py | 59 ++-- .../orchestrator/workflows/executor/__init__.py | 89 +++--- .../workflows/executor/test_executor.py | 26 +- .../workflows/executor/test_process_executor.py | 26 +- .../executor/test_process_executor_extension.py | 6 +- .../test_process_executor_tracked_changes.py| 6 +- 31 files changed, 687 insertions(+), 829 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/bfae4f39/aria/modeling/orchestration.py -- diff --git a/aria/modeling/orchestration.py b/aria/modeling/orchestration.py index 995c8c2..007eefa 100644 --- a/aria/modeling/orchestration.py +++ b/aria/modeling/orchestration.py @@ -21,7 +21,6 @@ classes: """ # pylint: disable=no-self-argument, no-member, abstract-method - from datetime import datetime from sqlalchemy import ( @@ -34,19 +33,19 @@ from sqlalchemy import ( String, Float, orm, -) +PickleType) from sqlalchemy.ext.associationproxy import association_proxy from sqlalchemy.ext.declarative import declared_attr from ..orchestrator.exceptions import (TaskAbortException, TaskRetryException) -from .mixins import ModelMixin, ParameterMixin +from . import mixins from . import ( relationship, types as modeling_types ) -class ExecutionBase(ModelMixin): +class ExecutionBase(mixins.ModelMixin): """ Execution model representation. """ @@ -152,7 +151,7 @@ class ExecutionBase(ModelMixin): ) -class PluginBase(ModelMixin): +class PluginBase(mixins.ModelMixin): """ An installed plugin. @@ -213,7 +212,7 @@ class PluginBase(ModelMixin): uploaded_at = Column(DateTime, nullable=False, index=True) -class TaskBase(ModelMixin): +class TaskBase(mixins.ModelMixin): """ Represents the smallest unit of stateful execution in ARIA. The task state includes inputs, outputs, as well as an atomic status, ensuring that the task can only be running once at any @@ -257,10 +256,24 @@ class TaskBase(ModelMixin): __tablename__ = 'task' -__private_fields__ = ['node_fk', - 'relationship_fk', - 'plugin_fk', - 'execution_fk'] +__private_fields__ = ['dependency_operation_task_fk', 'dependency_stub_task_fk', 'node_fk', + 'relationship_fk', 'plugin_fk', 'execution_fk'] + +START_WORKFLOW = 'start_workflow' +END_WORKFLOW = 'end_workflow' +START_SUBWROFKLOW = 'start_subworkflow' +END_SUBWORKFLOW = 'end_subworkflow' +STUB = 'stub' +CONDITIONAL = 'conditional' + +STUB_TYPES = ( +START_WORKFLOW, +START_SUBWROFKLOW, +END_WORKFLO
[2/2] incubator-ariatosca git commit: wip
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/b314f388 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/b314f388 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/b314f388 Branch: refs/heads/ARIA-278-Remove-core-tasks Commit: b314f388bb1c7409e643bb45ec8a60142cb7acd6 Parents: 2149a5e Author: max-orlov Authored: Sun Jun 11 19:05:35 2017 +0300 Committer: max-orlov Committed: Sun Jun 18 16:58:24 2017 +0300 -- aria/modeling/orchestration.py | 145 +++--- aria/orchestrator/context/operation.py | 7 + aria/orchestrator/context/workflow.py | 21 ++ aria/orchestrator/workflow_runner.py| 113 +++- aria/orchestrator/workflows/core/__init__.py| 2 +- aria/orchestrator/workflows/core/engine.py | 120 .../workflows/core/events_handler.py| 138 +- aria/orchestrator/workflows/core/task.py| 271 --- aria/orchestrator/workflows/core/translation.py | 109 aria/orchestrator/workflows/events_logging.py | 63 +++-- aria/orchestrator/workflows/executor/base.py| 36 +-- aria/orchestrator/workflows/executor/dry.py | 57 ++-- aria/orchestrator/workflows/executor/process.py | 18 +- aria/orchestrator/workflows/executor/thread.py | 18 +- tests/__init__.py | 2 + tests/end2end/testenv.py| 3 + tests/orchestrator/context/__init__.py | 9 +- tests/orchestrator/context/test_operation.py| 26 +- tests/orchestrator/context/test_serialize.py| 8 +- .../orchestrator/execution_plugin/test_local.py | 12 +- tests/orchestrator/execution_plugin/test_ssh.py | 12 +- tests/orchestrator/test_workflow_runner.py | 30 +- .../orchestrator/workflows/core/test_engine.py | 24 +- .../orchestrator/workflows/core/test_events.py | 22 +- tests/orchestrator/workflows/core/test_task.py | 31 +-- .../test_task_graph_into_execution_graph.py | 63 ++--- .../orchestrator/workflows/executor/__init__.py | 89 +++--- .../workflows/executor/test_executor.py | 26 +- .../workflows/executor/test_process_executor.py | 26 +- .../executor/test_process_executor_extension.py | 8 +- .../test_process_executor_tracked_changes.py| 8 +- 31 files changed, 689 insertions(+), 828 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/b314f388/aria/modeling/orchestration.py -- diff --git a/aria/modeling/orchestration.py b/aria/modeling/orchestration.py index 995c8c2..007eefa 100644 --- a/aria/modeling/orchestration.py +++ b/aria/modeling/orchestration.py @@ -21,7 +21,6 @@ classes: """ # pylint: disable=no-self-argument, no-member, abstract-method - from datetime import datetime from sqlalchemy import ( @@ -34,19 +33,19 @@ from sqlalchemy import ( String, Float, orm, -) +PickleType) from sqlalchemy.ext.associationproxy import association_proxy from sqlalchemy.ext.declarative import declared_attr from ..orchestrator.exceptions import (TaskAbortException, TaskRetryException) -from .mixins import ModelMixin, ParameterMixin +from . import mixins from . import ( relationship, types as modeling_types ) -class ExecutionBase(ModelMixin): +class ExecutionBase(mixins.ModelMixin): """ Execution model representation. """ @@ -152,7 +151,7 @@ class ExecutionBase(ModelMixin): ) -class PluginBase(ModelMixin): +class PluginBase(mixins.ModelMixin): """ An installed plugin. @@ -213,7 +212,7 @@ class PluginBase(ModelMixin): uploaded_at = Column(DateTime, nullable=False, index=True) -class TaskBase(ModelMixin): +class TaskBase(mixins.ModelMixin): """ Represents the smallest unit of stateful execution in ARIA. The task state includes inputs, outputs, as well as an atomic status, ensuring that the task can only be running once at any @@ -257,10 +256,24 @@ class TaskBase(ModelMixin): __tablename__ = 'task' -__private_fields__ = ['node_fk', - 'relationship_fk', - 'plugin_fk', - 'execution_fk'] +__private_fields__ = ['dependency_operation_task_fk', 'dependency_stub_task_fk', 'node_fk', + 'relationship_fk', 'plugin_fk', 'execution_fk'] + +START_WORKFLOW = 'start_workflow' +END_WORKFLOW = 'end_workflow' +START_SUBWROFKLOW = 'start_subworkflow' +END_SUBWORKFLOW = 'end_subworkflow' +STUB = 'stub' +CONDITIONAL = 'conditional' + +STUB_TYPES = ( +START_WORKFLOW, +START_SUBWROFKLOW, +END_WORKFLOW
[2/2] incubator-ariatosca git commit: wip
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/25427ae5 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/25427ae5 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/25427ae5 Branch: refs/heads/ARIA-278-Remove-core-tasks Commit: 25427ae5974392e2b579109e4a5fdac4ba6ca5e8 Parents: 2149a5e Author: max-orlov Authored: Sun Jun 11 19:05:35 2017 +0300 Committer: max-orlov Committed: Sun Jun 18 16:54:18 2017 +0300 -- aria/modeling/mixins.py | 4 +- aria/modeling/orchestration.py | 145 +++--- aria/orchestrator/context/operation.py | 7 + aria/orchestrator/context/workflow.py | 21 ++ aria/orchestrator/workflow_runner.py| 113 +++- aria/orchestrator/workflows/core/__init__.py| 2 +- aria/orchestrator/workflows/core/engine.py | 120 .../workflows/core/events_handler.py| 138 +- aria/orchestrator/workflows/core/task.py| 271 --- aria/orchestrator/workflows/core/translation.py | 109 aria/orchestrator/workflows/events_logging.py | 63 +++-- aria/orchestrator/workflows/executor/base.py| 36 +-- aria/orchestrator/workflows/executor/dry.py | 57 ++-- aria/orchestrator/workflows/executor/process.py | 18 +- aria/orchestrator/workflows/executor/thread.py | 18 +- tests/__init__.py | 2 + tests/end2end/testenv.py| 3 + tests/orchestrator/context/__init__.py | 9 +- tests/orchestrator/context/test_operation.py| 26 +- tests/orchestrator/context/test_serialize.py| 8 +- .../orchestrator/execution_plugin/test_local.py | 12 +- tests/orchestrator/execution_plugin/test_ssh.py | 12 +- tests/orchestrator/test_workflow_runner.py | 30 +- .../orchestrator/workflows/core/test_engine.py | 24 +- .../orchestrator/workflows/core/test_events.py | 22 +- tests/orchestrator/workflows/core/test_task.py | 31 +-- .../test_task_graph_into_execution_graph.py | 63 ++--- .../orchestrator/workflows/executor/__init__.py | 89 +++--- .../workflows/executor/test_executor.py | 26 +- .../workflows/executor/test_process_executor.py | 26 +- .../executor/test_process_executor_extension.py | 8 +- .../test_process_executor_tracked_changes.py| 8 +- tox.ini | 2 +- 33 files changed, 691 insertions(+), 832 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/25427ae5/aria/modeling/mixins.py -- diff --git a/aria/modeling/mixins.py b/aria/modeling/mixins.py index c98a866..31675fe 100644 --- a/aria/modeling/mixins.py +++ b/aria/modeling/mixins.py @@ -18,14 +18,12 @@ classes: * ModelMixin - abstract model implementation. * ModelIDMixin - abstract model implementation with IDs. """ - from sqlalchemy.ext import associationproxy from sqlalchemy import ( Column, Integer, Text, -PickleType -) +PickleType) from ..parser.consumption import ConsumptionContext from ..utils import console, collections, caching, formatting http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/25427ae5/aria/modeling/orchestration.py -- diff --git a/aria/modeling/orchestration.py b/aria/modeling/orchestration.py index 995c8c2..007eefa 100644 --- a/aria/modeling/orchestration.py +++ b/aria/modeling/orchestration.py @@ -21,7 +21,6 @@ classes: """ # pylint: disable=no-self-argument, no-member, abstract-method - from datetime import datetime from sqlalchemy import ( @@ -34,19 +33,19 @@ from sqlalchemy import ( String, Float, orm, -) +PickleType) from sqlalchemy.ext.associationproxy import association_proxy from sqlalchemy.ext.declarative import declared_attr from ..orchestrator.exceptions import (TaskAbortException, TaskRetryException) -from .mixins import ModelMixin, ParameterMixin +from . import mixins from . import ( relationship, types as modeling_types ) -class ExecutionBase(ModelMixin): +class ExecutionBase(mixins.ModelMixin): """ Execution model representation. """ @@ -152,7 +151,7 @@ class ExecutionBase(ModelMixin): ) -class PluginBase(ModelMixin): +class PluginBase(mixins.ModelMixin): """ An installed plugin. @@ -213,7 +212,7 @@ class PluginBase(ModelMixin): uploaded_at = Column(DateTime, nullable=False, index=True) -class TaskBase(ModelMixin): +class TaskBase(mixins.ModelMixin): """ Represents the smallest unit of stateful execution in ARIA. The task state
[2/2] incubator-ariatosca git commit: wip
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/d517b820 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/d517b820 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/d517b820 Branch: refs/heads/ARIA-278-Remove-core-tasks Commit: d517b820e45cb5d59e23045710417f2562228efa Parents: 2149a5e Author: max-orlov Authored: Sun Jun 11 19:05:35 2017 +0300 Committer: max-orlov Committed: Thu Jun 15 18:15:33 2017 +0300 -- aria/modeling/mixins.py | 4 +- aria/modeling/orchestration.py | 145 +++--- aria/orchestrator/context/operation.py | 8 + aria/orchestrator/context/workflow.py | 22 ++ aria/orchestrator/workflow_runner.py| 113 +++- aria/orchestrator/workflows/core/__init__.py| 2 +- aria/orchestrator/workflows/core/engine.py | 115 .../workflows/core/events_handler.py| 138 +- aria/orchestrator/workflows/core/task.py| 271 --- aria/orchestrator/workflows/core/translation.py | 109 aria/orchestrator/workflows/events_logging.py | 63 +++-- aria/orchestrator/workflows/executor/base.py| 36 +-- aria/orchestrator/workflows/executor/dry.py | 57 ++-- aria/orchestrator/workflows/executor/process.py | 18 +- aria/orchestrator/workflows/executor/thread.py | 18 +- tests/end2end/testenv.py| 3 + tests/orchestrator/context/__init__.py | 9 +- tests/orchestrator/context/test_operation.py| 26 +- tests/orchestrator/context/test_serialize.py| 8 +- .../orchestrator/execution_plugin/test_local.py | 12 +- tests/orchestrator/execution_plugin/test_ssh.py | 12 +- tests/orchestrator/test_workflow_runner.py | 30 +- .../orchestrator/workflows/core/test_engine.py | 24 +- .../orchestrator/workflows/core/test_events.py | 22 +- tests/orchestrator/workflows/core/test_task.py | 31 +-- .../test_task_graph_into_execution_graph.py | 63 ++--- .../orchestrator/workflows/executor/__init__.py | 75 +++-- .../workflows/executor/test_executor.py | 83 +++--- .../workflows/executor/test_process_executor.py | 51 +++- .../executor/test_process_executor_extension.py | 8 +- .../test_process_executor_tracked_changes.py| 8 +- 31 files changed, 727 insertions(+), 857 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/d517b820/aria/modeling/mixins.py -- diff --git a/aria/modeling/mixins.py b/aria/modeling/mixins.py index c98a866..31675fe 100644 --- a/aria/modeling/mixins.py +++ b/aria/modeling/mixins.py @@ -18,14 +18,12 @@ classes: * ModelMixin - abstract model implementation. * ModelIDMixin - abstract model implementation with IDs. """ - from sqlalchemy.ext import associationproxy from sqlalchemy import ( Column, Integer, Text, -PickleType -) +PickleType) from ..parser.consumption import ConsumptionContext from ..utils import console, collections, caching, formatting http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/d517b820/aria/modeling/orchestration.py -- diff --git a/aria/modeling/orchestration.py b/aria/modeling/orchestration.py index 995c8c2..007eefa 100644 --- a/aria/modeling/orchestration.py +++ b/aria/modeling/orchestration.py @@ -21,7 +21,6 @@ classes: """ # pylint: disable=no-self-argument, no-member, abstract-method - from datetime import datetime from sqlalchemy import ( @@ -34,19 +33,19 @@ from sqlalchemy import ( String, Float, orm, -) +PickleType) from sqlalchemy.ext.associationproxy import association_proxy from sqlalchemy.ext.declarative import declared_attr from ..orchestrator.exceptions import (TaskAbortException, TaskRetryException) -from .mixins import ModelMixin, ParameterMixin +from . import mixins from . import ( relationship, types as modeling_types ) -class ExecutionBase(ModelMixin): +class ExecutionBase(mixins.ModelMixin): """ Execution model representation. """ @@ -152,7 +151,7 @@ class ExecutionBase(ModelMixin): ) -class PluginBase(ModelMixin): +class PluginBase(mixins.ModelMixin): """ An installed plugin. @@ -213,7 +212,7 @@ class PluginBase(ModelMixin): uploaded_at = Column(DateTime, nullable=False, index=True) -class TaskBase(ModelMixin): +class TaskBase(mixins.ModelMixin): """ Represents the smallest unit of stateful execution in ARIA. The task state includes inputs, outputs, as well as an atomic status, ensuring that the task can only be running once
[2/2] incubator-ariatosca git commit: wip
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/84a3f730 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/84a3f730 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/84a3f730 Branch: refs/heads/ARIA-258-Convert-runtime-properties-to-attributes Commit: 84a3f73004dec5d74d0100b201b184e2ccff975e Parents: fdd57c4 Author: max-orlov Authored: Sun May 14 22:38:39 2017 +0300 Committer: max-orlov Committed: Wed May 17 13:42:01 2017 +0300 -- aria/modeling/service_common.py | 9 +- aria/modeling/service_instance.py | 4 +- aria/modeling/types.py | 20 - aria/orchestrator/context/common.py | 163 aria/orchestrator/context/operation.py | 10 +- .../execution_plugin/ctx_proxy/server.py| 1 + aria/orchestrator/workflows/core/engine.py | 1 - aria/orchestrator/workflows/executor/process.py | 124 +- aria/storage/instrumentation.py | 282 - tests/helpers.py| 10 + tests/orchestrator/context/test_operation.py| 204 +- .../execution_plugin/test_ctx_proxy_server.py | 3 +- .../orchestrator/execution_plugin/test_local.py | 66 ++-- tests/orchestrator/execution_plugin/test_ssh.py | 36 +- tests/orchestrator/workflows/core/test_task.py | 2 +- .../orchestrator/workflows/executor/__init__.py | 4 + ...process_executor_concurrent_modifications.py | 67 ++-- .../executor/test_process_executor_extension.py | 6 +- .../test_process_executor_tracked_changes.py| 56 ++- tests/resources/scripts/test_ssh.sh | 30 +- tests/storage/test_instrumentation.py | 396 --- 21 files changed, 541 insertions(+), 953 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/84a3f730/aria/modeling/service_common.py -- diff --git a/aria/modeling/service_common.py b/aria/modeling/service_common.py index e9c96a4..ef19c8e 100644 --- a/aria/modeling/service_common.py +++ b/aria/modeling/service_common.py @@ -218,14 +218,13 @@ class ParameterBase(TemplateModelMixin, caching.HasCachedMethods): :type description: basestring """ -from . import models type_name = canonical_type_name(value) if type_name is None: type_name = full_type_name(value) -return models.Parameter(name=name, # pylint: disable=unexpected-keyword-arg -type_name=type_name, -value=value, -description=description) +return cls(name=name, # pylint: disable=unexpected-keyword-arg + type_name=type_name, + value=value, + description=description) class TypeBase(InstanceModelMixin): http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/84a3f730/aria/modeling/service_instance.py -- diff --git a/aria/modeling/service_instance.py b/aria/modeling/service_instance.py index 41a388d..469b661 100644 --- a/aria/modeling/service_instance.py +++ b/aria/modeling/service_instance.py @@ -528,8 +528,8 @@ class NodeBase(InstanceModelMixin): @property def host_address(self): -if self.host and self.host.runtime_properties: -return self.host.runtime_properties.get('ip') +if self.host and self.host.attributes: +return self.host.attributes.get('ip') return None def satisfy_requirements(self): http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/84a3f730/aria/modeling/types.py -- diff --git a/aria/modeling/types.py b/aria/modeling/types.py index 7460f47..920a0c2 100644 --- a/aria/modeling/types.py +++ b/aria/modeling/types.py @@ -286,24 +286,4 @@ _LISTENER_ARGS = (mutable.mapper, 'mapper_configured', _mutable_association_list def _register_mutable_association_listener(): event.listen(*_LISTENER_ARGS) - -def remove_mutable_association_listener(): -""" -Remove the event listener that associates ``Dict`` and ``List`` column types with -``MutableDict`` and ``MutableList``, respectively. - -This call must happen before any model instance is instantiated. -This is because once it does, that would trigger the listener we are trying to remove. -Once it is triggered, many other listeners will then be registered. -At that point, it is too late. - -The reason this function exists is that the association listener, interferes with A
[2/2] incubator-ariatosca git commit: wip
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/ebd1ef85 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/ebd1ef85 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/ebd1ef85 Branch: refs/heads/ARIA-258-Convert-runtime-properties-to-attributes Commit: ebd1ef85cc7be8910d214bcd3fc70db1ae77743d Parents: fdd57c4 Author: max-orlov Authored: Sun May 14 22:38:39 2017 +0300 Committer: max-orlov Committed: Wed May 17 13:04:38 2017 +0300 -- aria/modeling/service_common.py | 9 +- aria/modeling/types.py | 20 - aria/orchestrator/context/common.py | 163 aria/orchestrator/context/operation.py | 10 +- .../execution_plugin/ctx_proxy/server.py| 1 + aria/orchestrator/workflows/core/engine.py | 1 - aria/orchestrator/workflows/executor/process.py | 124 +- aria/storage/instrumentation.py | 282 - tests/helpers.py| 10 + tests/orchestrator/context/test_operation.py| 204 +- .../execution_plugin/test_ctx_proxy_server.py | 3 +- .../orchestrator/execution_plugin/test_local.py | 66 ++-- tests/orchestrator/execution_plugin/test_ssh.py | 36 +- tests/orchestrator/workflows/core/test_task.py | 2 +- .../orchestrator/workflows/executor/__init__.py | 4 + ...process_executor_concurrent_modifications.py | 67 ++-- .../executor/test_process_executor_extension.py | 6 +- .../test_process_executor_tracked_changes.py| 56 ++- tests/resources/scripts/test_ssh.sh | 30 +- tests/storage/test_instrumentation.py | 396 --- 20 files changed, 539 insertions(+), 951 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/ebd1ef85/aria/modeling/service_common.py -- diff --git a/aria/modeling/service_common.py b/aria/modeling/service_common.py index e9c96a4..ef19c8e 100644 --- a/aria/modeling/service_common.py +++ b/aria/modeling/service_common.py @@ -218,14 +218,13 @@ class ParameterBase(TemplateModelMixin, caching.HasCachedMethods): :type description: basestring """ -from . import models type_name = canonical_type_name(value) if type_name is None: type_name = full_type_name(value) -return models.Parameter(name=name, # pylint: disable=unexpected-keyword-arg -type_name=type_name, -value=value, -description=description) +return cls(name=name, # pylint: disable=unexpected-keyword-arg + type_name=type_name, + value=value, + description=description) class TypeBase(InstanceModelMixin): http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/ebd1ef85/aria/modeling/types.py -- diff --git a/aria/modeling/types.py b/aria/modeling/types.py index 7460f47..920a0c2 100644 --- a/aria/modeling/types.py +++ b/aria/modeling/types.py @@ -286,24 +286,4 @@ _LISTENER_ARGS = (mutable.mapper, 'mapper_configured', _mutable_association_list def _register_mutable_association_listener(): event.listen(*_LISTENER_ARGS) - -def remove_mutable_association_listener(): -""" -Remove the event listener that associates ``Dict`` and ``List`` column types with -``MutableDict`` and ``MutableList``, respectively. - -This call must happen before any model instance is instantiated. -This is because once it does, that would trigger the listener we are trying to remove. -Once it is triggered, many other listeners will then be registered. -At that point, it is too late. - -The reason this function exists is that the association listener, interferes with ARIA change -tracking instrumentation, so a way to disable it is required. - -Note that the event listener this call removes is registered by default. -""" -if event.contains(*_LISTENER_ARGS): -event.remove(*_LISTENER_ARGS) - - _register_mutable_association_listener() http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/ebd1ef85/aria/orchestrator/context/common.py -- diff --git a/aria/orchestrator/context/common.py b/aria/orchestrator/context/common.py index 0854a27..83f7215 100644 --- a/aria/orchestrator/context/common.py +++ b/aria/orchestrator/context/common.py @@ -18,6 +18,7 @@ A common context for both workflow and operation """ import logging +import collections from contextlib impo
[2/2] incubator-ariatosca git commit: wip
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/51b17799 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/51b17799 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/51b17799 Branch: refs/heads/ARIA-106-Create-sqla-logging-handler Commit: 51b17799f8fc208573fcf665a93abaad0ece3076 Parents: 2286b0d Author: mxmrlv Authored: Mon Feb 13 13:50:05 2017 +0200 Committer: mxmrlv Committed: Mon Feb 13 18:58:06 2017 +0200 -- aria/__init__.py| 1 - aria/logger.py | 32 - aria/orchestrator/context/common.py | 20 ++- aria/orchestrator/workflows/core/engine.py | 5 +++ aria/orchestrator/workflows/executor/process.py | 1 - tests/orchestrator/context/test_operation.py| 5 ++- tests/orchestrator/test_runner.py | 38 ++-- tests/storage/__init__.py | 13 +++ 8 files changed, 64 insertions(+), 51 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/51b17799/aria/__init__.py -- diff --git a/aria/__init__.py b/aria/__init__.py index 4e2982f..2302b06 100644 --- a/aria/__init__.py +++ b/aria/__init__.py @@ -77,7 +77,6 @@ def application_model_storage(api, api_kwargs=None, initiator=None, initiator_kw storage.model.Execution, storage.model.Task, - storage.model.Log ] return storage.ModelStorage(api_cls=api, http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/51b17799/aria/logger.py -- diff --git a/aria/logger.py b/aria/logger.py index 5840cff..936b14d 100644 --- a/aria/logger.py +++ b/aria/logger.py @@ -137,15 +137,6 @@ def create_file_log_handler( return rotating_file -def create_sqla_log_handler(session, engine, model_cls=None, level=logging.DEBUG): -from aria.storage.model import Log -return SQLAlchemyHandler(session, engine, model_cls or Log, level=level) - - -_default_file_formatter = logging.Formatter( -'%(asctime)s [%(name)s:%(levelname)s] %(message)s <%(pathname)s:%(lineno)d>') - - class SQLAlchemyHandler(logging.Handler): def __init__(self, session, engine, log_cls, **kwargs): self._session = session @@ -162,3 +153,26 @@ class SQLAlchemyHandler(logging.Handler): ) self._session.add(log) self._session.commit() + + +class _SQLAlchemyHandlerFactory(object): +from aria.storage.model import Log + +def __init__(self): +self._handler = None + +def __call__(self, session, engine, model_cls=Log, level=logging.DEBUG): +if self._handler is None or not self._is_eq(session, engine, model_cls): +self._handler = SQLAlchemyHandler(session, engine, model_cls, level=level) +return self._handler + +def _is_eq(self, session, engine, model_cls): +return all([self._handler._session == session, +self._handler._engine == engine, +self._handler._cls == model_cls]) + +create_sqla_log_handler = _SQLAlchemyHandlerFactory() + +_default_file_formatter = logging.Formatter( +'%(asctime)s [%(name)s:%(levelname)s] %(message)s <%(pathname)s:%(lineno)d>') + http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/51b17799/aria/orchestrator/context/common.py -- diff --git a/aria/orchestrator/context/common.py b/aria/orchestrator/context/common.py index 87f88b1..aa5c937 100644 --- a/aria/orchestrator/context/common.py +++ b/aria/orchestrator/context/common.py @@ -44,18 +44,20 @@ class BaseContext(object): self._model = model_storage self._resource = resource_storage self._deployment_id = deployment_id -if ctx_logger is None: -sqla_logging_handler = logger.create_sqla_log_handler(**model_storage.all_api_kwargs) -ctx_logger = logging.getLogger('aria_ctx') +self._logger = self._init_logger(ctx_logger) +self._workdir = workdir -# A handler should be registered only once. -if len(ctx_logger.handlers) == 0: -ctx_logger.addHandler(sqla_logging_handler) +def _init_logger(self, ctx_logger=None): +ctx_logger = ctx_logger or logging.getLogger('aria_ctx') -ctx_logger.setLevel(logging.DEBUG) -self._logger = ctx_logger +# A handler should be registered only once. +sqla_handler = logger.create_sqla_log_handler(**self._model.all_api_kwargs) +if sqla_handler not in ctx_logger.handlers: +
[2/2] incubator-ariatosca git commit: wip
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/4748a07a Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/4748a07a Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/4748a07a Branch: refs/heads/ARIA-42-Generic-ctx-serialization-mechanism Commit: 4748a07a3ab94b9cde2cdc035122984cf8120e12 Parents: 2df75cc Author: mxmrlv Authored: Wed Feb 1 19:23:16 2017 +0200 Committer: mxmrlv Committed: Wed Feb 1 19:23:16 2017 +0200 -- aria/storage/sql_mapi.py | 65 --- 1 file changed, 30 insertions(+), 35 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/4748a07a/aria/storage/sql_mapi.py -- diff --git a/aria/storage/sql_mapi.py b/aria/storage/sql_mapi.py index 3982eaa..f4e0b4f 100644 --- a/aria/storage/sql_mapi.py +++ b/aria/storage/sql_mapi.py @@ -31,47 +31,12 @@ from aria.storage import ( ) -def init_storage(init_func=None): -if init_func is None: -return partial(init_storage, func=init_storage) - -track = { -'engine': None, -'session': None -} - -def _wrapper(self, base_dir=None, filename='db.sqlite', *args, **kwargs): -if not (track['engine'] and track['session']): -if base_dir is not None: -uri = 'sqlite:///{platform_char}{path}'.format( -# Handles the windows behavior where there is not root, but drivers. -# Thus behaving as relative path. -platform_char='' if 'Windows' in platform.system() else '/', - -path=os.path.join(base_dir, filename)) -engine_kwargs = {} -else: -uri = 'sqlite:///:memory:' -engine_kwargs = dict(connect_args={'check_same_thread': False}, - poolclass=pool.StaticPool) - -track['engine'] = create_engine(uri, **engine_kwargs) -session_factory = orm.sessionmaker(bind=track['engine']) -track['session'] = orm.scoped_session(session_factory=session_factory) if base_dir else \ -session_factory() - -return init_func( -self=self, engine=track['engine'], session=track['session'], *args, **kwargs) - -return _wrapper - class SQLAlchemyModelAPI(api.ModelAPI): """ SQL based MAPI. """ -@init_storage def __init__(self, engine, session, @@ -406,6 +371,36 @@ class SQLAlchemyModelAPI(api.ModelAPI): getattr(instance, rel.key) +def register_initiator(func, cls=None): +cls.__metadata__ = type('{0}Metaclas'.format(cls.__name__), +(type, ), +dict(__call__=func)) + + +@register_initiator(cls=SQLAlchemyModelAPI) +def init_storage(cls, base_dir=None, filename='db.sqlite', *args, **kwargs): +if not hasattr(cls, '_engine'): +if base_dir is not None: +uri = 'sqlite:///{platform_char}{path}'.format( +# Handles the windows behavior where there is not root, but drivers. +# Thus behaving as relative path. +platform_char='' if 'Windows' in platform.system() else '/', + +path=os.path.join(base_dir, filename)) +engine_kwargs = {} +else: +uri = 'sqlite:///:memory:' +engine_kwargs = dict(connect_args={'check_same_thread': False}, + poolclass=pool.StaticPool) + +cls._engine = create_engine(uri, **engine_kwargs) +session_factory = orm.sessionmaker(bind=cls._engine) +cls._session = orm.scoped_session(session_factory=session_factory) if base_dir else \ +session_factory() + +return type.__call__(cls, engine=cls._engine, session=cls._session, *args, **kwargs) + + class ListResult(object): """ a ListResult contains results about the requested items.