[jira] [Commented] (ARIA-46) Execution plugin in ARIA
[ https://issues.apache.org/jira/browse/ARIA-46?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15802955#comment-15802955 ] ASF subversion and git services commented on ARIA-46: - Commit 15ab3e914f263a56ffdc5492d2521afb8248444c in incubator-ariatosca's branch refs/heads/ARIA-46-execution-plugin from [~d...@gigaspaces.com] [ https://git-wip-us.apache.org/repos/asf?p=incubator-ariatosca.git;h=15ab3e9 ] ARIA-46 Execution plugin > Execution plugin in ARIA > > > Key: ARIA-46 > URL: https://issues.apache.org/jira/browse/ARIA-46 > Project: AriaTosca > Issue Type: Story >Reporter: Ran Ziv >Assignee: Dan Kilman >Priority: Critical > > Migrate the execution plugin to ARIA, and make it part of the core code -- This message was sent by Atlassian JIRA (v6.3.4#6332)
incubator-ariatosca git commit: ARIA-46 Execution plugin
Repository: incubator-ariatosca Updated Branches: refs/heads/ARIA-46-execution-plugin [created] 15ab3e914 ARIA-46 Execution plugin Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/15ab3e91 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/15ab3e91 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/15ab3e91 Branch: refs/heads/ARIA-46-execution-plugin Commit: 15ab3e914f263a56ffdc5492d2521afb8248444c Parents: 3caf177 Author: Dan KilmanAuthored: Tue Jan 3 17:00:46 2017 +0200 Committer: Dan Kilman Committed: Fri Jan 6 02:06:45 2017 +0200 -- MANIFEST.in | 1 + aria/orchestrator/execution_plugin/__init__.py | 33 +++ aria/orchestrator/execution_plugin/common.py| 140 +++ aria/orchestrator/execution_plugin/constants.py | 51 .../execution_plugin/ctx_proxy/__init__.py | 16 ++ .../execution_plugin/ctx_proxy/client.py| 102 .../execution_plugin/ctx_proxy/server.py| 240 +++ .../execution_plugin/environment_globals.py | 60 + .../orchestrator/execution_plugin/exceptions.py | 35 +++ aria/orchestrator/execution_plugin/local.py | 120 ++ .../orchestrator/execution_plugin/operations.py | 56 + .../execution_plugin/ssh/__init__.py| 14 ++ .../execution_plugin/ssh/operations.py | 211 .../orchestrator/execution_plugin/ssh/tunnel.py | 91 +++ aria/orchestrator/workflows/api/task.py | 12 +- aria/orchestrator/workflows/core/task.py| 3 +- aria/storage/base_model.py | 26 +- requirements.txt| 3 + setup.py| 9 +- 19 files changed, 1212 insertions(+), 11 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/15ab3e91/MANIFEST.in -- diff --git a/MANIFEST.in b/MANIFEST.in index f9bd145..6b08eeb 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1 +1,2 @@ include requirements.txt +include aria/orchestrator/execution_plugin/ctx_proxy/binaries/ctx http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/15ab3e91/aria/orchestrator/execution_plugin/__init__.py -- diff --git a/aria/orchestrator/execution_plugin/__init__.py b/aria/orchestrator/execution_plugin/__init__.py new file mode 100644 index 000..372022f --- /dev/null +++ b/aria/orchestrator/execution_plugin/__init__.py @@ -0,0 +1,33 @@ +# 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 contextlib import contextmanager + +# Populated during execution of python scripts +ctx = None +inputs = None + + +@contextmanager +def python_script_scope(operation_ctx, operation_inputs): +global ctx +global inputs +try: +ctx = operation_ctx +inputs = operation_inputs +yield +finally: +ctx = None +inputs = None http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/15ab3e91/aria/orchestrator/execution_plugin/common.py -- diff --git a/aria/orchestrator/execution_plugin/common.py b/aria/orchestrator/execution_plugin/common.py new file mode 100644 index 000..3c36052 --- /dev/null +++ b/aria/orchestrator/execution_plugin/common.py @@ -0,0 +1,140 @@ +# 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
[jira] [Commented] (ARIA-56) API for retrieving a node's host IP
[ https://issues.apache.org/jira/browse/ARIA-56?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15801556#comment-15801556 ] ASF GitHub Bot commented on ARIA-56: Github user asfgit closed the pull request at: https://github.com/apache/incubator-ariatosca/pull/42 > API for retrieving a node's host IP > --- > > Key: ARIA-56 > URL: https://issues.apache.org/jira/browse/ARIA-56 > Project: AriaTosca > Issue Type: Story >Reporter: Ran Ziv >Assignee: Dan Kilman > > The node instance's model object should have an "ip" property which will > retrieve either its IP or its host node instance's IP -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (ARIA-34) API for rendering a downloaded resource
[ https://issues.apache.org/jira/browse/ARIA-34?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15801549#comment-15801549 ] ASF subversion and git services commented on ARIA-34: - Commit fa221f7fa654c8957a7a2bad1790f73ffe1de78c in incubator-ariatosca's branch refs/heads/master from [~d...@gigaspaces.com] [ https://git-wip-us.apache.org/repos/asf?p=incubator-ariatosca.git;h=fa221f7 ] ARIA-34 Adding get/download resource and render API (as jinja template) > API for rendering a downloaded resource > --- > > Key: ARIA-34 > URL: https://issues.apache.org/jira/browse/ARIA-34 > Project: AriaTosca > Issue Type: Story >Reporter: Ran Ziv >Assignee: Dan Kilman > > Add an API for downloading + rendering a resource from the storage, similar > to the workflow-context's "download_resource" method -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[1/2] incubator-ariatosca git commit: ARIA-55 Implement task retry and abort mechanism [Forced Update!]
Repository: incubator-ariatosca Updated Branches: refs/heads/ARIA-34-render-resource 97e078954 -> fa221f7fa (forced update) ARIA-55 Implement task retry and abort 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/8a00b5fc Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/8a00b5fc Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/8a00b5fc Branch: refs/heads/ARIA-34-render-resource Commit: 8a00b5fce2c737058f10c1e3d3a92bdcfe53e882 Parents: 12e175b Author: Dan KilmanAuthored: Thu Jan 5 13:00:01 2017 +0200 Committer: Dan Kilman Committed: Thu Jan 5 13:21:35 2017 +0200 -- aria/orchestrator/exceptions.py | 16 .../workflows/core/events_handler.py| 25 -- aria/storage/base_model.py | 10 ++- .../orchestrator/workflows/core/test_engine.py | 94 +++- .../workflows/executor/test_executor.py | 1 + .../workflows/executor/test_process_executor.py | 1 + 6 files changed, 136 insertions(+), 11 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/8a00b5fc/aria/orchestrator/exceptions.py -- diff --git a/aria/orchestrator/exceptions.py b/aria/orchestrator/exceptions.py index 74e9002..bd5238e 100644 --- a/aria/orchestrator/exceptions.py +++ b/aria/orchestrator/exceptions.py @@ -30,3 +30,19 @@ class PluginAlreadyExistsError(AriaError): Raised when a plugin with the same package name and package version already exists """ pass + + +class TaskRetryException(RuntimeError): +""" +Used internally when ctx.task.retry is called +""" +def __init__(self, message, retry_interval): +super(TaskRetryException, self).__init__(message) +self.retry_interval = retry_interval + + +class TaskAbortException(RuntimeError): +""" +Used internally when ctx.task.abort is called +""" +pass http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/8a00b5fc/aria/orchestrator/workflows/core/events_handler.py -- diff --git a/aria/orchestrator/workflows/core/events_handler.py b/aria/orchestrator/workflows/core/events_handler.py index d05cbcb..c973ad9 100644 --- a/aria/orchestrator/workflows/core/events_handler.py +++ b/aria/orchestrator/workflows/core/events_handler.py @@ -27,7 +27,7 @@ from datetime import ( ) from ... import events - +from ... import exceptions @events.sent_task_signal.connect def _task_sent(task, *args, **kwargs): @@ -43,18 +43,25 @@ def _task_started(task, *args, **kwargs): @events.on_failure_task_signal.connect -def _task_failed(task, *args, **kwargs): +def _task_failed(task, exception, *args, **kwargs): with task._update(): -should_retry = ( -(task.retry_count < task.max_attempts - 1 or - task.max_attempts == task.INFINITE_RETRIES) and -# ignore_failure check here means the task will not be retries and it will be marked as -# failed. The engine will also look at ignore_failure so it won't fail the workflow. -not task.ignore_failure) +should_retry = all([ +not isinstance(exception, exceptions.TaskAbortException), +task.retry_count < task.max_attempts - 1 or task.max_attempts == task.INFINITE_RETRIES, +# ignore_failure check here means the task will not be retries and it will be marked +# as failed. The engine will also look at ignore_failure so it won't fail the +# workflow. +not task.ignore_failure +]) if should_retry: +retry_interval = None +if isinstance(exception, exceptions.TaskRetryException): +retry_interval = exception.retry_interval +if retry_interval is None: +retry_interval = task.retry_interval task.status = task.RETRYING task.retry_count += 1 -task.due_at = datetime.utcnow() + timedelta(seconds=task.retry_interval) +task.due_at = datetime.utcnow() + timedelta(seconds=retry_interval) else: task.ended_at = datetime.utcnow() task.status = task.FAILED http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/8a00b5fc/aria/storage/base_model.py -- diff --git a/aria/storage/base_model.py b/aria/storage/base_model.py index d1aebf2..97c541c 100644 --- a/aria/storage/base_model.py +++ b/aria/storage/base_model.py @@ -52,8 +52,8 @@ from sqlalchemy import ( orm, )
[jira] [Commented] (ARIA-34) API for rendering a downloaded resource
[ https://issues.apache.org/jira/browse/ARIA-34?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15801547#comment-15801547 ] ASF subversion and git services commented on ARIA-34: - Commit fa221f7fa654c8957a7a2bad1790f73ffe1de78c in incubator-ariatosca's branch refs/heads/ARIA-34-render-resource from [~d...@gigaspaces.com] [ https://git-wip-us.apache.org/repos/asf?p=incubator-ariatosca.git;h=fa221f7 ] ARIA-34 Adding get/download resource and render API (as jinja template) > API for rendering a downloaded resource > --- > > Key: ARIA-34 > URL: https://issues.apache.org/jira/browse/ARIA-34 > Project: AriaTosca > Issue Type: Story >Reporter: Ran Ziv >Assignee: Dan Kilman > > Add an API for downloading + rendering a resource from the storage, similar > to the workflow-context's "download_resource" method -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Resolved] (ARIA-56) API for retrieving a node's host IP
[ https://issues.apache.org/jira/browse/ARIA-56?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Dan Kilman resolved ARIA-56. Resolution: Fixed Fix Version/s: 0.1.0 > API for retrieving a node's host IP > --- > > Key: ARIA-56 > URL: https://issues.apache.org/jira/browse/ARIA-56 > Project: AriaTosca > Issue Type: Story >Reporter: Ran Ziv >Assignee: Dan Kilman > Fix For: 0.1.0 > > > The node instance's model object should have an "ip" property which will > retrieve either its IP or its host node instance's IP -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Resolved] (ARIA-34) API for rendering a downloaded resource
[ https://issues.apache.org/jira/browse/ARIA-34?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Dan Kilman resolved ARIA-34. Resolution: Fixed Fix Version/s: 0.1.0 > API for rendering a downloaded resource > --- > > Key: ARIA-34 > URL: https://issues.apache.org/jira/browse/ARIA-34 > Project: AriaTosca > Issue Type: Story >Reporter: Ran Ziv >Assignee: Dan Kilman > Fix For: 0.1.0 > > > Add an API for downloading + rendering a resource from the storage, similar > to the workflow-context's "download_resource" method -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (ARIA-34) API for rendering a downloaded resource
[ https://issues.apache.org/jira/browse/ARIA-34?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15801550#comment-15801550 ] ASF GitHub Bot commented on ARIA-34: Github user asfgit closed the pull request at: https://github.com/apache/incubator-ariatosca/pull/41 > API for rendering a downloaded resource > --- > > Key: ARIA-34 > URL: https://issues.apache.org/jira/browse/ARIA-34 > Project: AriaTosca > Issue Type: Story >Reporter: Ran Ziv >Assignee: Dan Kilman > > Add an API for downloading + rendering a resource from the storage, similar > to the workflow-context's "download_resource" method -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (ARIA-56) API for retrieving a node's host IP
[ https://issues.apache.org/jira/browse/ARIA-56?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15801553#comment-15801553 ] ASF subversion and git services commented on ARIA-56: - Commit 3caf17717a70041d878ad11b4e4234d362a7f000 in incubator-ariatosca's branch refs/heads/ARIA-56-node-ip from [~d...@gigaspaces.com] [ https://git-wip-us.apache.org/repos/asf?p=incubator-ariatosca.git;h=3caf177 ] ARIA-56 Implement ip property on node instance model > API for retrieving a node's host IP > --- > > Key: ARIA-56 > URL: https://issues.apache.org/jira/browse/ARIA-56 > Project: AriaTosca > Issue Type: Story >Reporter: Ran Ziv >Assignee: Dan Kilman > > The node instance's model object should have an "ip" property which will > retrieve either its IP or its host node instance's IP -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (ARIA-56) API for retrieving a node's host IP
[ https://issues.apache.org/jira/browse/ARIA-56?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15801555#comment-15801555 ] ASF subversion and git services commented on ARIA-56: - Commit 3caf17717a70041d878ad11b4e4234d362a7f000 in incubator-ariatosca's branch refs/heads/master from [~d...@gigaspaces.com] [ https://git-wip-us.apache.org/repos/asf?p=incubator-ariatosca.git;h=3caf177 ] ARIA-56 Implement ip property on node instance model > API for retrieving a node's host IP > --- > > Key: ARIA-56 > URL: https://issues.apache.org/jira/browse/ARIA-56 > Project: AriaTosca > Issue Type: Story >Reporter: Ran Ziv >Assignee: Dan Kilman > > The node instance's model object should have an "ip" property which will > retrieve either its IP or its host node instance's IP -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[2/3] incubator-ariatosca git commit: ARIA-34 Adding get/download resource and render API (as jinja template)
ARIA-34 Adding get/download resource and render API (as jinja template) Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/fa221f7f Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/fa221f7f Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/fa221f7f Branch: refs/heads/ARIA-56-node-ip Commit: fa221f7fa654c8957a7a2bad1790f73ffe1de78c Parents: 8a00b5f Author: Dan KilmanAuthored: Thu Jan 5 14:15:40 2017 +0200 Committer: Dan Kilman Committed: Thu Jan 5 16:49:40 2017 +0200 -- aria/orchestrator/context/common.py | 48 ++--- .../context/test_resource_render.py | 73 2 files changed, 113 insertions(+), 8 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/fa221f7f/aria/orchestrator/context/common.py -- diff --git a/aria/orchestrator/context/common.py b/aria/orchestrator/context/common.py index fdbe152..53844e8 100644 --- a/aria/orchestrator/context/common.py +++ b/aria/orchestrator/context/common.py @@ -17,6 +17,8 @@ A common context for both workflow and operation """ from uuid import uuid4 +import jinja2 + from aria import logger from aria.storage import exceptions @@ -97,19 +99,49 @@ class BaseContext(logger.LoggerMixin): Download a blueprint resource from the resource storage """ try: -return self.resource.deployment.download(entry_id=self.deployment.id, - destination=destination, - path=path) +self.resource.deployment.download(entry_id=str(self.deployment.id), + destination=destination, + path=path) except exceptions.StorageError: -return self.resource.blueprint.download(entry_id=self.blueprint.id, -destination=destination, -path=path) +self.resource.blueprint.download(entry_id=str(self.blueprint.id), + destination=destination, + path=path) + +def download_resource_and_render(self, destination, path=None, variables=None): +""" +Download a blueprint resource from the resource storage render its content as a jinja +template using the provided variables. ctx is available to the template without providing it +explicitly. +""" +self.download_resource(destination=destination, path=path) +with open(destination, 'rb') as f: +resource_content = f.read() +resource_content = self._render_resource(resource_content=resource_content, + variables=variables) +with open(destination, 'wb') as f: +f.write(resource_content) def get_resource(self, path=None): """ Read a deployment resource as string from the resource storage """ try: -return self.resource.deployment.read(entry_id=self.deployment.id, path=path) +return self.resource.deployment.read(entry_id=str(self.deployment.id), path=path) except exceptions.StorageError: -return self.resource.blueprint.read(entry_id=self.blueprint.id, path=path) +return self.resource.blueprint.read(entry_id=str(self.blueprint.id), path=path) + +def get_resource_and_render(self, path=None, variables=None): +""" +Read a deployment resource as string from the resource storage and render it as a jinja +template using the provided variables. ctx is available to the template without providing it +explicitly. +""" +resource_content = self.get_resource(path=path) +return self._render_resource(resource_content=resource_content, variables=variables) + +def _render_resource(self, resource_content, variables): +variables = variables or {} +if 'ctx' not in variables: +variables['ctx'] = self +resource_template = jinja2.Template(resource_content) +return resource_template.render(variables) http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/fa221f7f/tests/orchestrator/context/test_resource_render.py -- diff --git a/tests/orchestrator/context/test_resource_render.py b/tests/orchestrator/context/test_resource_render.py new file mode
[3/3] incubator-ariatosca git commit: ARIA-56 Implement ip property on node instance model
ARIA-56 Implement ip property on node instance model Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/3caf1771 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/3caf1771 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/3caf1771 Branch: refs/heads/ARIA-56-node-ip Commit: 3caf17717a70041d878ad11b4e4234d362a7f000 Parents: fa221f7 Author: Dan KilmanAuthored: Thu Jan 5 15:01:16 2017 +0200 Committer: Dan Kilman Committed: Thu Jan 5 16:51:25 2017 +0200 -- aria/.pylintrc | 2 +- aria/storage/base_model.py | 12 ++ tests/storage/test_models.py | 80 +++ 3 files changed, 93 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/3caf1771/aria/.pylintrc -- diff --git a/aria/.pylintrc b/aria/.pylintrc index 13a84fc..ee4d0ef 100644 --- a/aria/.pylintrc +++ b/aria/.pylintrc @@ -162,7 +162,7 @@ logging-modules=logging [BASIC] # Good variable names which should always be accepted, separated by a comma -good-names=i,j,k,v,f,ex,e,_,id +good-names=i,j,k,v,f,ex,e,_,id,ip # Bad variable names which should always be refused, separated by a comma bad-names=foo,bar,baz,toto,tutu,tata http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/3caf1771/aria/storage/base_model.py -- diff --git a/aria/storage/base_model.py b/aria/storage/base_model.py index 97c541c..418d3b6 100644 --- a/aria/storage/base_model.py +++ b/aria/storage/base_model.py @@ -495,6 +495,18 @@ class NodeInstanceBase(ModelMixin): def node_name(cls): return association_proxy('node', cls.name_column_name()) +@property +def ip(self): +if not self.host_fk: +return None +host_node_instance = self.host +if 'ip' in host_node_instance.runtime_properties: # pylint: disable=no-member +return host_node_instance.runtime_properties['ip'] # pylint: disable=no-member +host_node = host_node_instance.node # pylint: disable=no-member +if 'ip' in host_node.properties: +return host_node.properties['ip'] +return None + class RelationshipInstanceBase(ModelMixin): """ http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/3caf1771/tests/storage/test_models.py -- diff --git a/tests/storage/test_models.py b/tests/storage/test_models.py index df81f95..2088676 100644 --- a/tests/storage/test_models.py +++ b/tests/storage/test_models.py @@ -664,6 +664,86 @@ class TestNodeInstance(object): assert node_instance.deployment == node_storage.deployment.list()[0] +class TestNodeInstanceIP(object): + +ip = '1.1.1.1' + +def test_ip_on_none_hosted_node_instance(self, deployment_storage): +node = self._node(deployment_storage, ip='not considered') +node_instance = self._node_instance(deployment_storage, node, +is_host=False, +ip='not considered') +assert node_instance.ip is None + +def test_property_ip_on_host_node_instance(self, deployment_storage): +node = self._node(deployment_storage, ip=self.ip) +node_instance = self._node_instance(deployment_storage, node, +is_host=True, +ip=None) +assert node_instance.ip == self.ip + +def test_runtime_property_ip_on_host_node_instance(self, deployment_storage): +node = self._node(deployment_storage, ip='not considered') +node_instance = self._node_instance(deployment_storage, node, +is_host=True, +ip=self.ip) +assert node_instance.ip == self.ip + +def test_no_ip_configured_on_host_node_instance(self, deployment_storage): +node = self._node(deployment_storage, ip=None) +node_instance = self._node_instance(deployment_storage, node, +is_host=True, +ip=None) +assert node_instance.ip is None + +def test_runtime_property_on_hosted_node_instance(self, deployment_storage): +host_node = self._node(deployment_storage, ip=None) +host_node_instance = self._node_instance(deployment_storage, host_node, + is_host=True, +
[GitHub] incubator-ariatosca pull request #42: ARIA-56 Implement ip property on node ...
Github user asfgit closed the pull request at: https://github.com/apache/incubator-ariatosca/pull/42 --- 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. ---
[jira] [Commented] (ARIA-55) API for task retry and task abort
[ https://issues.apache.org/jira/browse/ARIA-55?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15801551#comment-15801551 ] ASF subversion and git services commented on ARIA-55: - Commit 8a00b5fce2c737058f10c1e3d3a92bdcfe53e882 in incubator-ariatosca's branch refs/heads/ARIA-56-node-ip from [~d...@gigaspaces.com] [ https://git-wip-us.apache.org/repos/asf?p=incubator-ariatosca.git;h=8a00b5f ] ARIA-55 Implement task retry and abort mechanism > API for task retry and task abort > - > > Key: ARIA-55 > URL: https://issues.apache.org/jira/browse/ARIA-55 > Project: AriaTosca > Issue Type: Story >Reporter: Ran Ziv >Assignee: Dan Kilman > > Add an API for aborting a running task, or setting it for a retry after a > given amount of time -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (ARIA-34) API for rendering a downloaded resource
[ https://issues.apache.org/jira/browse/ARIA-34?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15801552#comment-15801552 ] ASF subversion and git services commented on ARIA-34: - Commit fa221f7fa654c8957a7a2bad1790f73ffe1de78c in incubator-ariatosca's branch refs/heads/ARIA-56-node-ip from [~d...@gigaspaces.com] [ https://git-wip-us.apache.org/repos/asf?p=incubator-ariatosca.git;h=fa221f7 ] ARIA-34 Adding get/download resource and render API (as jinja template) > API for rendering a downloaded resource > --- > > Key: ARIA-34 > URL: https://issues.apache.org/jira/browse/ARIA-34 > Project: AriaTosca > Issue Type: Story >Reporter: Ran Ziv >Assignee: Dan Kilman > > Add an API for downloading + rendering a resource from the storage, similar > to the workflow-context's "download_resource" method -- This message was sent by Atlassian JIRA (v6.3.4#6332)
incubator-ariatosca git commit: ARIA-56 Implement ip property on node instance model
Repository: incubator-ariatosca Updated Branches: refs/heads/master fa221f7fa -> 3caf17717 ARIA-56 Implement ip property on node instance model Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/3caf1771 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/3caf1771 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/3caf1771 Branch: refs/heads/master Commit: 3caf17717a70041d878ad11b4e4234d362a7f000 Parents: fa221f7 Author: Dan KilmanAuthored: Thu Jan 5 15:01:16 2017 +0200 Committer: Dan Kilman Committed: Thu Jan 5 16:51:25 2017 +0200 -- aria/.pylintrc | 2 +- aria/storage/base_model.py | 12 ++ tests/storage/test_models.py | 80 +++ 3 files changed, 93 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/3caf1771/aria/.pylintrc -- diff --git a/aria/.pylintrc b/aria/.pylintrc index 13a84fc..ee4d0ef 100644 --- a/aria/.pylintrc +++ b/aria/.pylintrc @@ -162,7 +162,7 @@ logging-modules=logging [BASIC] # Good variable names which should always be accepted, separated by a comma -good-names=i,j,k,v,f,ex,e,_,id +good-names=i,j,k,v,f,ex,e,_,id,ip # Bad variable names which should always be refused, separated by a comma bad-names=foo,bar,baz,toto,tutu,tata http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/3caf1771/aria/storage/base_model.py -- diff --git a/aria/storage/base_model.py b/aria/storage/base_model.py index 97c541c..418d3b6 100644 --- a/aria/storage/base_model.py +++ b/aria/storage/base_model.py @@ -495,6 +495,18 @@ class NodeInstanceBase(ModelMixin): def node_name(cls): return association_proxy('node', cls.name_column_name()) +@property +def ip(self): +if not self.host_fk: +return None +host_node_instance = self.host +if 'ip' in host_node_instance.runtime_properties: # pylint: disable=no-member +return host_node_instance.runtime_properties['ip'] # pylint: disable=no-member +host_node = host_node_instance.node # pylint: disable=no-member +if 'ip' in host_node.properties: +return host_node.properties['ip'] +return None + class RelationshipInstanceBase(ModelMixin): """ http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/3caf1771/tests/storage/test_models.py -- diff --git a/tests/storage/test_models.py b/tests/storage/test_models.py index df81f95..2088676 100644 --- a/tests/storage/test_models.py +++ b/tests/storage/test_models.py @@ -664,6 +664,86 @@ class TestNodeInstance(object): assert node_instance.deployment == node_storage.deployment.list()[0] +class TestNodeInstanceIP(object): + +ip = '1.1.1.1' + +def test_ip_on_none_hosted_node_instance(self, deployment_storage): +node = self._node(deployment_storage, ip='not considered') +node_instance = self._node_instance(deployment_storage, node, +is_host=False, +ip='not considered') +assert node_instance.ip is None + +def test_property_ip_on_host_node_instance(self, deployment_storage): +node = self._node(deployment_storage, ip=self.ip) +node_instance = self._node_instance(deployment_storage, node, +is_host=True, +ip=None) +assert node_instance.ip == self.ip + +def test_runtime_property_ip_on_host_node_instance(self, deployment_storage): +node = self._node(deployment_storage, ip='not considered') +node_instance = self._node_instance(deployment_storage, node, +is_host=True, +ip=self.ip) +assert node_instance.ip == self.ip + +def test_no_ip_configured_on_host_node_instance(self, deployment_storage): +node = self._node(deployment_storage, ip=None) +node_instance = self._node_instance(deployment_storage, node, +is_host=True, +ip=None) +assert node_instance.ip is None + +def test_runtime_property_on_hosted_node_instance(self, deployment_storage): +host_node = self._node(deployment_storage, ip=None) +host_node_instance = self._node_instance(deployment_storage, host_node, +
[1/3] incubator-ariatosca git commit: ARIA-55 Implement task retry and abort mechanism [Forced Update!]
Repository: incubator-ariatosca Updated Branches: refs/heads/ARIA-56-node-ip 1200ce82b -> 3caf17717 (forced update) ARIA-55 Implement task retry and abort 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/8a00b5fc Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/8a00b5fc Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/8a00b5fc Branch: refs/heads/ARIA-56-node-ip Commit: 8a00b5fce2c737058f10c1e3d3a92bdcfe53e882 Parents: 12e175b Author: Dan KilmanAuthored: Thu Jan 5 13:00:01 2017 +0200 Committer: Dan Kilman Committed: Thu Jan 5 13:21:35 2017 +0200 -- aria/orchestrator/exceptions.py | 16 .../workflows/core/events_handler.py| 25 -- aria/storage/base_model.py | 10 ++- .../orchestrator/workflows/core/test_engine.py | 94 +++- .../workflows/executor/test_executor.py | 1 + .../workflows/executor/test_process_executor.py | 1 + 6 files changed, 136 insertions(+), 11 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/8a00b5fc/aria/orchestrator/exceptions.py -- diff --git a/aria/orchestrator/exceptions.py b/aria/orchestrator/exceptions.py index 74e9002..bd5238e 100644 --- a/aria/orchestrator/exceptions.py +++ b/aria/orchestrator/exceptions.py @@ -30,3 +30,19 @@ class PluginAlreadyExistsError(AriaError): Raised when a plugin with the same package name and package version already exists """ pass + + +class TaskRetryException(RuntimeError): +""" +Used internally when ctx.task.retry is called +""" +def __init__(self, message, retry_interval): +super(TaskRetryException, self).__init__(message) +self.retry_interval = retry_interval + + +class TaskAbortException(RuntimeError): +""" +Used internally when ctx.task.abort is called +""" +pass http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/8a00b5fc/aria/orchestrator/workflows/core/events_handler.py -- diff --git a/aria/orchestrator/workflows/core/events_handler.py b/aria/orchestrator/workflows/core/events_handler.py index d05cbcb..c973ad9 100644 --- a/aria/orchestrator/workflows/core/events_handler.py +++ b/aria/orchestrator/workflows/core/events_handler.py @@ -27,7 +27,7 @@ from datetime import ( ) from ... import events - +from ... import exceptions @events.sent_task_signal.connect def _task_sent(task, *args, **kwargs): @@ -43,18 +43,25 @@ def _task_started(task, *args, **kwargs): @events.on_failure_task_signal.connect -def _task_failed(task, *args, **kwargs): +def _task_failed(task, exception, *args, **kwargs): with task._update(): -should_retry = ( -(task.retry_count < task.max_attempts - 1 or - task.max_attempts == task.INFINITE_RETRIES) and -# ignore_failure check here means the task will not be retries and it will be marked as -# failed. The engine will also look at ignore_failure so it won't fail the workflow. -not task.ignore_failure) +should_retry = all([ +not isinstance(exception, exceptions.TaskAbortException), +task.retry_count < task.max_attempts - 1 or task.max_attempts == task.INFINITE_RETRIES, +# ignore_failure check here means the task will not be retries and it will be marked +# as failed. The engine will also look at ignore_failure so it won't fail the +# workflow. +not task.ignore_failure +]) if should_retry: +retry_interval = None +if isinstance(exception, exceptions.TaskRetryException): +retry_interval = exception.retry_interval +if retry_interval is None: +retry_interval = task.retry_interval task.status = task.RETRYING task.retry_count += 1 -task.due_at = datetime.utcnow() + timedelta(seconds=task.retry_interval) +task.due_at = datetime.utcnow() + timedelta(seconds=retry_interval) else: task.ended_at = datetime.utcnow() task.status = task.FAILED http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/8a00b5fc/aria/storage/base_model.py -- diff --git a/aria/storage/base_model.py b/aria/storage/base_model.py index d1aebf2..97c541c 100644 --- a/aria/storage/base_model.py +++ b/aria/storage/base_model.py @@ -52,8 +52,8 @@ from sqlalchemy import ( orm, ) +from
[GitHub] incubator-ariatosca pull request #41: ARIA-34 Adding get/download resource a...
Github user asfgit closed the pull request at: https://github.com/apache/incubator-ariatosca/pull/41 --- 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. ---
[jira] [Commented] (ARIA-55) API for task retry and task abort
[ https://issues.apache.org/jira/browse/ARIA-55?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15801546#comment-15801546 ] ASF subversion and git services commented on ARIA-55: - Commit 8a00b5fce2c737058f10c1e3d3a92bdcfe53e882 in incubator-ariatosca's branch refs/heads/ARIA-34-render-resource from [~d...@gigaspaces.com] [ https://git-wip-us.apache.org/repos/asf?p=incubator-ariatosca.git;h=8a00b5f ] ARIA-55 Implement task retry and abort mechanism > API for task retry and task abort > - > > Key: ARIA-55 > URL: https://issues.apache.org/jira/browse/ARIA-55 > Project: AriaTosca > Issue Type: Story >Reporter: Ran Ziv >Assignee: Dan Kilman > > Add an API for aborting a running task, or setting it for a retry after a > given amount of time -- This message was sent by Atlassian JIRA (v6.3.4#6332)
incubator-ariatosca git commit: ARIA-55 Implement task retry and abort mechanism
Repository: incubator-ariatosca Updated Branches: refs/heads/master 12e175b42 -> 8a00b5fce ARIA-55 Implement task retry and abort 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/8a00b5fc Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/8a00b5fc Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/8a00b5fc Branch: refs/heads/master Commit: 8a00b5fce2c737058f10c1e3d3a92bdcfe53e882 Parents: 12e175b Author: Dan KilmanAuthored: Thu Jan 5 13:00:01 2017 +0200 Committer: Dan Kilman Committed: Thu Jan 5 13:21:35 2017 +0200 -- aria/orchestrator/exceptions.py | 16 .../workflows/core/events_handler.py| 25 -- aria/storage/base_model.py | 10 ++- .../orchestrator/workflows/core/test_engine.py | 94 +++- .../workflows/executor/test_executor.py | 1 + .../workflows/executor/test_process_executor.py | 1 + 6 files changed, 136 insertions(+), 11 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/8a00b5fc/aria/orchestrator/exceptions.py -- diff --git a/aria/orchestrator/exceptions.py b/aria/orchestrator/exceptions.py index 74e9002..bd5238e 100644 --- a/aria/orchestrator/exceptions.py +++ b/aria/orchestrator/exceptions.py @@ -30,3 +30,19 @@ class PluginAlreadyExistsError(AriaError): Raised when a plugin with the same package name and package version already exists """ pass + + +class TaskRetryException(RuntimeError): +""" +Used internally when ctx.task.retry is called +""" +def __init__(self, message, retry_interval): +super(TaskRetryException, self).__init__(message) +self.retry_interval = retry_interval + + +class TaskAbortException(RuntimeError): +""" +Used internally when ctx.task.abort is called +""" +pass http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/8a00b5fc/aria/orchestrator/workflows/core/events_handler.py -- diff --git a/aria/orchestrator/workflows/core/events_handler.py b/aria/orchestrator/workflows/core/events_handler.py index d05cbcb..c973ad9 100644 --- a/aria/orchestrator/workflows/core/events_handler.py +++ b/aria/orchestrator/workflows/core/events_handler.py @@ -27,7 +27,7 @@ from datetime import ( ) from ... import events - +from ... import exceptions @events.sent_task_signal.connect def _task_sent(task, *args, **kwargs): @@ -43,18 +43,25 @@ def _task_started(task, *args, **kwargs): @events.on_failure_task_signal.connect -def _task_failed(task, *args, **kwargs): +def _task_failed(task, exception, *args, **kwargs): with task._update(): -should_retry = ( -(task.retry_count < task.max_attempts - 1 or - task.max_attempts == task.INFINITE_RETRIES) and -# ignore_failure check here means the task will not be retries and it will be marked as -# failed. The engine will also look at ignore_failure so it won't fail the workflow. -not task.ignore_failure) +should_retry = all([ +not isinstance(exception, exceptions.TaskAbortException), +task.retry_count < task.max_attempts - 1 or task.max_attempts == task.INFINITE_RETRIES, +# ignore_failure check here means the task will not be retries and it will be marked +# as failed. The engine will also look at ignore_failure so it won't fail the +# workflow. +not task.ignore_failure +]) if should_retry: +retry_interval = None +if isinstance(exception, exceptions.TaskRetryException): +retry_interval = exception.retry_interval +if retry_interval is None: +retry_interval = task.retry_interval task.status = task.RETRYING task.retry_count += 1 -task.due_at = datetime.utcnow() + timedelta(seconds=task.retry_interval) +task.due_at = datetime.utcnow() + timedelta(seconds=retry_interval) else: task.ended_at = datetime.utcnow() task.status = task.FAILED http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/8a00b5fc/aria/storage/base_model.py -- diff --git a/aria/storage/base_model.py b/aria/storage/base_model.py index d1aebf2..97c541c 100644 --- a/aria/storage/base_model.py +++ b/aria/storage/base_model.py @@ -52,8 +52,8 @@ from sqlalchemy import ( orm, ) +from ..orchestrator.exceptions import
[GitHub] incubator-ariatosca pull request #40: ARIA-55 Implement task retry and abort...
Github user asfgit closed the pull request at: https://github.com/apache/incubator-ariatosca/pull/40 --- 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 Push Summary
Repository: incubator-ariatosca Updated Branches: refs/heads/ARIA-55-task-abort-retry [deleted] 8a00b5fce
incubator-ariatosca git commit: ARIA-34 Adding get/download resource and render API (as jinja template) [Forced Update!]
Repository: incubator-ariatosca Updated Branches: refs/heads/ARIA-34-render-resource ee62a02a4 -> 97e078954 (forced update) ARIA-34 Adding get/download resource and render API (as jinja template) Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/97e07895 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/97e07895 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/97e07895 Branch: refs/heads/ARIA-34-render-resource Commit: 97e078954e6326a0727909b92423de63fe2114f9 Parents: 12e175b Author: Dan KilmanAuthored: Thu Jan 5 14:15:40 2017 +0200 Committer: Dan Kilman Committed: Thu Jan 5 16:26:16 2017 +0200 -- aria/orchestrator/context/common.py | 48 ++--- .../context/test_resource_render.py | 73 2 files changed, 113 insertions(+), 8 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/97e07895/aria/orchestrator/context/common.py -- diff --git a/aria/orchestrator/context/common.py b/aria/orchestrator/context/common.py index fdbe152..53844e8 100644 --- a/aria/orchestrator/context/common.py +++ b/aria/orchestrator/context/common.py @@ -17,6 +17,8 @@ A common context for both workflow and operation """ from uuid import uuid4 +import jinja2 + from aria import logger from aria.storage import exceptions @@ -97,19 +99,49 @@ class BaseContext(logger.LoggerMixin): Download a blueprint resource from the resource storage """ try: -return self.resource.deployment.download(entry_id=self.deployment.id, - destination=destination, - path=path) +self.resource.deployment.download(entry_id=str(self.deployment.id), + destination=destination, + path=path) except exceptions.StorageError: -return self.resource.blueprint.download(entry_id=self.blueprint.id, -destination=destination, -path=path) +self.resource.blueprint.download(entry_id=str(self.blueprint.id), + destination=destination, + path=path) + +def download_resource_and_render(self, destination, path=None, variables=None): +""" +Download a blueprint resource from the resource storage render its content as a jinja +template using the provided variables. ctx is available to the template without providing it +explicitly. +""" +self.download_resource(destination=destination, path=path) +with open(destination, 'rb') as f: +resource_content = f.read() +resource_content = self._render_resource(resource_content=resource_content, + variables=variables) +with open(destination, 'wb') as f: +f.write(resource_content) def get_resource(self, path=None): """ Read a deployment resource as string from the resource storage """ try: -return self.resource.deployment.read(entry_id=self.deployment.id, path=path) +return self.resource.deployment.read(entry_id=str(self.deployment.id), path=path) except exceptions.StorageError: -return self.resource.blueprint.read(entry_id=self.blueprint.id, path=path) +return self.resource.blueprint.read(entry_id=str(self.blueprint.id), path=path) + +def get_resource_and_render(self, path=None, variables=None): +""" +Read a deployment resource as string from the resource storage and render it as a jinja +template using the provided variables. ctx is available to the template without providing it +explicitly. +""" +resource_content = self.get_resource(path=path) +return self._render_resource(resource_content=resource_content, variables=variables) + +def _render_resource(self, resource_content, variables): +variables = variables or {} +if 'ctx' not in variables: +variables['ctx'] = self +resource_template = jinja2.Template(resource_content) +return resource_template.render(variables) http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/97e07895/tests/orchestrator/context/test_resource_render.py
[jira] [Commented] (ARIA-34) API for rendering a downloaded resource
[ https://issues.apache.org/jira/browse/ARIA-34?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15801478#comment-15801478 ] ASF subversion and git services commented on ARIA-34: - Commit 97e078954e6326a0727909b92423de63fe2114f9 in incubator-ariatosca's branch refs/heads/ARIA-34-render-resource from [~d...@gigaspaces.com] [ https://git-wip-us.apache.org/repos/asf?p=incubator-ariatosca.git;h=97e0789 ] ARIA-34 Adding get/download resource and render API (as jinja template) > API for rendering a downloaded resource > --- > > Key: ARIA-34 > URL: https://issues.apache.org/jira/browse/ARIA-34 > Project: AriaTosca > Issue Type: Story >Reporter: Ran Ziv >Assignee: Dan Kilman > > Add an API for downloading + rendering a resource from the storage, similar > to the workflow-context's "download_resource" method -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[GitHub] incubator-ariatosca pull request #40: ARIA-55 Implement task retry and abort...
Github user dankilman commented on a diff in the pull request: https://github.com/apache/incubator-ariatosca/pull/40#discussion_r94775822 --- Diff: aria/orchestrator/workflows/core/events_handler.py --- @@ -43,18 +43,25 @@ def _task_started(task, *args, **kwargs): @events.on_failure_task_signal.connect -def _task_failed(task, *args, **kwargs): +def _task_failed(task, exception, *args, **kwargs): with task._update(): -should_retry = ( -(task.retry_count < task.max_attempts - 1 or - task.max_attempts == task.INFINITE_RETRIES) and -# ignore_failure check here means the task will not be retries and it will be marked as -# failed. The engine will also look at ignore_failure so it won't fail the workflow. -not task.ignore_failure) +should_retry = all([ +not isinstance(exception, exceptions.TaskAbortException), +task.retry_count < task.max_attempts - 1 or task.max_attempts == task.INFINITE_RETRIES, +# ignore_failure check here means the task will not be retries and it will be marked +# as failed. The engine will also look at ignore_failure so it won't fail the +# workflow. +not task.ignore_failure +]) if should_retry: +retry_interval = None --- End diff -- nope --- 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. ---
[jira] [Commented] (ARIA-56) API for retrieving a node's host IP
[ https://issues.apache.org/jira/browse/ARIA-56?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15801474#comment-15801474 ] ASF subversion and git services commented on ARIA-56: - Commit 1200ce82b35749af3c2cd32ef119e08c2249adc1 in incubator-ariatosca's branch refs/heads/ARIA-56-node-ip from [~d...@gigaspaces.com] [ https://git-wip-us.apache.org/repos/asf?p=incubator-ariatosca.git;h=1200ce8 ] ARIA-56 Implement ip property on node instance model > API for retrieving a node's host IP > --- > > Key: ARIA-56 > URL: https://issues.apache.org/jira/browse/ARIA-56 > Project: AriaTosca > Issue Type: Story >Reporter: Ran Ziv >Assignee: Dan Kilman > > The node instance's model object should have an "ip" property which will > retrieve either its IP or its host node instance's IP -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (ARIA-55) API for task retry and task abort
[ https://issues.apache.org/jira/browse/ARIA-55?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15801437#comment-15801437 ] ASF GitHub Bot commented on ARIA-55: Github user ran-z commented on a diff in the pull request: https://github.com/apache/incubator-ariatosca/pull/40#discussion_r94771879 --- Diff: aria/orchestrator/workflows/core/events_handler.py --- @@ -43,18 +43,25 @@ def _task_started(task, *args, **kwargs): @events.on_failure_task_signal.connect -def _task_failed(task, *args, **kwargs): +def _task_failed(task, exception, *args, **kwargs): with task._update(): -should_retry = ( -(task.retry_count < task.max_attempts - 1 or - task.max_attempts == task.INFINITE_RETRIES) and -# ignore_failure check here means the task will not be retries and it will be marked as -# failed. The engine will also look at ignore_failure so it won't fail the workflow. -not task.ignore_failure) +should_retry = all([ +not isinstance(exception, exceptions.TaskAbortException), +task.retry_count < task.max_attempts - 1 or task.max_attempts == task.INFINITE_RETRIES, +# ignore_failure check here means the task will not be retries and it will be marked +# as failed. The engine will also look at ignore_failure so it won't fail the +# workflow. +not task.ignore_failure +]) if should_retry: +retry_interval = None --- End diff -- maybe if this is already initialized to something then it should be the default value or any numeric value rather than None? > API for task retry and task abort > - > > Key: ARIA-55 > URL: https://issues.apache.org/jira/browse/ARIA-55 > Project: AriaTosca > Issue Type: Story >Reporter: Ran Ziv >Assignee: Dan Kilman > > Add an API for aborting a running task, or setting it for a retry after a > given amount of time -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[GitHub] incubator-ariatosca pull request #40: ARIA-55 Implement task retry and abort...
Github user ran-z commented on a diff in the pull request: https://github.com/apache/incubator-ariatosca/pull/40#discussion_r94771879 --- Diff: aria/orchestrator/workflows/core/events_handler.py --- @@ -43,18 +43,25 @@ def _task_started(task, *args, **kwargs): @events.on_failure_task_signal.connect -def _task_failed(task, *args, **kwargs): +def _task_failed(task, exception, *args, **kwargs): with task._update(): -should_retry = ( -(task.retry_count < task.max_attempts - 1 or - task.max_attempts == task.INFINITE_RETRIES) and -# ignore_failure check here means the task will not be retries and it will be marked as -# failed. The engine will also look at ignore_failure so it won't fail the workflow. -not task.ignore_failure) +should_retry = all([ +not isinstance(exception, exceptions.TaskAbortException), +task.retry_count < task.max_attempts - 1 or task.max_attempts == task.INFINITE_RETRIES, +# ignore_failure check here means the task will not be retries and it will be marked +# as failed. The engine will also look at ignore_failure so it won't fail the +# workflow. +not task.ignore_failure +]) if should_retry: +retry_interval = None --- End diff -- maybe if this is already initialized to something then it should be the default value or any numeric value rather than None? --- 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. ---
[jira] [Commented] (ARIA-34) API for rendering a downloaded resource
[ https://issues.apache.org/jira/browse/ARIA-34?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15801412#comment-15801412 ] ASF GitHub Bot commented on ARIA-34: Github user ran-z commented on a diff in the pull request: https://github.com/apache/incubator-ariatosca/pull/41#discussion_r94771221 --- Diff: aria/orchestrator/context/common.py --- @@ -97,19 +99,49 @@ def download_resource(self, destination, path=None): Download a blueprint resource from the resource storage """ try: -return self.resource.deployment.download(entry_id=self.deployment.id, - destination=destination, - path=path) + self.resource.deployment.download(entry_id=str(self.deployment.id), + destination=destination, + path=path) except exceptions.StorageError: -return self.resource.blueprint.download(entry_id=self.blueprint.id, - destination=destination, -path=path) + self.resource.blueprint.download(entry_id=str(self.blueprint.id), + destination=destination, + path=path) + +def download_resource_and_render(self, destination, path=None, variables=None): +""" +Download a blueprint resource from the resource storage render its content as a jinja +template using the provided variables. ctx is available to the template without providing it +explicitly. +""" +self.download_resource(destination=destination, path=path) +with open(destination, 'rb') as f: --- End diff -- got it thanks > API for rendering a downloaded resource > --- > > Key: ARIA-34 > URL: https://issues.apache.org/jira/browse/ARIA-34 > Project: AriaTosca > Issue Type: Story >Reporter: Ran Ziv >Assignee: Dan Kilman > > Add an API for downloading + rendering a resource from the storage, similar > to the workflow-context's "download_resource" method -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[GitHub] incubator-ariatosca pull request #41: ARIA-34 Adding get/download resource a...
Github user ran-z commented on a diff in the pull request: https://github.com/apache/incubator-ariatosca/pull/41#discussion_r94771221 --- Diff: aria/orchestrator/context/common.py --- @@ -97,19 +99,49 @@ def download_resource(self, destination, path=None): Download a blueprint resource from the resource storage """ try: -return self.resource.deployment.download(entry_id=self.deployment.id, - destination=destination, - path=path) + self.resource.deployment.download(entry_id=str(self.deployment.id), + destination=destination, + path=path) except exceptions.StorageError: -return self.resource.blueprint.download(entry_id=self.blueprint.id, - destination=destination, -path=path) + self.resource.blueprint.download(entry_id=str(self.blueprint.id), + destination=destination, + path=path) + +def download_resource_and_render(self, destination, path=None, variables=None): +""" +Download a blueprint resource from the resource storage render its content as a jinja +template using the provided variables. ctx is available to the template without providing it +explicitly. +""" +self.download_resource(destination=destination, path=path) +with open(destination, 'rb') as f: --- End diff -- got it thanks --- 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. ---
[jira] [Commented] (ARIA-34) API for rendering a downloaded resource
[ https://issues.apache.org/jira/browse/ARIA-34?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15801407#comment-15801407 ] ASF GitHub Bot commented on ARIA-34: Github user dankilman commented on a diff in the pull request: https://github.com/apache/incubator-ariatosca/pull/41#discussion_r94770916 --- Diff: aria/orchestrator/context/common.py --- @@ -97,19 +99,49 @@ def download_resource(self, destination, path=None): Download a blueprint resource from the resource storage """ try: -return self.resource.deployment.download(entry_id=self.deployment.id, - destination=destination, - path=path) + self.resource.deployment.download(entry_id=str(self.deployment.id), + destination=destination, + path=path) except exceptions.StorageError: -return self.resource.blueprint.download(entry_id=self.blueprint.id, - destination=destination, -path=path) + self.resource.blueprint.download(entry_id=str(self.blueprint.id), + destination=destination, + path=path) + +def download_resource_and_render(self, destination, path=None, variables=None): +""" +Download a blueprint resource from the resource storage render its content as a jinja +template using the provided variables. ctx is available to the template without providing it +explicitly. +""" +self.download_resource(destination=destination, path=path) +with open(destination, 'rb') as f: --- End diff -- on windows, omitting the `b` will cause newlines to be written as CRLF regardless of how they were originally. So it is definitely required for `wb`. The `rb` is for consistency > API for rendering a downloaded resource > --- > > Key: ARIA-34 > URL: https://issues.apache.org/jira/browse/ARIA-34 > Project: AriaTosca > Issue Type: Story >Reporter: Ran Ziv >Assignee: Dan Kilman > > Add an API for downloading + rendering a resource from the storage, similar > to the workflow-context's "download_resource" method -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[GitHub] incubator-ariatosca pull request #41: ARIA-34 Adding get/download resource a...
Github user dankilman commented on a diff in the pull request: https://github.com/apache/incubator-ariatosca/pull/41#discussion_r94770916 --- Diff: aria/orchestrator/context/common.py --- @@ -97,19 +99,49 @@ def download_resource(self, destination, path=None): Download a blueprint resource from the resource storage """ try: -return self.resource.deployment.download(entry_id=self.deployment.id, - destination=destination, - path=path) + self.resource.deployment.download(entry_id=str(self.deployment.id), + destination=destination, + path=path) except exceptions.StorageError: -return self.resource.blueprint.download(entry_id=self.blueprint.id, - destination=destination, -path=path) + self.resource.blueprint.download(entry_id=str(self.blueprint.id), + destination=destination, + path=path) + +def download_resource_and_render(self, destination, path=None, variables=None): +""" +Download a blueprint resource from the resource storage render its content as a jinja +template using the provided variables. ctx is available to the template without providing it +explicitly. +""" +self.download_resource(destination=destination, path=path) +with open(destination, 'rb') as f: --- End diff -- on windows, omitting the `b` will cause newlines to be written as CRLF regardless of how they were originally. So it is definitely required for `wb`. The `rb` is for consistency --- 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. ---
[jira] [Commented] (ARIA-56) API for retrieving a node's host IP
[ https://issues.apache.org/jira/browse/ARIA-56?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15801396#comment-15801396 ] ASF GitHub Bot commented on ARIA-56: Github user ran-z commented on a diff in the pull request: https://github.com/apache/incubator-ariatosca/pull/42#discussion_r94770242 --- Diff: tests/storage/test_models.py --- @@ -664,6 +664,72 @@ def test_node_instance_model_creation(self, node_storage, is_valid, name, runtim assert node_instance.deployment == node_storage.deployment.list()[0] +class TestNodeInstanceIP(object): + +ip = '1.1.1.1' + +def test_ip_on_none_hosted_node_instance(self, deployment_storage): --- End diff -- I'd also add a test where the instance in question is not a host but the host does have IP (say as runtime property) and verify the IP is returned. technically speaking its the same code path as "test_runtime_property_ip_on_hosted_node_instance", but it's a common use case and we should verify it as well > API for retrieving a node's host IP > --- > > Key: ARIA-56 > URL: https://issues.apache.org/jira/browse/ARIA-56 > Project: AriaTosca > Issue Type: Story >Reporter: Ran Ziv >Assignee: Dan Kilman > > The node instance's model object should have an "ip" property which will > retrieve either its IP or its host node instance's IP -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[GitHub] incubator-ariatosca pull request #41: ARIA-34 Adding get/download resource a...
Github user ran-z commented on a diff in the pull request: https://github.com/apache/incubator-ariatosca/pull/41#discussion_r94769660 --- Diff: aria/orchestrator/context/common.py --- @@ -97,19 +99,49 @@ def download_resource(self, destination, path=None): Download a blueprint resource from the resource storage """ try: -return self.resource.deployment.download(entry_id=self.deployment.id, - destination=destination, - path=path) + self.resource.deployment.download(entry_id=str(self.deployment.id), + destination=destination, + path=path) except exceptions.StorageError: -return self.resource.blueprint.download(entry_id=self.blueprint.id, - destination=destination, -path=path) + self.resource.blueprint.download(entry_id=str(self.blueprint.id), + destination=destination, + path=path) + +def download_resource_and_render(self, destination, path=None, variables=None): +""" +Download a blueprint resource from the resource storage render its content as a jinja +template using the provided variables. ctx is available to the template without providing it +explicitly. +""" +self.download_resource(destination=destination, path=path) +with open(destination, 'rb') as f: --- End diff -- why the use of rb and wb? since its rendering doesnt it make sense to use r and w? --- 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. ---
[jira] [Commented] (ARIA-56) API for retrieving a node's host IP
[ https://issues.apache.org/jira/browse/ARIA-56?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15801327#comment-15801327 ] ASF subversion and git services commented on ARIA-56: - Commit c27a84ded7378be83594ab1b5e151ae41cae969b in incubator-ariatosca's branch refs/heads/ARIA-56-node-ip from [~d...@gigaspaces.com] [ https://git-wip-us.apache.org/repos/asf?p=incubator-ariatosca.git;h=c27a84d ] ARIA-56 Implement ip property on node instance model > API for retrieving a node's host IP > --- > > Key: ARIA-56 > URL: https://issues.apache.org/jira/browse/ARIA-56 > Project: AriaTosca > Issue Type: Story >Reporter: Ran Ziv >Assignee: Dan Kilman > > The node instance's model object should have an "ip" property which will > retrieve either its IP or its host node instance's IP -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (ARIA-34) API for rendering a downloaded resource
[ https://issues.apache.org/jira/browse/ARIA-34?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15801326#comment-15801326 ] ASF subversion and git services commented on ARIA-34: - Commit ee62a02a4bca1cc63d6c6053c3a1b57e7c5391dc in incubator-ariatosca's branch refs/heads/ARIA-34-render-resource from [~d...@gigaspaces.com] [ https://git-wip-us.apache.org/repos/asf?p=incubator-ariatosca.git;h=ee62a02 ] ARIA-34 Adding get/download resource and render API (as jinja template) > API for rendering a downloaded resource > --- > > Key: ARIA-34 > URL: https://issues.apache.org/jira/browse/ARIA-34 > Project: AriaTosca > Issue Type: Story >Reporter: Ran Ziv >Assignee: Dan Kilman > > Add an API for downloading + rendering a resource from the storage, similar > to the workflow-context's "download_resource" method -- This message was sent by Atlassian JIRA (v6.3.4#6332)
incubator-ariatosca git commit: ARIA-34 Adding get/download resource and render API (as jinja template) [Forced Update!]
Repository: incubator-ariatosca Updated Branches: refs/heads/ARIA-34-render-resource 06b53650e -> ee62a02a4 (forced update) ARIA-34 Adding get/download resource and render API (as jinja template) Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/ee62a02a Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/ee62a02a Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/ee62a02a Branch: refs/heads/ARIA-34-render-resource Commit: ee62a02a4bca1cc63d6c6053c3a1b57e7c5391dc Parents: 12e175b Author: Dan KilmanAuthored: Thu Jan 5 14:15:40 2017 +0200 Committer: Dan Kilman Committed: Thu Jan 5 15:13:53 2017 +0200 -- aria/orchestrator/context/common.py | 48 ++--- .../context/test_resource_render.py | 73 2 files changed, 113 insertions(+), 8 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/ee62a02a/aria/orchestrator/context/common.py -- diff --git a/aria/orchestrator/context/common.py b/aria/orchestrator/context/common.py index fdbe152..53844e8 100644 --- a/aria/orchestrator/context/common.py +++ b/aria/orchestrator/context/common.py @@ -17,6 +17,8 @@ A common context for both workflow and operation """ from uuid import uuid4 +import jinja2 + from aria import logger from aria.storage import exceptions @@ -97,19 +99,49 @@ class BaseContext(logger.LoggerMixin): Download a blueprint resource from the resource storage """ try: -return self.resource.deployment.download(entry_id=self.deployment.id, - destination=destination, - path=path) +self.resource.deployment.download(entry_id=str(self.deployment.id), + destination=destination, + path=path) except exceptions.StorageError: -return self.resource.blueprint.download(entry_id=self.blueprint.id, -destination=destination, -path=path) +self.resource.blueprint.download(entry_id=str(self.blueprint.id), + destination=destination, + path=path) + +def download_resource_and_render(self, destination, path=None, variables=None): +""" +Download a blueprint resource from the resource storage render its content as a jinja +template using the provided variables. ctx is available to the template without providing it +explicitly. +""" +self.download_resource(destination=destination, path=path) +with open(destination, 'rb') as f: +resource_content = f.read() +resource_content = self._render_resource(resource_content=resource_content, + variables=variables) +with open(destination, 'wb') as f: +f.write(resource_content) def get_resource(self, path=None): """ Read a deployment resource as string from the resource storage """ try: -return self.resource.deployment.read(entry_id=self.deployment.id, path=path) +return self.resource.deployment.read(entry_id=str(self.deployment.id), path=path) except exceptions.StorageError: -return self.resource.blueprint.read(entry_id=self.blueprint.id, path=path) +return self.resource.blueprint.read(entry_id=str(self.blueprint.id), path=path) + +def get_resource_and_render(self, path=None, variables=None): +""" +Read a deployment resource as string from the resource storage and render it as a jinja +template using the provided variables. ctx is available to the template without providing it +explicitly. +""" +resource_content = self.get_resource(path=path) +return self._render_resource(resource_content=resource_content, variables=variables) + +def _render_resource(self, resource_content, variables): +variables = variables or {} +if 'ctx' not in variables: +variables['ctx'] = self +resource_template = jinja2.Template(resource_content) +return resource_template.render(variables) http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/ee62a02a/tests/orchestrator/context/test_resource_render.py
[GitHub] incubator-ariatosca pull request #42: Implement ip property on node instance...
GitHub user dankilman opened a pull request: https://github.com/apache/incubator-ariatosca/pull/42 Implement ip property on node instance model You can merge this pull request into a Git repository by running: $ git pull https://github.com/apache/incubator-ariatosca ARIA-56-node-ip Alternatively you can review and apply these changes as the patch at: https://github.com/apache/incubator-ariatosca/pull/42.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #42 commit 388126d63bec859c3e0a118ce5efd0e126ac80a3 Author: Dan KilmanDate: 2017-01-05T13:01:16Z Implement ip property on node instance model --- 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: Adding get/download resource and render API (as jinja template)
Repository: incubator-ariatosca Updated Branches: refs/heads/ARIA-34-render-resource [created] 06b53650e Adding get/download resource and render API (as jinja template) Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/06b53650 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/06b53650 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/06b53650 Branch: refs/heads/ARIA-34-render-resource Commit: 06b53650e045f309d37c35f48c825a6521d6bf26 Parents: 12e175b Author: Dan KilmanAuthored: Thu Jan 5 14:15:40 2017 +0200 Committer: Dan Kilman Committed: Thu Jan 5 14:15:40 2017 +0200 -- aria/orchestrator/context/common.py | 48 ++--- .../context/test_resource_render.py | 73 2 files changed, 113 insertions(+), 8 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/06b53650/aria/orchestrator/context/common.py -- diff --git a/aria/orchestrator/context/common.py b/aria/orchestrator/context/common.py index fdbe152..53844e8 100644 --- a/aria/orchestrator/context/common.py +++ b/aria/orchestrator/context/common.py @@ -17,6 +17,8 @@ A common context for both workflow and operation """ from uuid import uuid4 +import jinja2 + from aria import logger from aria.storage import exceptions @@ -97,19 +99,49 @@ class BaseContext(logger.LoggerMixin): Download a blueprint resource from the resource storage """ try: -return self.resource.deployment.download(entry_id=self.deployment.id, - destination=destination, - path=path) +self.resource.deployment.download(entry_id=str(self.deployment.id), + destination=destination, + path=path) except exceptions.StorageError: -return self.resource.blueprint.download(entry_id=self.blueprint.id, -destination=destination, -path=path) +self.resource.blueprint.download(entry_id=str(self.blueprint.id), + destination=destination, + path=path) + +def download_resource_and_render(self, destination, path=None, variables=None): +""" +Download a blueprint resource from the resource storage render its content as a jinja +template using the provided variables. ctx is available to the template without providing it +explicitly. +""" +self.download_resource(destination=destination, path=path) +with open(destination, 'rb') as f: +resource_content = f.read() +resource_content = self._render_resource(resource_content=resource_content, + variables=variables) +with open(destination, 'wb') as f: +f.write(resource_content) def get_resource(self, path=None): """ Read a deployment resource as string from the resource storage """ try: -return self.resource.deployment.read(entry_id=self.deployment.id, path=path) +return self.resource.deployment.read(entry_id=str(self.deployment.id), path=path) except exceptions.StorageError: -return self.resource.blueprint.read(entry_id=self.blueprint.id, path=path) +return self.resource.blueprint.read(entry_id=str(self.blueprint.id), path=path) + +def get_resource_and_render(self, path=None, variables=None): +""" +Read a deployment resource as string from the resource storage and render it as a jinja +template using the provided variables. ctx is available to the template without providing it +explicitly. +""" +resource_content = self.get_resource(path=path) +return self._render_resource(resource_content=resource_content, variables=variables) + +def _render_resource(self, resource_content, variables): +variables = variables or {} +if 'ctx' not in variables: +variables['ctx'] = self +resource_template = jinja2.Template(resource_content) +return resource_template.render(variables) http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/06b53650/tests/orchestrator/context/test_resource_render.py -- diff --git
[GitHub] incubator-ariatosca pull request #41: Adding get/download resource and rende...
GitHub user dankilman opened a pull request: https://github.com/apache/incubator-ariatosca/pull/41 Adding get/download resource and render API (as jinja template) You can merge this pull request into a Git repository by running: $ git pull https://github.com/apache/incubator-ariatosca ARIA-34-render-resource Alternatively you can review and apply these changes as the patch at: https://github.com/apache/incubator-ariatosca/pull/41.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #41 commit 06b53650e045f309d37c35f48c825a6521d6bf26 Author: Dan KilmanDate: 2017-01-05T12:15:40Z Adding get/download resource and render API (as jinja template) --- 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. ---
[jira] [Commented] (ARIA-57) Custom executions state transition support
[ https://issues.apache.org/jira/browse/ARIA-57?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15801097#comment-15801097 ] ASF subversion and git services commented on ARIA-57: - Commit 69e8687705767ec1962f27916df8417eb59eef0e in incubator-ariatosca's branch refs/heads/ARIA-55-task-abort-retry from mxmrlv [ https://git-wip-us.apache.org/repos/asf?p=incubator-ariatosca.git;h=69e8687 ] ARIA-57-Custom executions state transition support As part of this commit, a new valid transition was added between cancelling and force cancelling > Custom executions state transition support > -- > > Key: ARIA-57 > URL: https://issues.apache.org/jira/browse/ARIA-57 > Project: AriaTosca > Issue Type: Story >Affects Versions: 0.1.0 >Reporter: Maxim Orlov >Assignee: Maxim Orlov >Priority: Minor > Fix For: 0.1.0 > > > Executions should support custom valid state transitions -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[GitHub] incubator-ariatosca pull request #40: ARIA-55 Implement task retry and abort...
GitHub user dankilman opened a pull request: https://github.com/apache/incubator-ariatosca/pull/40 ARIA-55 Implement task retry and abort mechanism You can merge this pull request into a Git repository by running: $ git pull https://github.com/apache/incubator-ariatosca ARIA-55-task-abort-retry Alternatively you can review and apply these changes as the patch at: https://github.com/apache/incubator-ariatosca/pull/40.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #40 commit 8a00b5fce2c737058f10c1e3d3a92bdcfe53e882 Author: Dan KilmanDate: 2017-01-05T11:00:01Z ARIA-55 Implement task retry and abort mechanism --- 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. ---
[jira] [Commented] (ARIA-55) API for task retry and task abort
[ https://issues.apache.org/jira/browse/ARIA-55?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15801095#comment-15801095 ] ASF subversion and git services commented on ARIA-55: - Commit f100f10eabffdc75e84a5f40e790c83bfc4fa281 in incubator-ariatosca's branch refs/heads/ARIA-55-task-abort-retry from [~d...@gigaspaces.com] [ https://git-wip-us.apache.org/repos/asf?p=incubator-ariatosca.git;h=f100f10 ] ARIA-55 Implement task retry and abort mechanism > API for task retry and task abort > - > > Key: ARIA-55 > URL: https://issues.apache.org/jira/browse/ARIA-55 > Project: AriaTosca > Issue Type: Story >Reporter: Ran Ziv >Assignee: Dan Kilman > > Add an API for aborting a running task, or setting it for a retry after a > given amount of time -- This message was sent by Atlassian JIRA (v6.3.4#6332)
incubator-ariatosca git commit: ARIA-55 Implement task retry and abort mechanism
Repository: incubator-ariatosca Updated Branches: refs/heads/ARIA-55-task-abort-retry [created] f100f10ea ARIA-55 Implement task retry and abort 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/f100f10e Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/f100f10e Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/f100f10e Branch: refs/heads/ARIA-55-task-abort-retry Commit: f100f10eabffdc75e84a5f40e790c83bfc4fa281 Parents: 860d69b Author: Dan KilmanAuthored: Thu Jan 5 13:00:01 2017 +0200 Committer: Dan Kilman Committed: Thu Jan 5 13:18:21 2017 +0200 -- aria/orchestrator/exceptions.py | 16 .../workflows/core/events_handler.py| 25 -- aria/storage/base_model.py | 10 ++- .../orchestrator/workflows/core/test_engine.py | 94 +++- .../workflows/executor/test_executor.py | 1 + .../workflows/executor/test_process_executor.py | 1 + 6 files changed, 136 insertions(+), 11 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/f100f10e/aria/orchestrator/exceptions.py -- diff --git a/aria/orchestrator/exceptions.py b/aria/orchestrator/exceptions.py index 74e9002..bd5238e 100644 --- a/aria/orchestrator/exceptions.py +++ b/aria/orchestrator/exceptions.py @@ -30,3 +30,19 @@ class PluginAlreadyExistsError(AriaError): Raised when a plugin with the same package name and package version already exists """ pass + + +class TaskRetryException(RuntimeError): +""" +Used internally when ctx.task.retry is called +""" +def __init__(self, message, retry_interval): +super(TaskRetryException, self).__init__(message) +self.retry_interval = retry_interval + + +class TaskAbortException(RuntimeError): +""" +Used internally when ctx.task.abort is called +""" +pass http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/f100f10e/aria/orchestrator/workflows/core/events_handler.py -- diff --git a/aria/orchestrator/workflows/core/events_handler.py b/aria/orchestrator/workflows/core/events_handler.py index d05cbcb..c973ad9 100644 --- a/aria/orchestrator/workflows/core/events_handler.py +++ b/aria/orchestrator/workflows/core/events_handler.py @@ -27,7 +27,7 @@ from datetime import ( ) from ... import events - +from ... import exceptions @events.sent_task_signal.connect def _task_sent(task, *args, **kwargs): @@ -43,18 +43,25 @@ def _task_started(task, *args, **kwargs): @events.on_failure_task_signal.connect -def _task_failed(task, *args, **kwargs): +def _task_failed(task, exception, *args, **kwargs): with task._update(): -should_retry = ( -(task.retry_count < task.max_attempts - 1 or - task.max_attempts == task.INFINITE_RETRIES) and -# ignore_failure check here means the task will not be retries and it will be marked as -# failed. The engine will also look at ignore_failure so it won't fail the workflow. -not task.ignore_failure) +should_retry = all([ +not isinstance(exception, exceptions.TaskAbortException), +task.retry_count < task.max_attempts - 1 or task.max_attempts == task.INFINITE_RETRIES, +# ignore_failure check here means the task will not be retries and it will be marked +# as failed. The engine will also look at ignore_failure so it won't fail the +# workflow. +not task.ignore_failure +]) if should_retry: +retry_interval = None +if isinstance(exception, exceptions.TaskRetryException): +retry_interval = exception.retry_interval +if retry_interval is None: +retry_interval = task.retry_interval task.status = task.RETRYING task.retry_count += 1 -task.due_at = datetime.utcnow() + timedelta(seconds=task.retry_interval) +task.due_at = datetime.utcnow() + timedelta(seconds=retry_interval) else: task.ended_at = datetime.utcnow() task.status = task.FAILED http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/f100f10e/aria/storage/base_model.py -- diff --git a/aria/storage/base_model.py b/aria/storage/base_model.py index c7eb27c..dd6e4ce 100644 --- a/aria/storage/base_model.py +++ b/aria/storage/base_model.py @@ -52,8 +52,8 @@ from sqlalchemy import ( orm, ) +from
[jira] [Commented] (ARIA-54) Create an ARIA package on PyPI
[ https://issues.apache.org/jira/browse/ARIA-54?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15800997#comment-15800997 ] Ran Ziv commented on ARIA-54: - [~johndament] Yes thank you, I'm aware of this for the most part, I simply wanted to have a stub task for this for a later time in the future. We'll of course follow the guidelines and policies when the time comes. > Create an ARIA package on PyPI > -- > > Key: ARIA-54 > URL: https://issues.apache.org/jira/browse/ARIA-54 > Project: AriaTosca > Issue Type: Story >Reporter: Ran Ziv > -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Closed] (ARIA-57) Custom executions state transition support
[ https://issues.apache.org/jira/browse/ARIA-57?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Ran Ziv closed ARIA-57. --- > Custom executions state transition support > -- > > Key: ARIA-57 > URL: https://issues.apache.org/jira/browse/ARIA-57 > Project: AriaTosca > Issue Type: Story >Affects Versions: 0.1.0 >Reporter: Maxim Orlov >Assignee: Maxim Orlov >Priority: Minor > Fix For: 0.1.0 > > > Executions should support custom valid state transitions -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (ARIA-58) Storage model to_dict creates symbolic links
[ https://issues.apache.org/jira/browse/ARIA-58?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15800954#comment-15800954 ] ASF GitHub Bot commented on ARIA-58: Github user mxmrlv closed the pull request at: https://github.com/apache/incubator-ariatosca/pull/39 > Storage model to_dict creates symbolic links > > > Key: ARIA-58 > URL: https://issues.apache.org/jira/browse/ARIA-58 > Project: AriaTosca > Issue Type: Bug >Affects Versions: 0.1.0 >Reporter: Maxim Orlov >Assignee: Maxim Orlov > Fix For: 0.1.0 > > > When calling the to_dict method on any model, any data structure type field > (such as list or dict) gets returned as a symbolic link, thus altering that > dict/list changes the actual storage. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Closed] (ARIA-58) Storage model to_dict creates symbolic links
[ https://issues.apache.org/jira/browse/ARIA-58?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Ran Ziv closed ARIA-58. --- > Storage model to_dict creates symbolic links > > > Key: ARIA-58 > URL: https://issues.apache.org/jira/browse/ARIA-58 > Project: AriaTosca > Issue Type: Bug >Affects Versions: 0.1.0 >Reporter: Maxim Orlov >Assignee: Maxim Orlov > Fix For: 0.1.0 > > > When calling the to_dict method on any model, any data structure type field > (such as list or dict) gets returned as a symbolic link, thus altering that > dict/list changes the actual storage. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[GitHub] incubator-ariatosca pull request #39: ARIA-58-Storage-model-to_dict-creates-...
Github user mxmrlv closed the pull request at: https://github.com/apache/incubator-ariatosca/pull/39 --- 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. ---
[jira] [Resolved] (ARIA-58) Storage model to_dict creates symbolic links
[ https://issues.apache.org/jira/browse/ARIA-58?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Ran Ziv resolved ARIA-58. - Resolution: Fixed Fix Version/s: 0.1.0 > Storage model to_dict creates symbolic links > > > Key: ARIA-58 > URL: https://issues.apache.org/jira/browse/ARIA-58 > Project: AriaTosca > Issue Type: Bug >Affects Versions: 0.1.0 >Reporter: Maxim Orlov >Assignee: Maxim Orlov > Fix For: 0.1.0 > > > When calling the to_dict method on any model, any data structure type field > (such as list or dict) gets returned as a symbolic link, thus altering that > dict/list changes the actual storage. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Resolved] (ARIA-57) Custom executions state transition support
[ https://issues.apache.org/jira/browse/ARIA-57?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Ran Ziv resolved ARIA-57. - Resolution: Fixed Fix Version/s: 0.1.0 > Custom executions state transition support > -- > > Key: ARIA-57 > URL: https://issues.apache.org/jira/browse/ARIA-57 > Project: AriaTosca > Issue Type: Story >Affects Versions: 0.1.0 >Reporter: Maxim Orlov >Assignee: Maxim Orlov >Priority: Minor > Fix For: 0.1.0 > > > Executions should support custom valid state transitions -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[incubator-ariatosca] Git Push Summary
Repository: incubator-ariatosca Updated Branches: refs/heads/ARIA-58-Storage-model-to_dict-creates-symbolic-links [deleted] 2c7d326ce
incubator-ariatosca git commit: ARIA-58-Storage-model-to_dict-creates-symbolic-links
Repository: incubator-ariatosca Updated Branches: refs/heads/master 69e868770 -> 12e175b42 ARIA-58-Storage-model-to_dict-creates-symbolic-links As part of this commits, ARIA will use the builtin MutableDict and List Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/12e175b4 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/12e175b4 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/12e175b4 Branch: refs/heads/master Commit: 12e175b42caee6847d147727a83b79776d7c1eb6 Parents: 69e8687 Author: mxmrlvAuthored: Thu Jan 5 11:30:30 2017 +0200 Committer: Ran Ziv Committed: Thu Jan 5 11:46:10 2017 +0200 -- aria/storage/structure.py | 28 -- aria/storage/type.py | 54 -- 2 files changed, 26 insertions(+), 56 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/12e175b4/aria/storage/structure.py -- diff --git a/aria/storage/structure.py b/aria/storage/structure.py index d222c94..431633b 100644 --- a/aria/storage/structure.py +++ b/aria/storage/structure.py @@ -124,25 +124,29 @@ class ModelMixin(object): remote_side=remote_side_str, post_update=True) -def to_dict(self, suppress_error=False): +def to_dict(self, fields=None, suppress_error=False): """Return a dict representation of the model :param suppress_error: If set to True, sets `None` to attributes that it's unable to retrieve (e.g., if a relationship wasn't established yet, and so it's impossible to access a property through it) """ -if suppress_error: -res = dict() -for field in self.fields(): -try: -field_value = getattr(self, field) -except AttributeError: +res = dict() +fields = fields or self.fields() +for field in fields: +try: +field_value = getattr(self, field) +except AttributeError: +if suppress_error: field_value = None -res[field] = field_value -else: -# Can't simply call here `self.to_response()` because inheriting -# class might override it, but we always need the same code here -res = dict((f, getattr(self, f)) for f in self.fields()) +else: +raise +if isinstance(field_value, list): +field_value = list(field_value) +elif isinstance(field_value, dict): +field_value = dict(field_value) +res[field] = field_value + return res @classmethod http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/12e175b4/aria/storage/type.py -- diff --git a/aria/storage/type.py b/aria/storage/type.py index 84fd8dc..ab50b0f 100644 --- a/aria/storage/type.py +++ b/aria/storage/type.py @@ -60,63 +60,29 @@ class List(_MutableType): return list -class _MutableDict(mutable.Mutable, dict): +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))) -if not isinstance(value, cls): -if isinstance(value, dict): -return cls(value) -# this call will raise ValueError -try: -return mutable.Mutable.coerce(key, value) -except ValueError as e: -raise exceptions.StorageError('SQL Storage error: {0}'.format(str(e))) -else: -return value - -def __setitem__(self, key, value): -"Detect dictionary set events and emit change events." - -dict.__setitem__(self, key, value) -self.changed() - -def __delitem__(self, key): -"Detect dictionary del events and emit change events." - -dict.__delitem__(self, key) -self.changed() - - -class _MutableList(mutable.Mutable, list): +class _MutableList(mutable.MutableList): @classmethod def coerce(cls, key, value): "Convert plain dictionaries to MutableDict." +try: +return mutable.MutableList.coerce(key, value) +except ValueError as e: +raise
[jira] [Commented] (ARIA-57) Custom executions state transition support
[ https://issues.apache.org/jira/browse/ARIA-57?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15800920#comment-15800920 ] ASF subversion and git services commented on ARIA-57: - Commit 69e8687705767ec1962f27916df8417eb59eef0e in incubator-ariatosca's branch refs/heads/master from mxmrlv [ https://git-wip-us.apache.org/repos/asf?p=incubator-ariatosca.git;h=69e8687 ] ARIA-57-Custom executions state transition support As part of this commit, a new valid transition was added between cancelling and force cancelling > Custom executions state transition support > -- > > Key: ARIA-57 > URL: https://issues.apache.org/jira/browse/ARIA-57 > Project: AriaTosca > Issue Type: Story >Affects Versions: 0.1.0 >Reporter: Maxim Orlov >Assignee: Maxim Orlov >Priority: Minor > > Executions should support custom valid state transitions -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (ARIA-57) Custom executions state transition support
[ https://issues.apache.org/jira/browse/ARIA-57?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15800922#comment-15800922 ] ASF GitHub Bot commented on ARIA-57: Github user asfgit closed the pull request at: https://github.com/apache/incubator-ariatosca/pull/38 > Custom executions state transition support > -- > > Key: ARIA-57 > URL: https://issues.apache.org/jira/browse/ARIA-57 > Project: AriaTosca > Issue Type: Story >Affects Versions: 0.1.0 >Reporter: Maxim Orlov >Assignee: Maxim Orlov >Priority: Minor > > Executions should support custom valid state transitions -- This message was sent by Atlassian JIRA (v6.3.4#6332)
incubator-ariatosca git commit: ARIA-57-Custom executions state transition support
Repository: incubator-ariatosca Updated Branches: refs/heads/master 860d69bff -> 69e868770 ARIA-57-Custom executions state transition support As part of this commit, a new valid transition was added between cancelling and force cancelling Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/69e86877 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/69e86877 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/69e86877 Branch: refs/heads/master Commit: 69e8687705767ec1962f27916df8417eb59eef0e Parents: 860d69b Author: mxmrlvAuthored: Thu Jan 5 11:32:08 2017 +0200 Committer: mxmrlv Committed: Thu Jan 5 11:32:08 2017 +0200 -- aria/storage/base_model.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/69e86877/aria/storage/base_model.py -- diff --git a/aria/storage/base_model.py b/aria/storage/base_model.py index c7eb27c..d1aebf2 100644 --- a/aria/storage/base_model.py +++ b/aria/storage/base_model.py @@ -146,7 +146,7 @@ class ExecutionBase(ModelMixin): VALID_TRANSITIONS = { PENDING: [STARTED, CANCELLED], STARTED: END_STATES + [CANCELLING], -CANCELLING: END_STATES +CANCELLING: END_STATES + [FORCE_CANCELLING] } @orm.validates('status') @@ -156,7 +156,7 @@ class ExecutionBase(ModelMixin): current_status = getattr(self, key) except AttributeError: return -valid_transitions = ExecutionBase.VALID_TRANSITIONS.get(current_status, []) +valid_transitions = self.VALID_TRANSITIONS.get(current_status, []) if all([current_status is not None, current_status != value, value not in valid_transitions]):
[incubator-ariatosca] Git Push Summary
Repository: incubator-ariatosca Updated Branches: refs/heads/Misc_fixes [deleted] ba4595e23
[jira] [Commented] (ARIA-58) Storage model to_dict creates symbolic links
[ https://issues.apache.org/jira/browse/ARIA-58?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15800897#comment-15800897 ] ASF subversion and git services commented on ARIA-58: - Commit 2c7d326ce4ea65333efe5a242bdd8369fbb8e0d9 in incubator-ariatosca's branch refs/heads/ARIA-58-Storage-model-to_dict-creates-symbolic-links from mxmrlv [ https://git-wip-us.apache.org/repos/asf?p=incubator-ariatosca.git;h=2c7d326 ] ARIA-58-Storage-model-to_dict-creates-symbolic-links As part of this commits, ARIA will use the builtin MutableDict and List > Storage model to_dict creates symbolic links > > > Key: ARIA-58 > URL: https://issues.apache.org/jira/browse/ARIA-58 > Project: AriaTosca > Issue Type: Bug >Affects Versions: 0.1.0 >Reporter: Maxim Orlov >Assignee: Maxim Orlov > > When calling the to_dict method on any model, any data structure type field > (such as list or dict) gets returned as a symbolic link, thus altering that > dict/list changes the actual storage. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
incubator-ariatosca git commit: ARIA-58-Storage-model-to_dict-creates-symbolic-links [Forced Update!]
Repository: incubator-ariatosca Updated Branches: refs/heads/ARIA-58-Storage-model-to_dict-creates-symbolic-links f35bf15de -> 2c7d326ce (forced update) ARIA-58-Storage-model-to_dict-creates-symbolic-links As part of this commits, ARIA will use the builtin MutableDict and List Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/2c7d326c Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/2c7d326c Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/2c7d326c Branch: refs/heads/ARIA-58-Storage-model-to_dict-creates-symbolic-links Commit: 2c7d326ce4ea65333efe5a242bdd8369fbb8e0d9 Parents: 860d69b Author: mxmrlvAuthored: Thu Jan 5 11:30:30 2017 +0200 Committer: mxmrlv Committed: Thu Jan 5 11:35:22 2017 +0200 -- aria/storage/structure.py | 28 -- aria/storage/type.py | 54 -- 2 files changed, 26 insertions(+), 56 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/2c7d326c/aria/storage/structure.py -- diff --git a/aria/storage/structure.py b/aria/storage/structure.py index d222c94..431633b 100644 --- a/aria/storage/structure.py +++ b/aria/storage/structure.py @@ -124,25 +124,29 @@ class ModelMixin(object): remote_side=remote_side_str, post_update=True) -def to_dict(self, suppress_error=False): +def to_dict(self, fields=None, suppress_error=False): """Return a dict representation of the model :param suppress_error: If set to True, sets `None` to attributes that it's unable to retrieve (e.g., if a relationship wasn't established yet, and so it's impossible to access a property through it) """ -if suppress_error: -res = dict() -for field in self.fields(): -try: -field_value = getattr(self, field) -except AttributeError: +res = dict() +fields = fields or self.fields() +for field in fields: +try: +field_value = getattr(self, field) +except AttributeError: +if suppress_error: field_value = None -res[field] = field_value -else: -# Can't simply call here `self.to_response()` because inheriting -# class might override it, but we always need the same code here -res = dict((f, getattr(self, f)) for f in self.fields()) +else: +raise +if isinstance(field_value, list): +field_value = list(field_value) +elif isinstance(field_value, dict): +field_value = dict(field_value) +res[field] = field_value + return res @classmethod http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/2c7d326c/aria/storage/type.py -- diff --git a/aria/storage/type.py b/aria/storage/type.py index 84fd8dc..ab50b0f 100644 --- a/aria/storage/type.py +++ b/aria/storage/type.py @@ -60,63 +60,29 @@ class List(_MutableType): return list -class _MutableDict(mutable.Mutable, dict): +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))) -if not isinstance(value, cls): -if isinstance(value, dict): -return cls(value) -# this call will raise ValueError -try: -return mutable.Mutable.coerce(key, value) -except ValueError as e: -raise exceptions.StorageError('SQL Storage error: {0}'.format(str(e))) -else: -return value - -def __setitem__(self, key, value): -"Detect dictionary set events and emit change events." - -dict.__setitem__(self, key, value) -self.changed() - -def __delitem__(self, key): -"Detect dictionary del events and emit change events." - -dict.__delitem__(self, key) -self.changed() - - -class _MutableList(mutable.Mutable, list): +class _MutableList(mutable.MutableList): @classmethod def coerce(cls, key, value): "Convert plain dictionaries to MutableDict." +try: +
incubator-ariatosca git commit: ARIA-57-Custom executions state transition support
Repository: incubator-ariatosca Updated Branches: refs/heads/ARIA-57-Custom-executions-state-transition-support [created] 69e868770 ARIA-57-Custom executions state transition support As part of this commit, a new valid transition was added between cancelling and force cancelling Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/69e86877 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/69e86877 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/69e86877 Branch: refs/heads/ARIA-57-Custom-executions-state-transition-support Commit: 69e8687705767ec1962f27916df8417eb59eef0e Parents: 860d69b Author: mxmrlvAuthored: Thu Jan 5 11:32:08 2017 +0200 Committer: mxmrlv Committed: Thu Jan 5 11:32:08 2017 +0200 -- aria/storage/base_model.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/69e86877/aria/storage/base_model.py -- diff --git a/aria/storage/base_model.py b/aria/storage/base_model.py index c7eb27c..d1aebf2 100644 --- a/aria/storage/base_model.py +++ b/aria/storage/base_model.py @@ -146,7 +146,7 @@ class ExecutionBase(ModelMixin): VALID_TRANSITIONS = { PENDING: [STARTED, CANCELLED], STARTED: END_STATES + [CANCELLING], -CANCELLING: END_STATES +CANCELLING: END_STATES + [FORCE_CANCELLING] } @orm.validates('status') @@ -156,7 +156,7 @@ class ExecutionBase(ModelMixin): current_status = getattr(self, key) except AttributeError: return -valid_transitions = ExecutionBase.VALID_TRANSITIONS.get(current_status, []) +valid_transitions = self.VALID_TRANSITIONS.get(current_status, []) if all([current_status is not None, current_status != value, value not in valid_transitions]):
[jira] [Commented] (ARIA-58) Storage model to_dict creates symbolic links
[ https://issues.apache.org/jira/browse/ARIA-58?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15800895#comment-15800895 ] ASF GitHub Bot commented on ARIA-58: GitHub user mxmrlv opened a pull request: https://github.com/apache/incubator-ariatosca/pull/39 ARIA-58-Storage-model-to_dict-creates-symbolic-links As part of this commits, ARIA will use the builtin MutableDict and List You can merge this pull request into a Git repository by running: $ git pull https://github.com/apache/incubator-ariatosca ARIA-58-Storage-model-to_dict-creates-symbolic-links Alternatively you can review and apply these changes as the patch at: https://github.com/apache/incubator-ariatosca/pull/39.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #39 commit f35bf15de03940b08023666c210c69d87b2739d8 Author: mxmrlvDate: 2017-01-05T09:30:30Z ARIA-58-Storage-model-to_dict-creates-symbolic-links As part of this commits, ARIA will use the builtin MutableDict and List > Storage model to_dict creates symbolic links > > > Key: ARIA-58 > URL: https://issues.apache.org/jira/browse/ARIA-58 > Project: AriaTosca > Issue Type: Bug >Affects Versions: 0.1.0 >Reporter: Maxim Orlov >Assignee: Maxim Orlov > > When calling the to_dict method on any model, any data structure type field > (such as list or dict) gets returned as a symbolic link, thus altering that > dict/list changes the actual storage. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[GitHub] incubator-ariatosca pull request #38: ARIA-57-Custom executions state transi...
GitHub user mxmrlv opened a pull request: https://github.com/apache/incubator-ariatosca/pull/38 ARIA-57-Custom executions state transition support As part of this commit, a new valid transition was added between cancelling and force cancelling You can merge this pull request into a Git repository by running: $ git pull https://github.com/apache/incubator-ariatosca ARIA-57-Custom-executions-state-transition-support Alternatively you can review and apply these changes as the patch at: https://github.com/apache/incubator-ariatosca/pull/38.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #38 commit 69e8687705767ec1962f27916df8417eb59eef0e Author: mxmrlvDate: 2017-01-05T09:32:08Z ARIA-57-Custom executions state transition support As part of this commit, a new valid transition was added between cancelling and force cancelling --- 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. ---
[jira] [Commented] (ARIA-57) Custom executions state transition support
[ https://issues.apache.org/jira/browse/ARIA-57?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15800893#comment-15800893 ] ASF GitHub Bot commented on ARIA-57: GitHub user mxmrlv opened a pull request: https://github.com/apache/incubator-ariatosca/pull/38 ARIA-57-Custom executions state transition support As part of this commit, a new valid transition was added between cancelling and force cancelling You can merge this pull request into a Git repository by running: $ git pull https://github.com/apache/incubator-ariatosca ARIA-57-Custom-executions-state-transition-support Alternatively you can review and apply these changes as the patch at: https://github.com/apache/incubator-ariatosca/pull/38.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #38 commit 69e8687705767ec1962f27916df8417eb59eef0e Author: mxmrlvDate: 2017-01-05T09:32:08Z ARIA-57-Custom executions state transition support As part of this commit, a new valid transition was added between cancelling and force cancelling > Custom executions state transition support > -- > > Key: ARIA-57 > URL: https://issues.apache.org/jira/browse/ARIA-57 > Project: AriaTosca > Issue Type: Story >Affects Versions: 0.1.0 >Reporter: Maxim Orlov >Assignee: Maxim Orlov >Priority: Minor > > Executions should support custom valid state transitions -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (ARIA-58) Storage model to_dict creates symbolic links
[ https://issues.apache.org/jira/browse/ARIA-58?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15800888#comment-15800888 ] ASF subversion and git services commented on ARIA-58: - Commit f35bf15de03940b08023666c210c69d87b2739d8 in incubator-ariatosca's branch refs/heads/ARIA-58-Storage-model-to_dict-creates-symbolic-links from mxmrlv [ https://git-wip-us.apache.org/repos/asf?p=incubator-ariatosca.git;h=f35bf15 ] ARIA-58-Storage-model-to_dict-creates-symbolic-links As part of this commits, ARIA will use the builtin MutableDict and List > Storage model to_dict creates symbolic links > > > Key: ARIA-58 > URL: https://issues.apache.org/jira/browse/ARIA-58 > Project: AriaTosca > Issue Type: Bug >Affects Versions: 0.1.0 >Reporter: Maxim Orlov >Assignee: Maxim Orlov > > When calling the to_dict method on any model, any data structure type field > (such as list or dict) gets returned as a symbolic link, thus altering that > dict/list changes the actual storage. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
incubator-ariatosca git commit: ARIA-58-Storage-model-to_dict-creates-symbolic-links
Repository: incubator-ariatosca Updated Branches: refs/heads/ARIA-58-Storage-model-to_dict-creates-symbolic-links [created] f35bf15de ARIA-58-Storage-model-to_dict-creates-symbolic-links As part of this commits, ARIA will use the builtin MutableDict and List Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/f35bf15d Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/f35bf15d Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/f35bf15d Branch: refs/heads/ARIA-58-Storage-model-to_dict-creates-symbolic-links Commit: f35bf15de03940b08023666c210c69d87b2739d8 Parents: 860d69b Author: mxmrlvAuthored: Thu Jan 5 11:30:30 2017 +0200 Committer: mxmrlv Committed: Thu Jan 5 11:30:30 2017 +0200 -- aria/storage/structure.py | 30 +-- aria/storage/type.py | 54 -- 2 files changed, 28 insertions(+), 56 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/f35bf15d/aria/storage/structure.py -- diff --git a/aria/storage/structure.py b/aria/storage/structure.py index d222c94..9bf1286 100644 --- a/aria/storage/structure.py +++ b/aria/storage/structure.py @@ -124,25 +124,31 @@ class ModelMixin(object): remote_side=remote_side_str, post_update=True) -def to_dict(self, suppress_error=False): +def to_dict(self, fields=None, suppress_error=False): """Return a dict representation of the model :param suppress_error: If set to True, sets `None` to attributes that it's unable to retrieve (e.g., if a relationship wasn't established yet, and so it's impossible to access a property through it) """ -if suppress_error: -res = dict() -for field in self.fields(): -try: -field_value = getattr(self, field) -except AttributeError: +res = dict() +fields = fields or self.fields() +for field in fields: +try: +field_value = getattr(self, field) +except AttributeError: +# Can't simply call here `self.to_response()` because inheriting +# class might override it, but we always need the same code here +if suppress_error: field_value = None -res[field] = field_value -else: -# Can't simply call here `self.to_response()` because inheriting -# class might override it, but we always need the same code here -res = dict((f, getattr(self, f)) for f in self.fields()) +else: +raise +if isinstance(field_value, list): +field_value = list(field_value) +elif isinstance(field_value, dict): +field_value = dict(field_value) +res[field] = field_value + return res @classmethod http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/f35bf15d/aria/storage/type.py -- diff --git a/aria/storage/type.py b/aria/storage/type.py index 84fd8dc..ab50b0f 100644 --- a/aria/storage/type.py +++ b/aria/storage/type.py @@ -60,63 +60,29 @@ class List(_MutableType): return list -class _MutableDict(mutable.Mutable, dict): +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))) -if not isinstance(value, cls): -if isinstance(value, dict): -return cls(value) -# this call will raise ValueError -try: -return mutable.Mutable.coerce(key, value) -except ValueError as e: -raise exceptions.StorageError('SQL Storage error: {0}'.format(str(e))) -else: -return value - -def __setitem__(self, key, value): -"Detect dictionary set events and emit change events." - -dict.__setitem__(self, key, value) -self.changed() - -def __delitem__(self, key): -"Detect dictionary del events and emit change events." - -dict.__delitem__(self, key) -self.changed() - - -class _MutableList(mutable.Mutable, list): +class
[jira] [Created] (ARIA-58) Storage model to_dict creates symbolic links
Maxim Orlov created ARIA-58: --- Summary: Storage model to_dict creates symbolic links Key: ARIA-58 URL: https://issues.apache.org/jira/browse/ARIA-58 Project: AriaTosca Issue Type: Bug Affects Versions: 0.1.0 Reporter: Maxim Orlov Assignee: Maxim Orlov When calling the to_dict method on any model, any data structure type field (such as list or dict) gets returned as a symbolic link, thus altering that dict/list changes the actual storage. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Created] (ARIA-57) Custom executions state transition support
Maxim Orlov created ARIA-57: --- Summary: Custom executions state transition support Key: ARIA-57 URL: https://issues.apache.org/jira/browse/ARIA-57 Project: AriaTosca Issue Type: Story Affects Versions: 0.1.0 Reporter: Maxim Orlov Assignee: Maxim Orlov Priority: Minor Executions should support custom valid state transitions -- This message was sent by Atlassian JIRA (v6.3.4#6332)