[GitHub] incubator-ariatosca pull request #64: ARIA-79-concurrent-modifications

2017-02-02 Thread dankilman
Github user dankilman commented on a diff in the pull request:

https://github.com/apache/incubator-ariatosca/pull/64#discussion_r99083124
  
--- Diff: aria/storage/base_model.py ---
@@ -479,6 +479,7 @@ class NodeInstanceBase(ModelMixin):
 __tablename__ = 'node_instances'
 _private_fields = ['node_fk', 'host_fk']
 
+version_id = Column(Integer, nullable=False)
--- End diff --

think where version_id might also be applied


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


incubator-ariatosca git commit: ARIA-79-concurrent-modifications [Forced Update!]

2017-02-01 Thread dankilman
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-79-concurrent-storage-modifications 7fa79b3ae -> 1b03bf211 
(forced update)


ARIA-79-concurrent-modifications


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

Branch: refs/heads/ARIA-79-concurrent-storage-modifications
Commit: 1b03bf2115778ae9e03dc4bcb7eb6515d6e1804f
Parents: 9b01654
Author: Dan Kilman 
Authored: Mon Jan 30 16:49:00 2017 +0200
Committer: Dan Kilman 
Committed: Wed Feb 1 19:34:14 2017 +0200

--
 aria/orchestrator/workflows/executor/process.py | 156 ++---
 aria/storage/base_model.py  |   3 +
 aria/storage/instrumentation.py |  30 +++-
 aria/storage/sql_mapi.py|   4 +
 ...process_executor_concurrent_modifications.py | 174 +++
 tests/requirements.txt  |   3 +-
 6 files changed, 310 insertions(+), 60 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/1b03bf21/aria/orchestrator/workflows/executor/process.py
--
diff --git a/aria/orchestrator/workflows/executor/process.py 
b/aria/orchestrator/workflows/executor/process.py
index 7d990fa..319982e 100644
--- a/aria/orchestrator/workflows/executor/process.py
+++ b/aria/orchestrator/workflows/executor/process.py
@@ -74,6 +74,13 @@ class ProcessExecutor(base.BaseExecutor):
 # Contains reference to all currently running tasks
 self._tasks = {}
 
+self._request_handlers = {
+'started': self._handle_task_started_request,
+'succeeded': self._handle_task_succeeded_request,
+'failed': self._handle_task_failed_request,
+'apply_tracked_changes': self._handle_apply_tracked_changes_request
+}
+
 # Server socket used to accept task status messages from subprocesses
 self._server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
 self._server_socket.bind(('localhost', 0))
@@ -131,58 +138,6 @@ class ProcessExecutor(base.BaseExecutor):
 def _remove_task(self, task_id):
 return self._tasks.pop(task_id)
 
-def _listener(self):
-# Notify __init__ method this thread has actually started
-self._listener_started.put(True)
-while not self._stopped:
-try:
-# Accept messages written to the server socket
-with contextlib.closing(self._server_socket.accept()[0]) as 
connection:
-message = self._recv_message(connection)
-message_type = message['type']
-if message_type == 'closed':
-break
-task_id = message['task_id']
-if message_type == 'started':
-self._task_started(self._tasks[task_id])
-elif message_type == 'apply_tracked_changes':
-task = self._tasks[task_id]
-instrumentation.apply_tracked_changes(
-tracked_changes=message['tracked_changes'],
-model=task.context.model)
-elif message_type == 'succeeded':
-task = self._remove_task(task_id)
-instrumentation.apply_tracked_changes(
-tracked_changes=message['tracked_changes'],
-model=task.context.model)
-self._task_succeeded(task)
-elif message_type == 'failed':
-task = self._remove_task(task_id)
-instrumentation.apply_tracked_changes(
-tracked_changes=message['tracked_changes'],
-model=task.context.model)
-self._task_failed(task, exception=message['exception'])
-else:
-raise RuntimeError('Invalid state')
-except BaseException as e:
-self.logger.debug('Error in process executor listener: 
{0}'.format(e))
-
-def _recv_message(self, connection):
-message_len, = struct.unpack(_INT_FMT, self._recv_bytes(connection, 
_INT_SIZE))
-return jsonpickle.loads(self._recv_bytes(connection, message_len))
-
-@staticmethod
-def _recv_bytes(connection, count):
-result = io.BytesIO()
-while True:
-if not count:
-return result.getvalue()
-  

[1/2] incubator-ariatosca git commit: ARIA-81-Install-execution-plugin-ctx-entry-point-by-default [Forced Update!]

2017-02-01 Thread dankilman
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-79-concurrent-storage-modifications 5b138a223 -> d4152a5ed 
(forced update)


ARIA-81-Install-execution-plugin-ctx-entry-point-by-default


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

Branch: refs/heads/ARIA-79-concurrent-storage-modifications
Commit: 9b016543f0dad2a2ca07e4d43e1194387c29f58d
Parents: 9e62fca
Author: mxmrlv 
Authored: Mon Jan 30 18:24:15 2017 +0200
Committer: mxmrlv 
Committed: Tue Jan 31 16:12:46 2017 +0200

--
 setup.py | 23 ---
 1 file changed, 20 insertions(+), 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/9b016543/setup.py
--
diff --git a/setup.py b/setup.py
index 5a3d016..36f84c9 100644
--- a/setup.py
+++ b/setup.py
@@ -17,7 +17,8 @@
 import os
 import sys
 
-from setuptools import setup, find_packages
+from setuptools import setup, find_packages, Command
+from setuptools.command.install import install
 
 _PACKAGE_NAME = 'aria'
 _PYTHON_SUPPORTED_VERSIONS = [(2, 6), (2, 7)]
@@ -45,10 +46,23 @@ except IOError:
 
 
 console_scripts = ['aria = aria.cli.cli:main']
-if os.environ.get('INSTALL_CTX'):
-console_scripts.append('ctx = 
aria.orchestrator.execution_plugin.ctx_proxy.client:main')
 
 
+class InstallCommand(install):
+user_options = install.user_options + [
+('skip-ctx', None, 'Install with or without the ctx (Defaults to True')
+]
+boolean_options = install.boolean_options + ['skip-ctx']
+
+def initialize_options(self):
+install.initialize_options(self)
+self.skip_ctx = False
+
+def run(self):
+if self.skip_ctx is False:
+console_scripts.append('ctx = 
aria.orchestrator.execution_plugin.ctx_proxy.client:main')
+install.run(self)
+
 setup(
 name=_PACKAGE_NAME,
 version=version,
@@ -83,5 +97,8 @@ setup(
 install_requires=install_requires,
 entry_points={
 'console_scripts': console_scripts
+},
+cmdclass={
+'install': InstallCommand
 }
 )



incubator-ariatosca git commit: ARIA-79-concurrent-modifications [Forced Update!]

2017-02-01 Thread dankilman
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-79-concurrent-storage-modifications d4152a5ed -> 7fa79b3ae 
(forced update)


ARIA-79-concurrent-modifications


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

Branch: refs/heads/ARIA-79-concurrent-storage-modifications
Commit: 7fa79b3aed4a11e607bdefba5df99ed1dcc13721
Parents: 9b01654
Author: Dan Kilman 
Authored: Mon Jan 30 16:49:00 2017 +0200
Committer: Dan Kilman 
Committed: Wed Feb 1 18:30:41 2017 +0200

--
 aria/orchestrator/workflows/executor/process.py | 156 ++---
 aria/storage/base_model.py  |   3 +
 aria/storage/instrumentation.py |  30 +++-
 aria/storage/sql_mapi.py|   4 +
 ...process_executor_concurrent_modifications.py | 174 +++
 tests/requirements.txt  |   3 +-
 tests/storage/__init__.py   |   2 +-
 7 files changed, 311 insertions(+), 61 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/7fa79b3a/aria/orchestrator/workflows/executor/process.py
--
diff --git a/aria/orchestrator/workflows/executor/process.py 
b/aria/orchestrator/workflows/executor/process.py
index 7d990fa..319982e 100644
--- a/aria/orchestrator/workflows/executor/process.py
+++ b/aria/orchestrator/workflows/executor/process.py
@@ -74,6 +74,13 @@ class ProcessExecutor(base.BaseExecutor):
 # Contains reference to all currently running tasks
 self._tasks = {}
 
+self._request_handlers = {
+'started': self._handle_task_started_request,
+'succeeded': self._handle_task_succeeded_request,
+'failed': self._handle_task_failed_request,
+'apply_tracked_changes': self._handle_apply_tracked_changes_request
+}
+
 # Server socket used to accept task status messages from subprocesses
 self._server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
 self._server_socket.bind(('localhost', 0))
@@ -131,58 +138,6 @@ class ProcessExecutor(base.BaseExecutor):
 def _remove_task(self, task_id):
 return self._tasks.pop(task_id)
 
-def _listener(self):
-# Notify __init__ method this thread has actually started
-self._listener_started.put(True)
-while not self._stopped:
-try:
-# Accept messages written to the server socket
-with contextlib.closing(self._server_socket.accept()[0]) as 
connection:
-message = self._recv_message(connection)
-message_type = message['type']
-if message_type == 'closed':
-break
-task_id = message['task_id']
-if message_type == 'started':
-self._task_started(self._tasks[task_id])
-elif message_type == 'apply_tracked_changes':
-task = self._tasks[task_id]
-instrumentation.apply_tracked_changes(
-tracked_changes=message['tracked_changes'],
-model=task.context.model)
-elif message_type == 'succeeded':
-task = self._remove_task(task_id)
-instrumentation.apply_tracked_changes(
-tracked_changes=message['tracked_changes'],
-model=task.context.model)
-self._task_succeeded(task)
-elif message_type == 'failed':
-task = self._remove_task(task_id)
-instrumentation.apply_tracked_changes(
-tracked_changes=message['tracked_changes'],
-model=task.context.model)
-self._task_failed(task, exception=message['exception'])
-else:
-raise RuntimeError('Invalid state')
-except BaseException as e:
-self.logger.debug('Error in process executor listener: 
{0}'.format(e))
-
-def _recv_message(self, connection):
-message_len, = struct.unpack(_INT_FMT, self._recv_bytes(connection, 
_INT_SIZE))
-return jsonpickle.loads(self._recv_bytes(connection, message_len))
-
-@staticmethod
-def _recv_bytes(connection, count):
-result = io.BytesIO()
-while True:
-if 

[GitHub] incubator-ariatosca pull request #64: ARIA-79-concurrent-modifications

2017-02-01 Thread dankilman
GitHub user dankilman opened a pull request:

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

ARIA-79-concurrent-modifications



You can merge this pull request into a Git repository by running:

$ git pull https://github.com/apache/incubator-ariatosca 
ARIA-79-concurrent-storage-modifications

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/incubator-ariatosca/pull/64.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 #64


commit 5b138a223c26e920a0285a912e9ebaba69ab8649
Author: Dan Kilman <d...@gigaspaces.com>
Date:   2017-01-30T14:49:00Z

ARIA-79-concurrent-modifications




---
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.
---


[2/2] incubator-ariatosca git commit: ARIA-79-concurrent-modifications

2017-02-01 Thread dankilman
ARIA-79-concurrent-modifications


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

Branch: refs/heads/ARIA-79-concurrent-storage-modifications
Commit: d4152a5edd5237ab65d77215f297210a169d0c28
Parents: 9b01654
Author: Dan Kilman 
Authored: Mon Jan 30 16:49:00 2017 +0200
Committer: Dan Kilman 
Committed: Wed Feb 1 18:28:07 2017 +0200

--
 aria/orchestrator/workflows/executor/process.py | 156 ++---
 aria/storage/base_model.py  |   3 +
 aria/storage/instrumentation.py |  30 +++-
 aria/storage/sql_mapi.py|   4 +
 ...process_executor_concurrent_modifications.py | 174 +++
 tests/requirements.txt  |   3 +-
 tests/storage/__init__.py   |   5 +-
 7 files changed, 314 insertions(+), 61 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/d4152a5e/aria/orchestrator/workflows/executor/process.py
--
diff --git a/aria/orchestrator/workflows/executor/process.py 
b/aria/orchestrator/workflows/executor/process.py
index 7d990fa..319982e 100644
--- a/aria/orchestrator/workflows/executor/process.py
+++ b/aria/orchestrator/workflows/executor/process.py
@@ -74,6 +74,13 @@ class ProcessExecutor(base.BaseExecutor):
 # Contains reference to all currently running tasks
 self._tasks = {}
 
+self._request_handlers = {
+'started': self._handle_task_started_request,
+'succeeded': self._handle_task_succeeded_request,
+'failed': self._handle_task_failed_request,
+'apply_tracked_changes': self._handle_apply_tracked_changes_request
+}
+
 # Server socket used to accept task status messages from subprocesses
 self._server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
 self._server_socket.bind(('localhost', 0))
@@ -131,58 +138,6 @@ class ProcessExecutor(base.BaseExecutor):
 def _remove_task(self, task_id):
 return self._tasks.pop(task_id)
 
-def _listener(self):
-# Notify __init__ method this thread has actually started
-self._listener_started.put(True)
-while not self._stopped:
-try:
-# Accept messages written to the server socket
-with contextlib.closing(self._server_socket.accept()[0]) as 
connection:
-message = self._recv_message(connection)
-message_type = message['type']
-if message_type == 'closed':
-break
-task_id = message['task_id']
-if message_type == 'started':
-self._task_started(self._tasks[task_id])
-elif message_type == 'apply_tracked_changes':
-task = self._tasks[task_id]
-instrumentation.apply_tracked_changes(
-tracked_changes=message['tracked_changes'],
-model=task.context.model)
-elif message_type == 'succeeded':
-task = self._remove_task(task_id)
-instrumentation.apply_tracked_changes(
-tracked_changes=message['tracked_changes'],
-model=task.context.model)
-self._task_succeeded(task)
-elif message_type == 'failed':
-task = self._remove_task(task_id)
-instrumentation.apply_tracked_changes(
-tracked_changes=message['tracked_changes'],
-model=task.context.model)
-self._task_failed(task, exception=message['exception'])
-else:
-raise RuntimeError('Invalid state')
-except BaseException as e:
-self.logger.debug('Error in process executor listener: 
{0}'.format(e))
-
-def _recv_message(self, connection):
-message_len, = struct.unpack(_INT_FMT, self._recv_bytes(connection, 
_INT_SIZE))
-return jsonpickle.loads(self._recv_bytes(connection, message_len))
-
-@staticmethod
-def _recv_bytes(connection, count):
-result = io.BytesIO()
-while True:
-if not count:
-return result.getvalue()
-read = connection.recv(count)
-if not read:
-return 

incubator-ariatosca git commit: ARIA-79-concurrent-modifications [Forced Update!]

2017-02-01 Thread dankilman
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-79-concurrent-storage-modifications b126bd4f9 -> 5b138a223 
(forced update)


ARIA-79-concurrent-modifications


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

Branch: refs/heads/ARIA-79-concurrent-storage-modifications
Commit: 5b138a223c26e920a0285a912e9ebaba69ab8649
Parents: 9e62fca
Author: Dan Kilman 
Authored: Mon Jan 30 16:49:00 2017 +0200
Committer: Dan Kilman 
Committed: Wed Feb 1 17:35:19 2017 +0200

--
 aria/orchestrator/workflows/executor/process.py | 156 ++---
 aria/storage/base_model.py  |   3 +
 aria/storage/instrumentation.py |  30 +++-
 aria/storage/sql_mapi.py|   4 +
 ...process_executor_concurrent_modifications.py | 174 +++
 tests/requirements.txt  |   3 +-
 tests/storage/__init__.py   |   5 +-
 7 files changed, 314 insertions(+), 61 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/5b138a22/aria/orchestrator/workflows/executor/process.py
--
diff --git a/aria/orchestrator/workflows/executor/process.py 
b/aria/orchestrator/workflows/executor/process.py
index 7d990fa..319982e 100644
--- a/aria/orchestrator/workflows/executor/process.py
+++ b/aria/orchestrator/workflows/executor/process.py
@@ -74,6 +74,13 @@ class ProcessExecutor(base.BaseExecutor):
 # Contains reference to all currently running tasks
 self._tasks = {}
 
+self._request_handlers = {
+'started': self._handle_task_started_request,
+'succeeded': self._handle_task_succeeded_request,
+'failed': self._handle_task_failed_request,
+'apply_tracked_changes': self._handle_apply_tracked_changes_request
+}
+
 # Server socket used to accept task status messages from subprocesses
 self._server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
 self._server_socket.bind(('localhost', 0))
@@ -131,58 +138,6 @@ class ProcessExecutor(base.BaseExecutor):
 def _remove_task(self, task_id):
 return self._tasks.pop(task_id)
 
-def _listener(self):
-# Notify __init__ method this thread has actually started
-self._listener_started.put(True)
-while not self._stopped:
-try:
-# Accept messages written to the server socket
-with contextlib.closing(self._server_socket.accept()[0]) as 
connection:
-message = self._recv_message(connection)
-message_type = message['type']
-if message_type == 'closed':
-break
-task_id = message['task_id']
-if message_type == 'started':
-self._task_started(self._tasks[task_id])
-elif message_type == 'apply_tracked_changes':
-task = self._tasks[task_id]
-instrumentation.apply_tracked_changes(
-tracked_changes=message['tracked_changes'],
-model=task.context.model)
-elif message_type == 'succeeded':
-task = self._remove_task(task_id)
-instrumentation.apply_tracked_changes(
-tracked_changes=message['tracked_changes'],
-model=task.context.model)
-self._task_succeeded(task)
-elif message_type == 'failed':
-task = self._remove_task(task_id)
-instrumentation.apply_tracked_changes(
-tracked_changes=message['tracked_changes'],
-model=task.context.model)
-self._task_failed(task, exception=message['exception'])
-else:
-raise RuntimeError('Invalid state')
-except BaseException as e:
-self.logger.debug('Error in process executor listener: 
{0}'.format(e))
-
-def _recv_message(self, connection):
-message_len, = struct.unpack(_INT_FMT, self._recv_bytes(connection, 
_INT_SIZE))
-return jsonpickle.loads(self._recv_bytes(connection, message_len))
-
-@staticmethod
-def _recv_bytes(connection, count):
-result = io.BytesIO()
-while True:
-if 

incubator-ariatosca git commit: ARIA-79-concurrent-modifications [Forced Update!]

2017-02-01 Thread dankilman
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-79-concurrent-storage-modifications ba5247a39 -> b126bd4f9 
(forced update)


ARIA-79-concurrent-modifications


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

Branch: refs/heads/ARIA-79-concurrent-storage-modifications
Commit: b126bd4f9be7d2872709308d0029e8f56141b96a
Parents: 9e62fca
Author: Dan Kilman 
Authored: Mon Jan 30 16:49:00 2017 +0200
Committer: Dan Kilman 
Committed: Wed Feb 1 17:12:11 2017 +0200

--
 aria/orchestrator/workflows/executor/process.py | 156 +--
 aria/storage/base_model.py  |   3 +
 aria/storage/instrumentation.py |  30 ++-
 aria/storage/sql_mapi.py|   4 +
 ...process_executor_concurrent_modifications.py | 193 +++
 tests/requirements.txt  |   3 +-
 tests/storage/__init__.py   |   5 +-
 7 files changed, 333 insertions(+), 61 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/b126bd4f/aria/orchestrator/workflows/executor/process.py
--
diff --git a/aria/orchestrator/workflows/executor/process.py 
b/aria/orchestrator/workflows/executor/process.py
index 7d990fa..319982e 100644
--- a/aria/orchestrator/workflows/executor/process.py
+++ b/aria/orchestrator/workflows/executor/process.py
@@ -74,6 +74,13 @@ class ProcessExecutor(base.BaseExecutor):
 # Contains reference to all currently running tasks
 self._tasks = {}
 
+self._request_handlers = {
+'started': self._handle_task_started_request,
+'succeeded': self._handle_task_succeeded_request,
+'failed': self._handle_task_failed_request,
+'apply_tracked_changes': self._handle_apply_tracked_changes_request
+}
+
 # Server socket used to accept task status messages from subprocesses
 self._server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
 self._server_socket.bind(('localhost', 0))
@@ -131,58 +138,6 @@ class ProcessExecutor(base.BaseExecutor):
 def _remove_task(self, task_id):
 return self._tasks.pop(task_id)
 
-def _listener(self):
-# Notify __init__ method this thread has actually started
-self._listener_started.put(True)
-while not self._stopped:
-try:
-# Accept messages written to the server socket
-with contextlib.closing(self._server_socket.accept()[0]) as 
connection:
-message = self._recv_message(connection)
-message_type = message['type']
-if message_type == 'closed':
-break
-task_id = message['task_id']
-if message_type == 'started':
-self._task_started(self._tasks[task_id])
-elif message_type == 'apply_tracked_changes':
-task = self._tasks[task_id]
-instrumentation.apply_tracked_changes(
-tracked_changes=message['tracked_changes'],
-model=task.context.model)
-elif message_type == 'succeeded':
-task = self._remove_task(task_id)
-instrumentation.apply_tracked_changes(
-tracked_changes=message['tracked_changes'],
-model=task.context.model)
-self._task_succeeded(task)
-elif message_type == 'failed':
-task = self._remove_task(task_id)
-instrumentation.apply_tracked_changes(
-tracked_changes=message['tracked_changes'],
-model=task.context.model)
-self._task_failed(task, exception=message['exception'])
-else:
-raise RuntimeError('Invalid state')
-except BaseException as e:
-self.logger.debug('Error in process executor listener: 
{0}'.format(e))
-
-def _recv_message(self, connection):
-message_len, = struct.unpack(_INT_FMT, self._recv_bytes(connection, 
_INT_SIZE))
-return jsonpickle.loads(self._recv_bytes(connection, message_len))
-
-@staticmethod
-def _recv_bytes(connection, count):
-result = io.BytesIO()
-while True:
-if not 

incubator-ariatosca git commit: ARIA-79-concurrent-modifications [Forced Update!]

2017-02-01 Thread dankilman
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-79-concurrent-storage-modifications 67a42409b -> ba5247a39 
(forced update)


ARIA-79-concurrent-modifications


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

Branch: refs/heads/ARIA-79-concurrent-storage-modifications
Commit: ba5247a398a11fa0556ad9138a9179d0b8b9c713
Parents: 9e62fca
Author: Dan Kilman 
Authored: Mon Jan 30 16:49:00 2017 +0200
Committer: Dan Kilman 
Committed: Wed Feb 1 16:00:15 2017 +0200

--
 aria/orchestrator/workflows/executor/process.py | 156 +--
 aria/storage/base_model.py  |   3 +
 aria/storage/instrumentation.py |  30 ++-
 aria/storage/sql_mapi.py|   4 +
 ...process_executor_concurrent_modifications.py | 196 +++
 tests/requirements.txt  |   3 +-
 tests/storage/__init__.py   |   5 +-
 7 files changed, 336 insertions(+), 61 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/ba5247a3/aria/orchestrator/workflows/executor/process.py
--
diff --git a/aria/orchestrator/workflows/executor/process.py 
b/aria/orchestrator/workflows/executor/process.py
index 7d990fa..319982e 100644
--- a/aria/orchestrator/workflows/executor/process.py
+++ b/aria/orchestrator/workflows/executor/process.py
@@ -74,6 +74,13 @@ class ProcessExecutor(base.BaseExecutor):
 # Contains reference to all currently running tasks
 self._tasks = {}
 
+self._request_handlers = {
+'started': self._handle_task_started_request,
+'succeeded': self._handle_task_succeeded_request,
+'failed': self._handle_task_failed_request,
+'apply_tracked_changes': self._handle_apply_tracked_changes_request
+}
+
 # Server socket used to accept task status messages from subprocesses
 self._server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
 self._server_socket.bind(('localhost', 0))
@@ -131,58 +138,6 @@ class ProcessExecutor(base.BaseExecutor):
 def _remove_task(self, task_id):
 return self._tasks.pop(task_id)
 
-def _listener(self):
-# Notify __init__ method this thread has actually started
-self._listener_started.put(True)
-while not self._stopped:
-try:
-# Accept messages written to the server socket
-with contextlib.closing(self._server_socket.accept()[0]) as 
connection:
-message = self._recv_message(connection)
-message_type = message['type']
-if message_type == 'closed':
-break
-task_id = message['task_id']
-if message_type == 'started':
-self._task_started(self._tasks[task_id])
-elif message_type == 'apply_tracked_changes':
-task = self._tasks[task_id]
-instrumentation.apply_tracked_changes(
-tracked_changes=message['tracked_changes'],
-model=task.context.model)
-elif message_type == 'succeeded':
-task = self._remove_task(task_id)
-instrumentation.apply_tracked_changes(
-tracked_changes=message['tracked_changes'],
-model=task.context.model)
-self._task_succeeded(task)
-elif message_type == 'failed':
-task = self._remove_task(task_id)
-instrumentation.apply_tracked_changes(
-tracked_changes=message['tracked_changes'],
-model=task.context.model)
-self._task_failed(task, exception=message['exception'])
-else:
-raise RuntimeError('Invalid state')
-except BaseException as e:
-self.logger.debug('Error in process executor listener: 
{0}'.format(e))
-
-def _recv_message(self, connection):
-message_len, = struct.unpack(_INT_FMT, self._recv_bytes(connection, 
_INT_SIZE))
-return jsonpickle.loads(self._recv_bytes(connection, message_len))
-
-@staticmethod
-def _recv_bytes(connection, count):
-result = io.BytesIO()
-while True:
-if not 

incubator-ariatosca git commit: ARIA-79-concurrent-modifications

2017-01-31 Thread dankilman
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-79-concurrent-storage-modifications [created] 67a42409b


ARIA-79-concurrent-modifications


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

Branch: refs/heads/ARIA-79-concurrent-storage-modifications
Commit: 67a42409b94307479dbdb5fcc246cee2a3eb55e0
Parents: 9e62fca
Author: Dan Kilman 
Authored: Mon Jan 30 16:49:00 2017 +0200
Committer: Dan Kilman 
Committed: Tue Jan 31 16:22:59 2017 +0200

--
 aria/orchestrator/workflows/executor/process.py | 156 ---
 aria/storage/base_model.py  |   3 +
 aria/storage/instrumentation.py |  22 ++-
 aria/storage/sql_mapi.py|   4 +
 ...process_executor_concurrent_modifications.py |  83 ++
 tests/storage/__init__.py   |   5 +-
 6 files changed, 213 insertions(+), 60 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/67a42409/aria/orchestrator/workflows/executor/process.py
--
diff --git a/aria/orchestrator/workflows/executor/process.py 
b/aria/orchestrator/workflows/executor/process.py
index 7d990fa..319982e 100644
--- a/aria/orchestrator/workflows/executor/process.py
+++ b/aria/orchestrator/workflows/executor/process.py
@@ -74,6 +74,13 @@ class ProcessExecutor(base.BaseExecutor):
 # Contains reference to all currently running tasks
 self._tasks = {}
 
+self._request_handlers = {
+'started': self._handle_task_started_request,
+'succeeded': self._handle_task_succeeded_request,
+'failed': self._handle_task_failed_request,
+'apply_tracked_changes': self._handle_apply_tracked_changes_request
+}
+
 # Server socket used to accept task status messages from subprocesses
 self._server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
 self._server_socket.bind(('localhost', 0))
@@ -131,58 +138,6 @@ class ProcessExecutor(base.BaseExecutor):
 def _remove_task(self, task_id):
 return self._tasks.pop(task_id)
 
-def _listener(self):
-# Notify __init__ method this thread has actually started
-self._listener_started.put(True)
-while not self._stopped:
-try:
-# Accept messages written to the server socket
-with contextlib.closing(self._server_socket.accept()[0]) as 
connection:
-message = self._recv_message(connection)
-message_type = message['type']
-if message_type == 'closed':
-break
-task_id = message['task_id']
-if message_type == 'started':
-self._task_started(self._tasks[task_id])
-elif message_type == 'apply_tracked_changes':
-task = self._tasks[task_id]
-instrumentation.apply_tracked_changes(
-tracked_changes=message['tracked_changes'],
-model=task.context.model)
-elif message_type == 'succeeded':
-task = self._remove_task(task_id)
-instrumentation.apply_tracked_changes(
-tracked_changes=message['tracked_changes'],
-model=task.context.model)
-self._task_succeeded(task)
-elif message_type == 'failed':
-task = self._remove_task(task_id)
-instrumentation.apply_tracked_changes(
-tracked_changes=message['tracked_changes'],
-model=task.context.model)
-self._task_failed(task, exception=message['exception'])
-else:
-raise RuntimeError('Invalid state')
-except BaseException as e:
-self.logger.debug('Error in process executor listener: 
{0}'.format(e))
-
-def _recv_message(self, connection):
-message_len, = struct.unpack(_INT_FMT, self._recv_bytes(connection, 
_INT_SIZE))
-return jsonpickle.loads(self._recv_bytes(connection, message_len))
-
-@staticmethod
-def _recv_bytes(connection, count):
-result = io.BytesIO()
-while True:
-if not count:
-return result.getvalue()
-read = 

[GitHub] incubator-ariatosca pull request #62: ARIA-66-Convert-custom-parser-fields-i...

2017-01-31 Thread dankilman
Github user dankilman commented on a diff in the pull request:

https://github.com/apache/incubator-ariatosca/pull/62#discussion_r98648305
  
--- Diff: aria/storage/type.py ---
@@ -175,72 +172,105 @@ class _MutableList(mutable.MutableList):
 @classmethod
 def coerce(cls, key, value):
 "Convert plain dictionaries to MutableDict."
-
 try:
-if not isinstance(value, cls):
-if isinstance(value, list):
-return cls(value)
-
-return mutable.Mutable.coerce(key, value)
-else:
-return value
-
+return mutable.MutableList.coerce(key, value)
 except ValueError as e:
 raise exceptions.StorageError('SQL Storage error: 
{0}'.format(str(e)))
 
-StrictDictID = namedtuple('strict_dict_id', 'key_cls, value_cls')
+StrictDictID = namedtuple('StrictDictID', 'key_cls, value_cls')
+StrictValue = namedtuple('StrictValue', 'type_cls, listener_cls')
 
 
 class _StrictDict(object):
+"""
+This entire class functions as a factory for strict dicts and their 
listeners.
+No type class, and no listener type class is created (and associated) 
more than once. If a
+relevant type class exists it is returned.
+"""
 _strict_map = {}
 
-def __call__(self, key_cls=None, value_cls=None, *args, **kwargs):
+def __call__(self, key_cls=None, value_cls=None):
 strict_dict_map_key = StrictDictID(key_cls=key_cls, 
value_cls=value_cls)
 if strict_dict_map_key not in self._strict_map:
+# Creating the type class itself. this class would be returned 
(used by the sqlalchemy
+# Column).
 strict_dict_cls = type(
 'StrictDict_{0}_{1}'.format(key_cls.__name__, 
value_cls.__name__),
 (Dict, ),
 {}
 )
-type(
+# Creating the type listening class and associating it with 
the newly created type.
+# The new class inherits from both the _MutableList class and 
the _StrictListMixin,
+# while setting the necessary _key_cls and _value_cls as class 
attributes.
+listener_cls = type(
 'StrictMutableDict_{0}_{1}'.format(key_cls.__name__, 
value_cls.__name__),
 (_StrictDictMixin, _MutableDict),
 {'_key_cls': key_cls, '_value_cls': value_cls}
-).associate_with(strict_dict_cls)
-self._strict_map[strict_dict_map_key] = strict_dict_cls
+)
+listener_cls.associate_with(strict_dict_cls)
+self._strict_map[strict_dict_map_key] = 
StrictValue(type_cls=strict_dict_cls,
+
listener_cls=listener_cls)
 
-return self._strict_map[strict_dict_map_key]
+return self._strict_map[strict_dict_map_key].type_cls
 
 StrictDict = _StrictDict()
 
 
 class _StrictList(object):
+"""
+This entire class functions as a factory for strict dicts and their 
listeners.
+No type class, and no listener type class is created (and associated) 
more than once. If a
+relevant type class exists it is returned.
+"""
 _strict_map = {}
 
 def __call__(self, item_cls=None):
+
 if item_cls not in self._strict_map:
+# Creating the type class itself. this class would be returned 
(used by the sqlalchemy
+# Column).
 strict_list_cls = type(
 'StrictList_{0}'.format(item_cls.__name__),
 (List, ),
 {}
 )
-type(
+# Creating the type listening class and associating it with 
the newly created type.
+# The new class inherits from both the _MutableList class and 
the _StrictListMixin,
+# while setting the necessary _item_cls as class attribute.
+listener_cls = type(
 'StrictMutableList_{0}'.format(item_cls.__name__),
 (_StrictListMixin, _MutableList),
 {'_item_cls': item_cls}
-).associate_with(strict_list_cls)
-self._strict_map[item_cls] = strict_list_cls
+)
+self._strict_map[item_cls] = 
StrictValue(type_cls=strict_list_cls,
+ 
listener_cls=listener_cls)
 
-return self._strict_map[item_cls]
+return self._strict_map[item_cls].type_cls
 
 StrictList = _Stric

[GitHub] incubator-ariatosca pull request #62: ARIA-66-Convert-custom-parser-fields-i...

2017-01-31 Thread dankilman
Github user dankilman commented on a diff in the pull request:

https://github.com/apache/incubator-ariatosca/pull/62#discussion_r98640124
  
--- Diff: aria/storage/type.py ---
@@ -175,72 +172,105 @@ class _MutableList(mutable.MutableList):
 @classmethod
 def coerce(cls, key, value):
 "Convert plain dictionaries to MutableDict."
-
 try:
-if not isinstance(value, cls):
-if isinstance(value, list):
-return cls(value)
-
-return mutable.Mutable.coerce(key, value)
-else:
-return value
-
+return mutable.MutableList.coerce(key, value)
 except ValueError as e:
 raise exceptions.StorageError('SQL Storage error: 
{0}'.format(str(e)))
 
-StrictDictID = namedtuple('strict_dict_id', 'key_cls, value_cls')
+StrictDictID = namedtuple('StrictDictID', 'key_cls, value_cls')
+StrictValue = namedtuple('StrictValue', 'type_cls, listener_cls')
 
 
 class _StrictDict(object):
+"""
+This entire class functions as a factory for strict dicts and their 
listeners.
+No type class, and no listener type class is created (and associated) 
more than once. If a
+relevant type class exists it is returned.
+"""
 _strict_map = {}
 
-def __call__(self, key_cls=None, value_cls=None, *args, **kwargs):
+def __call__(self, key_cls=None, value_cls=None):
 strict_dict_map_key = StrictDictID(key_cls=key_cls, 
value_cls=value_cls)
 if strict_dict_map_key not in self._strict_map:
+# Creating the type class itself. this class would be returned 
(used by the sqlalchemy
+# Column).
 strict_dict_cls = type(
 'StrictDict_{0}_{1}'.format(key_cls.__name__, 
value_cls.__name__),
 (Dict, ),
 {}
 )
-type(
+# Creating the type listening class and associating it with 
the newly created type.
+# The new class inherits from both the _MutableList class and 
the _StrictListMixin,
+# while setting the necessary _key_cls and _value_cls as class 
attributes.
+listener_cls = type(
 'StrictMutableDict_{0}_{1}'.format(key_cls.__name__, 
value_cls.__name__),
 (_StrictDictMixin, _MutableDict),
 {'_key_cls': key_cls, '_value_cls': value_cls}
-).associate_with(strict_dict_cls)
-self._strict_map[strict_dict_map_key] = strict_dict_cls
+)
+listener_cls.associate_with(strict_dict_cls)
+self._strict_map[strict_dict_map_key] = 
StrictValue(type_cls=strict_dict_cls,
+
listener_cls=listener_cls)
 
-return self._strict_map[strict_dict_map_key]
+return self._strict_map[strict_dict_map_key].type_cls
 
 StrictDict = _StrictDict()
 
 
 class _StrictList(object):
+"""
+This entire class functions as a factory for strict dicts and their 
listeners.
--- End diff --

wrong comment: not dict, list


---
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.
---


[GitHub] incubator-ariatosca pull request #62: ARIA-66-Convert-custom-parser-fields-i...

2017-01-31 Thread dankilman
Github user dankilman commented on a diff in the pull request:

https://github.com/apache/incubator-ariatosca/pull/62#discussion_r98640012
  
--- Diff: aria/storage/type.py ---
@@ -175,72 +172,105 @@ class _MutableList(mutable.MutableList):
 @classmethod
 def coerce(cls, key, value):
 "Convert plain dictionaries to MutableDict."
-
 try:
-if not isinstance(value, cls):
-if isinstance(value, list):
-return cls(value)
-
-return mutable.Mutable.coerce(key, value)
-else:
-return value
-
+return mutable.MutableList.coerce(key, value)
 except ValueError as e:
 raise exceptions.StorageError('SQL Storage error: 
{0}'.format(str(e)))
 
-StrictDictID = namedtuple('strict_dict_id', 'key_cls, value_cls')
+StrictDictID = namedtuple('StrictDictID', 'key_cls, value_cls')
+StrictValue = namedtuple('StrictValue', 'type_cls, listener_cls')
 
 
 class _StrictDict(object):
+"""
+This entire class functions as a factory for strict dicts and their 
listeners.
+No type class, and no listener type class is created (and associated) 
more than once. If a
+relevant type class exists it is returned.
+"""
 _strict_map = {}
 
-def __call__(self, key_cls=None, value_cls=None, *args, **kwargs):
+def __call__(self, key_cls=None, value_cls=None):
 strict_dict_map_key = StrictDictID(key_cls=key_cls, 
value_cls=value_cls)
 if strict_dict_map_key not in self._strict_map:
+# Creating the type class itself. this class would be returned 
(used by the sqlalchemy
+# Column).
 strict_dict_cls = type(
 'StrictDict_{0}_{1}'.format(key_cls.__name__, 
value_cls.__name__),
 (Dict, ),
 {}
 )
-type(
+# Creating the type listening class and associating it with 
the newly created type.
+# The new class inherits from both the _MutableList class and 
the _StrictListMixin,
--- End diff --

wrong comment: not list, dict


---
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.
---


[GitHub] incubator-ariatosca pull request #62: ARIA-66-Convert-custom-parser-fields-i...

2017-01-31 Thread dankilman
Github user dankilman commented on a diff in the pull request:

https://github.com/apache/incubator-ariatosca/pull/62#discussion_r98641330
  
--- Diff: aria/storage/type.py ---
@@ -175,72 +172,105 @@ class _MutableList(mutable.MutableList):
 @classmethod
 def coerce(cls, key, value):
 "Convert plain dictionaries to MutableDict."
-
 try:
-if not isinstance(value, cls):
-if isinstance(value, list):
-return cls(value)
-
-return mutable.Mutable.coerce(key, value)
-else:
-return value
-
+return mutable.MutableList.coerce(key, value)
 except ValueError as e:
 raise exceptions.StorageError('SQL Storage error: 
{0}'.format(str(e)))
 
-StrictDictID = namedtuple('strict_dict_id', 'key_cls, value_cls')
+StrictDictID = namedtuple('StrictDictID', 'key_cls, value_cls')
+StrictValue = namedtuple('StrictValue', 'type_cls, listener_cls')
 
 
 class _StrictDict(object):
+"""
+This entire class functions as a factory for strict dicts and their 
listeners.
+No type class, and no listener type class is created (and associated) 
more than once. If a
+relevant type class exists it is returned.
+"""
 _strict_map = {}
 
-def __call__(self, key_cls=None, value_cls=None, *args, **kwargs):
+def __call__(self, key_cls=None, value_cls=None):
 strict_dict_map_key = StrictDictID(key_cls=key_cls, 
value_cls=value_cls)
 if strict_dict_map_key not in self._strict_map:
+# Creating the type class itself. this class would be returned 
(used by the sqlalchemy
+# Column).
 strict_dict_cls = type(
 'StrictDict_{0}_{1}'.format(key_cls.__name__, 
value_cls.__name__),
 (Dict, ),
 {}
 )
-type(
+# Creating the type listening class and associating it with 
the newly created type.
+# The new class inherits from both the _MutableList class and 
the _StrictListMixin,
+# while setting the necessary _key_cls and _value_cls as class 
attributes.
+listener_cls = type(
 'StrictMutableDict_{0}_{1}'.format(key_cls.__name__, 
value_cls.__name__),
 (_StrictDictMixin, _MutableDict),
 {'_key_cls': key_cls, '_value_cls': value_cls}
-).associate_with(strict_dict_cls)
-self._strict_map[strict_dict_map_key] = strict_dict_cls
+)
+listener_cls.associate_with(strict_dict_cls)
+self._strict_map[strict_dict_map_key] = 
StrictValue(type_cls=strict_dict_cls,
+
listener_cls=listener_cls)
 
-return self._strict_map[strict_dict_map_key]
+return self._strict_map[strict_dict_map_key].type_cls
 
 StrictDict = _StrictDict()
 
 
 class _StrictList(object):
+"""
+This entire class functions as a factory for strict dicts and their 
listeners.
+No type class, and no listener type class is created (and associated) 
more than once. If a
+relevant type class exists it is returned.
+"""
 _strict_map = {}
 
 def __call__(self, item_cls=None):
+
 if item_cls not in self._strict_map:
+# Creating the type class itself. this class would be returned 
(used by the sqlalchemy
+# Column).
 strict_list_cls = type(
 'StrictList_{0}'.format(item_cls.__name__),
 (List, ),
 {}
 )
-type(
+# Creating the type listening class and associating it with 
the newly created type.
+# The new class inherits from both the _MutableList class and 
the _StrictListMixin,
+# while setting the necessary _item_cls as class attribute.
+listener_cls = type(
 'StrictMutableList_{0}'.format(item_cls.__name__),
 (_StrictListMixin, _MutableList),
 {'_item_cls': item_cls}
-).associate_with(strict_list_cls)
-self._strict_map[item_cls] = strict_list_cls
+)
+self._strict_map[item_cls] = 
StrictValue(type_cls=strict_list_cls,
+ 
listener_cls=listener_cls)
 
-return self._strict_map[item_cls]
+return self._strict_map[item_cls].type_cls
 
 StrictList = _Stric

[GitHub] incubator-ariatosca pull request #62: ARIA-66-Convert-custom-parser-fields-i...

2017-01-31 Thread dankilman
Github user dankilman commented on a diff in the pull request:

https://github.com/apache/incubator-ariatosca/pull/62#discussion_r98640329
  
--- Diff: aria/storage/type.py ---
@@ -175,72 +172,105 @@ class _MutableList(mutable.MutableList):
 @classmethod
 def coerce(cls, key, value):
 "Convert plain dictionaries to MutableDict."
-
 try:
-if not isinstance(value, cls):
-if isinstance(value, list):
-return cls(value)
-
-return mutable.Mutable.coerce(key, value)
-else:
-return value
-
+return mutable.MutableList.coerce(key, value)
 except ValueError as e:
 raise exceptions.StorageError('SQL Storage error: 
{0}'.format(str(e)))
 
-StrictDictID = namedtuple('strict_dict_id', 'key_cls, value_cls')
+StrictDictID = namedtuple('StrictDictID', 'key_cls, value_cls')
+StrictValue = namedtuple('StrictValue', 'type_cls, listener_cls')
 
 
 class _StrictDict(object):
+"""
+This entire class functions as a factory for strict dicts and their 
listeners.
+No type class, and no listener type class is created (and associated) 
more than once. If a
+relevant type class exists it is returned.
+"""
 _strict_map = {}
 
-def __call__(self, key_cls=None, value_cls=None, *args, **kwargs):
+def __call__(self, key_cls=None, value_cls=None):
 strict_dict_map_key = StrictDictID(key_cls=key_cls, 
value_cls=value_cls)
 if strict_dict_map_key not in self._strict_map:
+# Creating the type class itself. this class would be returned 
(used by the sqlalchemy
+# Column).
 strict_dict_cls = type(
 'StrictDict_{0}_{1}'.format(key_cls.__name__, 
value_cls.__name__),
 (Dict, ),
 {}
 )
-type(
+# Creating the type listening class and associating it with 
the newly created type.
+# The new class inherits from both the _MutableList class and 
the _StrictListMixin,
+# while setting the necessary _key_cls and _value_cls as class 
attributes.
+listener_cls = type(
 'StrictMutableDict_{0}_{1}'.format(key_cls.__name__, 
value_cls.__name__),
 (_StrictDictMixin, _MutableDict),
 {'_key_cls': key_cls, '_value_cls': value_cls}
-).associate_with(strict_dict_cls)
-self._strict_map[strict_dict_map_key] = strict_dict_cls
+)
+listener_cls.associate_with(strict_dict_cls)
--- End diff --

shouldn't you not be calling `associate_with` here?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


incubator-ariatosca git commit: ARIA-36 plugin workdir [Forced Update!]

2017-01-25 Thread dankilman
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-36-plugin-workdir 9ffcd9c2a -> 7cf72bcfe (forced update)


ARIA-36 plugin workdir


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

Branch: refs/heads/ARIA-36-plugin-workdir
Commit: 7cf72bcfe97d2796f3268aa1003221c6423d1fa8
Parents: e3056d4
Author: Dan Kilman 
Authored: Wed Jan 25 16:22:41 2017 +0200
Committer: Dan Kilman 
Committed: Wed Jan 25 18:06:53 2017 +0200

--
 aria/orchestrator/context/common.py  |  2 ++
 aria/orchestrator/context/operation.py   | 22 ++
 aria/orchestrator/context/serialization.py   |  1 +
 aria/orchestrator/workflows/core/task.py |  3 +-
 tests/orchestrator/context/test_operation.py | 36 ++-
 tests/orchestrator/context/test_serialize.py | 13 ++--
 6 files changed, 72 insertions(+), 5 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/7cf72bcf/aria/orchestrator/context/common.py
--
diff --git a/aria/orchestrator/context/common.py 
b/aria/orchestrator/context/common.py
index 691c17d..6ab27ef 100644
--- a/aria/orchestrator/context/common.py
+++ b/aria/orchestrator/context/common.py
@@ -34,6 +34,7 @@ class BaseContext(logger.LoggerMixin):
 deployment_id,
 model_storage,
 resource_storage,
+workdir=None,
 **kwargs):
 super(BaseContext, self).__init__(**kwargs)
 self._name = name
@@ -41,6 +42,7 @@ class BaseContext(logger.LoggerMixin):
 self._model = model_storage
 self._resource = resource_storage
 self._deployment_id = deployment_id
+self._workdir = workdir
 
 def __repr__(self):
 return (

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/7cf72bcf/aria/orchestrator/context/operation.py
--
diff --git a/aria/orchestrator/context/operation.py 
b/aria/orchestrator/context/operation.py
index b33d107..3948750 100644
--- a/aria/orchestrator/context/operation.py
+++ b/aria/orchestrator/context/operation.py
@@ -17,6 +17,8 @@
 Workflow and operation contexts
 """
 
+import errno
+import os
 
 from .common import BaseContext
 
@@ -60,6 +62,26 @@ class BaseOperationContext(BaseContext):
 self._task = self.model.task.get(self._task_id)
 return self._task
 
+@property
+def plugin_workdir(self):
+"""
+A work directory that is unique to the plugin and the deployment id
+"""
+if not self._workdir:
+return None
+plugin_name = self.task.plugin_name
+if not plugin_name:
+return None
+plugin_workdir = '{0}/plugins/{1}-{2}'.format(
+self._workdir, self.deployment.id, plugin_name)
+if not os.path.exists(plugin_workdir):
+try:
+os.makedirs(plugin_workdir)
+except IOError as e:
+if e.errno != errno.EEXIST:
+raise
+return plugin_workdir
+
 
 class NodeOperationContext(BaseOperationContext):
 """

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/7cf72bcf/aria/orchestrator/context/serialization.py
--
diff --git a/aria/orchestrator/context/serialization.py 
b/aria/orchestrator/context/serialization.py
index 93cb38a..760818f 100644
--- a/aria/orchestrator/context/serialization.py
+++ b/aria/orchestrator/context/serialization.py
@@ -26,6 +26,7 @@ def operation_context_to_dict(context):
 'deployment_id': context._deployment_id,
 'task_id': context._task_id,
 'actor_id': context._actor_id,
+'workdir': context._workdir
 }
 if context.model:
 model = context.model

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/7cf72bcf/aria/orchestrator/workflows/core/task.py
--
diff --git a/aria/orchestrator/workflows/core/task.py 
b/aria/orchestrator/workflows/core/task.py
index 4017ed0..f65fc0d 100644
--- a/aria/orchestrator/workflows/core/task.py
+++ b/aria/orchestrator/workflows/core/task.py
@@ -146,7 +146,8 @@ class OperationTask(BaseTask):
   
resource_storage=self._workflow_context.resource,
   
deployment_id=self._workflow_context._deployment_id,
   

incubator-ariatosca git commit: ARIA-36 plugin workdir [Forced Update!]

2017-01-25 Thread dankilman
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-36-plugin-workdir 08f678fca -> 9ffcd9c2a (forced update)


ARIA-36 plugin workdir


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

Branch: refs/heads/ARIA-36-plugin-workdir
Commit: 9ffcd9c2a5f8ef14f2d5782788c027f8a10195cb
Parents: e3056d4
Author: Dan Kilman 
Authored: Wed Jan 25 16:22:41 2017 +0200
Committer: Dan Kilman 
Committed: Wed Jan 25 17:20:56 2017 +0200

--
 aria/orchestrator/context/common.py  |  2 ++
 aria/orchestrator/context/operation.py   | 22 ++
 aria/orchestrator/context/serialization.py   |  1 +
 aria/orchestrator/workflows/core/task.py |  3 +-
 tests/orchestrator/context/test_operation.py | 36 ++-
 tests/orchestrator/context/test_serialize.py | 13 ++--
 6 files changed, 72 insertions(+), 5 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/9ffcd9c2/aria/orchestrator/context/common.py
--
diff --git a/aria/orchestrator/context/common.py 
b/aria/orchestrator/context/common.py
index 691c17d..6ab27ef 100644
--- a/aria/orchestrator/context/common.py
+++ b/aria/orchestrator/context/common.py
@@ -34,6 +34,7 @@ class BaseContext(logger.LoggerMixin):
 deployment_id,
 model_storage,
 resource_storage,
+workdir=None,
 **kwargs):
 super(BaseContext, self).__init__(**kwargs)
 self._name = name
@@ -41,6 +42,7 @@ class BaseContext(logger.LoggerMixin):
 self._model = model_storage
 self._resource = resource_storage
 self._deployment_id = deployment_id
+self._workdir = workdir
 
 def __repr__(self):
 return (

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/9ffcd9c2/aria/orchestrator/context/operation.py
--
diff --git a/aria/orchestrator/context/operation.py 
b/aria/orchestrator/context/operation.py
index b33d107..3948750 100644
--- a/aria/orchestrator/context/operation.py
+++ b/aria/orchestrator/context/operation.py
@@ -17,6 +17,8 @@
 Workflow and operation contexts
 """
 
+import errno
+import os
 
 from .common import BaseContext
 
@@ -60,6 +62,26 @@ class BaseOperationContext(BaseContext):
 self._task = self.model.task.get(self._task_id)
 return self._task
 
+@property
+def plugin_workdir(self):
+"""
+A work directory that is unique to the plugin and the deployment id
+"""
+if not self._workdir:
+return None
+plugin_name = self.task.plugin_name
+if not plugin_name:
+return None
+plugin_workdir = '{0}/plugins/{1}-{2}'.format(
+self._workdir, self.deployment.id, plugin_name)
+if not os.path.exists(plugin_workdir):
+try:
+os.makedirs(plugin_workdir)
+except IOError as e:
+if e.errno != errno.EEXIST:
+raise
+return plugin_workdir
+
 
 class NodeOperationContext(BaseOperationContext):
 """

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/9ffcd9c2/aria/orchestrator/context/serialization.py
--
diff --git a/aria/orchestrator/context/serialization.py 
b/aria/orchestrator/context/serialization.py
index 93cb38a..760818f 100644
--- a/aria/orchestrator/context/serialization.py
+++ b/aria/orchestrator/context/serialization.py
@@ -26,6 +26,7 @@ def operation_context_to_dict(context):
 'deployment_id': context._deployment_id,
 'task_id': context._task_id,
 'actor_id': context._actor_id,
+'workdir': context._workdir
 }
 if context.model:
 model = context.model

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/9ffcd9c2/aria/orchestrator/workflows/core/task.py
--
diff --git a/aria/orchestrator/workflows/core/task.py 
b/aria/orchestrator/workflows/core/task.py
index 4017ed0..9625c97 100644
--- a/aria/orchestrator/workflows/core/task.py
+++ b/aria/orchestrator/workflows/core/task.py
@@ -146,7 +146,8 @@ class OperationTask(BaseTask):
   
resource_storage=self._workflow_context.resource,
   
deployment_id=self._workflow_context._deployment_id,
   

incubator-ariatosca git commit: ARIA-36 plugin workdir

2017-01-25 Thread dankilman
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-36-plugin-workdir [created] 604cfa6bd


ARIA-36 plugin workdir


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

Branch: refs/heads/ARIA-36-plugin-workdir
Commit: 604cfa6bdc38dcfdeb2b22013572ef299a48224e
Parents: e3056d4
Author: Dan Kilman 
Authored: Wed Jan 25 16:22:41 2017 +0200
Committer: Dan Kilman 
Committed: Wed Jan 25 16:53:42 2017 +0200

--
 aria/orchestrator/context/common.py  |  2 ++
 aria/orchestrator/context/operation.py   | 24 +
 aria/orchestrator/context/serialization.py   |  1 +
 aria/orchestrator/workflows/core/task.py |  3 +-
 tests/orchestrator/context/test_operation.py | 42 ++-
 tests/orchestrator/context/test_serialize.py | 13 +--
 6 files changed, 80 insertions(+), 5 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/604cfa6b/aria/orchestrator/context/common.py
--
diff --git a/aria/orchestrator/context/common.py 
b/aria/orchestrator/context/common.py
index 691c17d..1476800 100644
--- a/aria/orchestrator/context/common.py
+++ b/aria/orchestrator/context/common.py
@@ -34,6 +34,7 @@ class BaseContext(logger.LoggerMixin):
 deployment_id,
 model_storage,
 resource_storage,
+base_workdir=None,
 **kwargs):
 super(BaseContext, self).__init__(**kwargs)
 self._name = name
@@ -41,6 +42,7 @@ class BaseContext(logger.LoggerMixin):
 self._model = model_storage
 self._resource = resource_storage
 self._deployment_id = deployment_id
+self._base_workdir = base_workdir
 
 def __repr__(self):
 return (

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/604cfa6b/aria/orchestrator/context/operation.py
--
diff --git a/aria/orchestrator/context/operation.py 
b/aria/orchestrator/context/operation.py
index b33d107..692ce90 100644
--- a/aria/orchestrator/context/operation.py
+++ b/aria/orchestrator/context/operation.py
@@ -17,6 +17,8 @@
 Workflow and operation contexts
 """
 
+import errno
+import os
 
 from .common import BaseContext
 
@@ -60,6 +62,28 @@ class BaseOperationContext(BaseContext):
 self._task = self.model.task.get(self._task_id)
 return self._task
 
+@property
+def plugin_workdir(self):
+"""
+A work directory that is unique to the plugin and the deployment id
+"""
+if not self._base_workdir:
+return
+plugin_name = self.task.plugin_name
+if not plugin_name:
+return
+plugin_workdir = '{0}/plugins/{1}-{2}'.format(
+self._base_workdir, self.deployment.id, plugin_name)
+if not os.path.exists(plugin_workdir):
+try:
+os.makedirs(plugin_workdir)
+except IOError as e:
+if e.errno == errno.EEXIST:
+pass
+else:
+raise
+return plugin_workdir
+
 
 class NodeOperationContext(BaseOperationContext):
 """

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/604cfa6b/aria/orchestrator/context/serialization.py
--
diff --git a/aria/orchestrator/context/serialization.py 
b/aria/orchestrator/context/serialization.py
index 93cb38a..093ab5d 100644
--- a/aria/orchestrator/context/serialization.py
+++ b/aria/orchestrator/context/serialization.py
@@ -26,6 +26,7 @@ def operation_context_to_dict(context):
 'deployment_id': context._deployment_id,
 'task_id': context._task_id,
 'actor_id': context._actor_id,
+'base_workdir': context._base_workdir
 }
 if context.model:
 model = context.model

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/604cfa6b/aria/orchestrator/workflows/core/task.py
--
diff --git a/aria/orchestrator/workflows/core/task.py 
b/aria/orchestrator/workflows/core/task.py
index 4017ed0..270caf4 100644
--- a/aria/orchestrator/workflows/core/task.py
+++ b/aria/orchestrator/workflows/core/task.py
@@ -146,7 +146,8 @@ class OperationTask(BaseTask):
   
resource_storage=self._workflow_context.resource,
   

incubator-ariatosca git commit: ARIA-36 plugin workdir [Forced Update!]

2017-01-25 Thread dankilman
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-36-plugin-workdir 604cfa6bd -> 7229b33c4 (forced update)


ARIA-36 plugin workdir


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

Branch: refs/heads/ARIA-36-plugin-workdir
Commit: 7229b33c4233c1a741e3c26a50e37b4bb31899b9
Parents: e3056d4
Author: Dan Kilman 
Authored: Wed Jan 25 16:22:41 2017 +0200
Committer: Dan Kilman 
Committed: Wed Jan 25 17:02:00 2017 +0200

--
 aria/orchestrator/context/common.py  |  2 ++
 aria/orchestrator/context/operation.py   | 24 +++
 aria/orchestrator/context/serialization.py   |  1 +
 aria/orchestrator/workflows/core/task.py |  3 +-
 tests/orchestrator/context/test_operation.py | 36 ++-
 tests/orchestrator/context/test_serialize.py | 13 ++--
 6 files changed, 74 insertions(+), 5 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/7229b33c/aria/orchestrator/context/common.py
--
diff --git a/aria/orchestrator/context/common.py 
b/aria/orchestrator/context/common.py
index 691c17d..1476800 100644
--- a/aria/orchestrator/context/common.py
+++ b/aria/orchestrator/context/common.py
@@ -34,6 +34,7 @@ class BaseContext(logger.LoggerMixin):
 deployment_id,
 model_storage,
 resource_storage,
+base_workdir=None,
 **kwargs):
 super(BaseContext, self).__init__(**kwargs)
 self._name = name
@@ -41,6 +42,7 @@ class BaseContext(logger.LoggerMixin):
 self._model = model_storage
 self._resource = resource_storage
 self._deployment_id = deployment_id
+self._base_workdir = base_workdir
 
 def __repr__(self):
 return (

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/7229b33c/aria/orchestrator/context/operation.py
--
diff --git a/aria/orchestrator/context/operation.py 
b/aria/orchestrator/context/operation.py
index b33d107..692ce90 100644
--- a/aria/orchestrator/context/operation.py
+++ b/aria/orchestrator/context/operation.py
@@ -17,6 +17,8 @@
 Workflow and operation contexts
 """
 
+import errno
+import os
 
 from .common import BaseContext
 
@@ -60,6 +62,28 @@ class BaseOperationContext(BaseContext):
 self._task = self.model.task.get(self._task_id)
 return self._task
 
+@property
+def plugin_workdir(self):
+"""
+A work directory that is unique to the plugin and the deployment id
+"""
+if not self._base_workdir:
+return
+plugin_name = self.task.plugin_name
+if not plugin_name:
+return
+plugin_workdir = '{0}/plugins/{1}-{2}'.format(
+self._base_workdir, self.deployment.id, plugin_name)
+if not os.path.exists(plugin_workdir):
+try:
+os.makedirs(plugin_workdir)
+except IOError as e:
+if e.errno == errno.EEXIST:
+pass
+else:
+raise
+return plugin_workdir
+
 
 class NodeOperationContext(BaseOperationContext):
 """

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/7229b33c/aria/orchestrator/context/serialization.py
--
diff --git a/aria/orchestrator/context/serialization.py 
b/aria/orchestrator/context/serialization.py
index 93cb38a..093ab5d 100644
--- a/aria/orchestrator/context/serialization.py
+++ b/aria/orchestrator/context/serialization.py
@@ -26,6 +26,7 @@ def operation_context_to_dict(context):
 'deployment_id': context._deployment_id,
 'task_id': context._task_id,
 'actor_id': context._actor_id,
+'base_workdir': context._base_workdir
 }
 if context.model:
 model = context.model

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/7229b33c/aria/orchestrator/workflows/core/task.py
--
diff --git a/aria/orchestrator/workflows/core/task.py 
b/aria/orchestrator/workflows/core/task.py
index 4017ed0..270caf4 100644
--- a/aria/orchestrator/workflows/core/task.py
+++ b/aria/orchestrator/workflows/core/task.py
@@ -146,7 +146,8 @@ class OperationTask(BaseTask):
   
resource_storage=self._workflow_context.resource,
   

[GitHub] incubator-ariatosca pull request #58: ARIA-36 plugin workdir

2017-01-25 Thread dankilman
GitHub user dankilman opened a pull request:

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

ARIA-36 plugin workdir



You can merge this pull request into a Git repository by running:

$ git pull https://github.com/apache/incubator-ariatosca 
ARIA-36-plugin-workdir

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/incubator-ariatosca/pull/58.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 #58






---
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

2017-01-25 Thread dankilman
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-74-process-executor-hook [deleted] 0382b229c


[incubator-ariatosca] Git Push Summary

2017-01-25 Thread dankilman
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-68-commit-runtime-properties [deleted] 4c75aeba3


incubator-ariatosca git commit: ARIA-68 Update runtime properties during operation

2017-01-25 Thread dankilman
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/master db9ae9c70 -> 4c75aeba3


ARIA-68 Update runtime properties during operation


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

Branch: refs/heads/master
Commit: 4c75aeba322761471b247dc4e29692cde20043e9
Parents: db9ae9c
Author: Dan Kilman 
Authored: Tue Jan 24 16:58:10 2017 +0200
Committer: Dan Kilman 
Committed: Wed Jan 25 14:06:55 2017 +0200

--
 aria/orchestrator/workflows/executor/process.py | 93 ++--
 aria/storage/instrumentation.py | 18 +++-
 .../test_process_executor_tracked_changes.py| 62 -
 tests/storage/test_instrumentation.py   | 38 
 4 files changed, 179 insertions(+), 32 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/4c75aeba/aria/orchestrator/workflows/executor/process.py
--
diff --git a/aria/orchestrator/workflows/executor/process.py 
b/aria/orchestrator/workflows/executor/process.py
index 9fa0302..7d990fa 100644
--- a/aria/orchestrator/workflows/executor/process.py
+++ b/aria/orchestrator/workflows/executor/process.py
@@ -29,6 +29,7 @@ script_dir = os.path.dirname(__file__)
 if script_dir in sys.path:
 sys.path.remove(script_dir)
 
+import contextlib
 import io
 import threading
 import socket
@@ -136,37 +137,39 @@ class ProcessExecutor(base.BaseExecutor):
 while not self._stopped:
 try:
 # Accept messages written to the server socket
-message = self._recv_message()
-message_type = message['type']
-if message_type == 'closed':
-break
-task_id = message['task_id']
-if message_type == 'started':
-self._task_started(self._tasks[task_id])
-elif message_type == 'succeeded':
-task = self._remove_task(task_id)
-instrumentation.apply_tracked_changes(
-tracked_changes=message['tracked_changes'],
-model=task.context.model)
-self._task_succeeded(task)
-elif message_type == 'failed':
-task = self._remove_task(task_id)
-instrumentation.apply_tracked_changes(
-tracked_changes=message['tracked_changes'],
-model=task.context.model)
-self._task_failed(task, exception=message['exception'])
-else:
-raise RuntimeError('Invalid state')
+with contextlib.closing(self._server_socket.accept()[0]) as 
connection:
+message = self._recv_message(connection)
+message_type = message['type']
+if message_type == 'closed':
+break
+task_id = message['task_id']
+if message_type == 'started':
+self._task_started(self._tasks[task_id])
+elif message_type == 'apply_tracked_changes':
+task = self._tasks[task_id]
+instrumentation.apply_tracked_changes(
+tracked_changes=message['tracked_changes'],
+model=task.context.model)
+elif message_type == 'succeeded':
+task = self._remove_task(task_id)
+instrumentation.apply_tracked_changes(
+tracked_changes=message['tracked_changes'],
+model=task.context.model)
+self._task_succeeded(task)
+elif message_type == 'failed':
+task = self._remove_task(task_id)
+instrumentation.apply_tracked_changes(
+tracked_changes=message['tracked_changes'],
+model=task.context.model)
+self._task_failed(task, exception=message['exception'])
+else:
+raise RuntimeError('Invalid state')
 except BaseException as e:
 self.logger.debug('Error in process executor listener: 
{0}'.format(e))
 
-def _recv_message(self):
-connection, _ = self._server_socket.accept()
-try:
-message_len, = struct.unpack(_INT_FMT, 
self._recv_bytes(connection, 

incubator-ariatosca git commit: ARIA-68 Update runtime properties during operation [Forced Update!]

2017-01-25 Thread dankilman
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-68-commit-runtime-properties dcfd7096c -> 4c75aeba3 (forced 
update)


ARIA-68 Update runtime properties during operation


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

Branch: refs/heads/ARIA-68-commit-runtime-properties
Commit: 4c75aeba322761471b247dc4e29692cde20043e9
Parents: db9ae9c
Author: Dan Kilman 
Authored: Tue Jan 24 16:58:10 2017 +0200
Committer: Dan Kilman 
Committed: Wed Jan 25 14:06:55 2017 +0200

--
 aria/orchestrator/workflows/executor/process.py | 93 ++--
 aria/storage/instrumentation.py | 18 +++-
 .../test_process_executor_tracked_changes.py| 62 -
 tests/storage/test_instrumentation.py   | 38 
 4 files changed, 179 insertions(+), 32 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/4c75aeba/aria/orchestrator/workflows/executor/process.py
--
diff --git a/aria/orchestrator/workflows/executor/process.py 
b/aria/orchestrator/workflows/executor/process.py
index 9fa0302..7d990fa 100644
--- a/aria/orchestrator/workflows/executor/process.py
+++ b/aria/orchestrator/workflows/executor/process.py
@@ -29,6 +29,7 @@ script_dir = os.path.dirname(__file__)
 if script_dir in sys.path:
 sys.path.remove(script_dir)
 
+import contextlib
 import io
 import threading
 import socket
@@ -136,37 +137,39 @@ class ProcessExecutor(base.BaseExecutor):
 while not self._stopped:
 try:
 # Accept messages written to the server socket
-message = self._recv_message()
-message_type = message['type']
-if message_type == 'closed':
-break
-task_id = message['task_id']
-if message_type == 'started':
-self._task_started(self._tasks[task_id])
-elif message_type == 'succeeded':
-task = self._remove_task(task_id)
-instrumentation.apply_tracked_changes(
-tracked_changes=message['tracked_changes'],
-model=task.context.model)
-self._task_succeeded(task)
-elif message_type == 'failed':
-task = self._remove_task(task_id)
-instrumentation.apply_tracked_changes(
-tracked_changes=message['tracked_changes'],
-model=task.context.model)
-self._task_failed(task, exception=message['exception'])
-else:
-raise RuntimeError('Invalid state')
+with contextlib.closing(self._server_socket.accept()[0]) as 
connection:
+message = self._recv_message(connection)
+message_type = message['type']
+if message_type == 'closed':
+break
+task_id = message['task_id']
+if message_type == 'started':
+self._task_started(self._tasks[task_id])
+elif message_type == 'apply_tracked_changes':
+task = self._tasks[task_id]
+instrumentation.apply_tracked_changes(
+tracked_changes=message['tracked_changes'],
+model=task.context.model)
+elif message_type == 'succeeded':
+task = self._remove_task(task_id)
+instrumentation.apply_tracked_changes(
+tracked_changes=message['tracked_changes'],
+model=task.context.model)
+self._task_succeeded(task)
+elif message_type == 'failed':
+task = self._remove_task(task_id)
+instrumentation.apply_tracked_changes(
+tracked_changes=message['tracked_changes'],
+model=task.context.model)
+self._task_failed(task, exception=message['exception'])
+else:
+raise RuntimeError('Invalid state')
 except BaseException as e:
 self.logger.debug('Error in process executor listener: 
{0}'.format(e))
 
-def _recv_message(self):
-connection, _ = self._server_socket.accept()
-try:
-

incubator-ariatosca git commit: ARIA-68 Update runtime properties during operation [Forced Update!]

2017-01-25 Thread dankilman
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-68-commit-runtime-properties 2f0d610ca -> dcfd7096c (forced 
update)


ARIA-68 Update runtime properties during operation


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

Branch: refs/heads/ARIA-68-commit-runtime-properties
Commit: dcfd7096c0f18c709cd79e7b8418c1dc7fe59d86
Parents: db9ae9c
Author: Dan Kilman 
Authored: Tue Jan 24 16:58:10 2017 +0200
Committer: Dan Kilman 
Committed: Wed Jan 25 12:24:38 2017 +0200

--
 aria/orchestrator/workflows/executor/process.py | 87 +---
 aria/storage/instrumentation.py | 18 +++-
 .../test_process_executor_tracked_changes.py| 62 +-
 tests/storage/test_instrumentation.py   | 38 +
 4 files changed, 173 insertions(+), 32 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/dcfd7096/aria/orchestrator/workflows/executor/process.py
--
diff --git a/aria/orchestrator/workflows/executor/process.py 
b/aria/orchestrator/workflows/executor/process.py
index 9fa0302..6961b64 100644
--- a/aria/orchestrator/workflows/executor/process.py
+++ b/aria/orchestrator/workflows/executor/process.py
@@ -29,6 +29,7 @@ script_dir = os.path.dirname(__file__)
 if script_dir in sys.path:
 sys.path.remove(script_dir)
 
+import contextlib
 import io
 import threading
 import socket
@@ -136,37 +137,39 @@ class ProcessExecutor(base.BaseExecutor):
 while not self._stopped:
 try:
 # Accept messages written to the server socket
-message = self._recv_message()
-message_type = message['type']
-if message_type == 'closed':
-break
-task_id = message['task_id']
-if message_type == 'started':
-self._task_started(self._tasks[task_id])
-elif message_type == 'succeeded':
-task = self._remove_task(task_id)
-instrumentation.apply_tracked_changes(
-tracked_changes=message['tracked_changes'],
-model=task.context.model)
-self._task_succeeded(task)
-elif message_type == 'failed':
-task = self._remove_task(task_id)
-instrumentation.apply_tracked_changes(
-tracked_changes=message['tracked_changes'],
-model=task.context.model)
-self._task_failed(task, exception=message['exception'])
-else:
-raise RuntimeError('Invalid state')
+with contextlib.closing(self._server_socket.accept()[0]) as 
connection:
+message = self._recv_message(connection)
+message_type = message['type']
+if message_type == 'closed':
+break
+task_id = message['task_id']
+if message_type == 'started':
+self._task_started(self._tasks[task_id])
+elif message_type == 'apply_tracked_changes':
+task = self._tasks[task_id]
+instrumentation.apply_tracked_changes(
+tracked_changes=message['tracked_changes'],
+model=task.context.model)
+elif message_type == 'succeeded':
+task = self._remove_task(task_id)
+instrumentation.apply_tracked_changes(
+tracked_changes=message['tracked_changes'],
+model=task.context.model)
+self._task_succeeded(task)
+elif message_type == 'failed':
+task = self._remove_task(task_id)
+instrumentation.apply_tracked_changes(
+tracked_changes=message['tracked_changes'],
+model=task.context.model)
+self._task_failed(task, exception=message['exception'])
+else:
+raise RuntimeError('Invalid state')
 except BaseException as e:
 self.logger.debug('Error in process executor listener: 
{0}'.format(e))
 
-def _recv_message(self):
-connection, _ = self._server_socket.accept()
-try:
-

[1/2] incubator-ariatosca git commit: ARIA-72 Rework built-in workflows to match TOSCA normative lifecycle [Forced Update!]

2017-01-25 Thread dankilman
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-68-commit-runtime-properties bd152bcb8 -> 2f0d610ca (forced 
update)


ARIA-72 Rework built-in workflows to match TOSCA normative lifecycle


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

Branch: refs/heads/ARIA-68-commit-runtime-properties
Commit: db9ae9c70ae0703cb3f357bf53b95d1a351a8ab0
Parents: 0382b22
Author: Tal Liron 
Authored: Tue Jan 24 09:52:36 2017 +0200
Committer: Tal Liron 
Committed: Tue Jan 24 15:48:42 2017 +0200

--
 aria/orchestrator/workflows/builtin/__init__.py |  12 +-
 .../workflows/builtin/execute_operation.py  |  30 +-
 aria/orchestrator/workflows/builtin/heal.py |   4 +-
 aria/orchestrator/workflows/builtin/install.py  |  42 +--
 aria/orchestrator/workflows/builtin/start.py|  28 ++
 aria/orchestrator/workflows/builtin/stop.py |  28 ++
 .../orchestrator/workflows/builtin/uninstall.py |  41 +--
 aria/orchestrator/workflows/builtin/utils.py|  70 +
 .../orchestrator/workflows/builtin/workflows.py | 280 +++
 tests/mock/operations.py|  48 +++-
 .../orchestrator/workflows/builtin/__init__.py  |  39 +--
 .../orchestrator/workflows/builtin/test_heal.py |   2 +
 tests/orchestrator/workflows/core/test_task.py  |   6 +-
 .../test_task_graph_into_exececution_graph.py   |   2 +-
 14 files changed, 342 insertions(+), 290 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/db9ae9c7/aria/orchestrator/workflows/builtin/__init__.py
--
diff --git a/aria/orchestrator/workflows/builtin/__init__.py 
b/aria/orchestrator/workflows/builtin/__init__.py
index 0449a8e..d43a962 100644
--- a/aria/orchestrator/workflows/builtin/__init__.py
+++ b/aria/orchestrator/workflows/builtin/__init__.py
@@ -19,13 +19,17 @@ A set of builtin workflows
 
 from .install import install
 from .uninstall import uninstall
-from .execute_operation import execute_operation
-from .heal import heal
+from .start import start
+from .stop import stop
+
+
+BUILTIN_WORKFLOWS = ('install', 'uninstall', 'start', 'stop')
 
 
 __all__ = [
+'BUILTIN_WORKFLOWS',
 'install',
 'uninstall',
-'execute_operation',
-'heal',
+'start',
+'stop'
 ]

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/db9ae9c7/aria/orchestrator/workflows/builtin/execute_operation.py
--
diff --git a/aria/orchestrator/workflows/builtin/execute_operation.py 
b/aria/orchestrator/workflows/builtin/execute_operation.py
index ddbb8e7..e76993d 100644
--- a/aria/orchestrator/workflows/builtin/execute_operation.py
+++ b/aria/orchestrator/workflows/builtin/execute_operation.py
@@ -17,9 +17,8 @@
 Builtin execute_operation workflow
 """
 
-from aria import workflow
-
-from .workflows import execute_operation_on_instance
+from ..api.task import OperationTask
+from ... import workflow
 
 
 @workflow
@@ -68,7 +67,7 @@ def execute_operation(
 # registering actual tasks to sequences
 for node_instance in filtered_node_instances:
 graph.add_tasks(
-execute_operation_on_instance(
+_create_node_instance_task(
 node_instance=node_instance,
 operation=operation,
 operation_kwargs=operation_kwargs,
@@ -102,3 +101,26 @@ def _filter_node_instances(context, node_ids=(), 
node_instance_ids=(), type_name
 _is_node_instance_by_id(node_instance.id),
 _is_node_by_type(node_instance.node.type_hierarchy))):
 yield node_instance
+
+
+def _create_node_instance_task(
+node_instance,
+operation,
+operation_kwargs,
+allow_kwargs_override):
+"""
+A workflow which executes a single operation
+:param node_instance: the node instance to install
+:param basestring operation: the operation name
+:param dict operation_kwargs:
+:param bool allow_kwargs_override:
+:return:
+"""
+
+if allow_kwargs_override is not None:
+operation_kwargs['allow_kwargs_override'] = allow_kwargs_override
+
+return OperationTask.node_instance(
+instance=node_instance,
+name=operation,
+inputs=operation_kwargs)

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/db9ae9c7/aria/orchestrator/workflows/builtin/heal.py
--
diff --git 

[GitHub] incubator-ariatosca pull request #55: ARIA-68 Update runtime properties duri...

2017-01-25 Thread dankilman
GitHub user dankilman opened a pull request:

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

ARIA-68 Update runtime properties during operation



You can merge this pull request into a Git repository by running:

$ git pull https://github.com/apache/incubator-ariatosca 
ARIA-68-commit-runtime-properties

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/incubator-ariatosca/pull/55.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 #55


commit 2f0d610ca6e3962841de138b0188dfb2c1811378
Author: Dan Kilman <d...@gigaspaces.com>
Date:   2017-01-24T14:58:10Z

ARIA-68 Update runtime properties during operation




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


incubator-ariatosca git commit: ARIA-68 Update runtime properties during operation [Forced Update!]

2017-01-24 Thread dankilman
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-68-commit-runtime-properties 201ef1234 -> bd152bcb8 (forced 
update)


ARIA-68 Update runtime properties during operation


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

Branch: refs/heads/ARIA-68-commit-runtime-properties
Commit: bd152bcb8b709737aac30ef85bf7dddf6ae1d9e1
Parents: 0382b22
Author: Dan Kilman 
Authored: Tue Jan 24 16:58:10 2017 +0200
Committer: Dan Kilman 
Committed: Wed Jan 25 00:47:11 2017 +0200

--
 aria/orchestrator/workflows/executor/process.py | 83 +---
 aria/storage/instrumentation.py | 18 -
 tests/storage/test_instrumentation.py   | 38 +
 3 files changed, 109 insertions(+), 30 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/bd152bcb/aria/orchestrator/workflows/executor/process.py
--
diff --git a/aria/orchestrator/workflows/executor/process.py 
b/aria/orchestrator/workflows/executor/process.py
index 9fa0302..0667e7c 100644
--- a/aria/orchestrator/workflows/executor/process.py
+++ b/aria/orchestrator/workflows/executor/process.py
@@ -29,6 +29,7 @@ script_dir = os.path.dirname(__file__)
 if script_dir in sys.path:
 sys.path.remove(script_dir)
 
+import contextlib
 import io
 import threading
 import socket
@@ -136,37 +137,39 @@ class ProcessExecutor(base.BaseExecutor):
 while not self._stopped:
 try:
 # Accept messages written to the server socket
-message = self._recv_message()
-message_type = message['type']
-if message_type == 'closed':
-break
-task_id = message['task_id']
-if message_type == 'started':
-self._task_started(self._tasks[task_id])
-elif message_type == 'succeeded':
-task = self._remove_task(task_id)
-instrumentation.apply_tracked_changes(
-tracked_changes=message['tracked_changes'],
-model=task.context.model)
-self._task_succeeded(task)
-elif message_type == 'failed':
-task = self._remove_task(task_id)
-instrumentation.apply_tracked_changes(
-tracked_changes=message['tracked_changes'],
-model=task.context.model)
-self._task_failed(task, exception=message['exception'])
-else:
-raise RuntimeError('Invalid state')
+with contextlib.closing(self._server_socket.accept()[0]) as 
connection:
+message = self._recv_message(connection)
+message_type = message['type']
+if message_type == 'closed':
+break
+task_id = message['task_id']
+if message_type == 'started':
+self._task_started(self._tasks[task_id])
+elif message_type == 'apply_tracked_changes':
+task = self._tasks[task_id]
+instrumentation.apply_tracked_changes(
+tracked_changes=message['tracked_changes'],
+model=task.context.model)
+elif message_type == 'succeeded':
+task = self._remove_task(task_id)
+instrumentation.apply_tracked_changes(
+tracked_changes=message['tracked_changes'],
+model=task.context.model)
+self._task_succeeded(task)
+elif message_type == 'failed':
+task = self._remove_task(task_id)
+instrumentation.apply_tracked_changes(
+tracked_changes=message['tracked_changes'],
+model=task.context.model)
+self._task_failed(task, exception=message['exception'])
+else:
+raise RuntimeError('Invalid state')
 except BaseException as e:
 self.logger.debug('Error in process executor listener: 
{0}'.format(e))
 
-def _recv_message(self):
-connection, _ = self._server_socket.accept()
-try:
-message_len, = struct.unpack(_INT_FMT, 

incubator-ariatosca git commit: ARIA-68 Update runtime properties during operation [Forced Update!]

2017-01-24 Thread dankilman
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-68-commit-runtime-properties 5a7e5a205 -> 201ef1234 (forced 
update)


ARIA-68 Update runtime properties during operation


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

Branch: refs/heads/ARIA-68-commit-runtime-properties
Commit: 201ef1234ee6d8aeec3d71479cbc16d245d681ae
Parents: 0382b22
Author: Dan Kilman 
Authored: Tue Jan 24 16:58:10 2017 +0200
Committer: Dan Kilman 
Committed: Tue Jan 24 17:14:12 2017 +0200

--
 aria/orchestrator/workflows/executor/process.py | 79 +---
 aria/storage/instrumentation.py | 17 -
 2 files changed, 66 insertions(+), 30 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/201ef123/aria/orchestrator/workflows/executor/process.py
--
diff --git a/aria/orchestrator/workflows/executor/process.py 
b/aria/orchestrator/workflows/executor/process.py
index 9fa0302..e2fdbf2 100644
--- a/aria/orchestrator/workflows/executor/process.py
+++ b/aria/orchestrator/workflows/executor/process.py
@@ -29,6 +29,7 @@ script_dir = os.path.dirname(__file__)
 if script_dir in sys.path:
 sys.path.remove(script_dir)
 
+import contextlib
 import io
 import threading
 import socket
@@ -136,37 +137,39 @@ class ProcessExecutor(base.BaseExecutor):
 while not self._stopped:
 try:
 # Accept messages written to the server socket
-message = self._recv_message()
-message_type = message['type']
-if message_type == 'closed':
-break
-task_id = message['task_id']
-if message_type == 'started':
-self._task_started(self._tasks[task_id])
-elif message_type == 'succeeded':
-task = self._remove_task(task_id)
-instrumentation.apply_tracked_changes(
-tracked_changes=message['tracked_changes'],
-model=task.context.model)
-self._task_succeeded(task)
-elif message_type == 'failed':
-task = self._remove_task(task_id)
-instrumentation.apply_tracked_changes(
-tracked_changes=message['tracked_changes'],
-model=task.context.model)
-self._task_failed(task, exception=message['exception'])
-else:
-raise RuntimeError('Invalid state')
+with contextlib.closing(self._server_socket.accept()[0]) as 
connection:
+message = self._recv_message(connection)
+message_type = message['type']
+if message_type == 'closed':
+break
+task_id = message['task_id']
+if message_type == 'started':
+self._task_started(self._tasks[task_id])
+elif message_type == 'apply_tracked_changes':
+task = self._tasks[task_id]
+instrumentation.apply_tracked_changes(
+tracked_changes=message['tracked_changes'],
+model=task.context.model)
+elif message_type == 'succeeded':
+task = self._remove_task(task_id)
+instrumentation.apply_tracked_changes(
+tracked_changes=message['tracked_changes'],
+model=task.context.model)
+self._task_succeeded(task)
+elif message_type == 'failed':
+task = self._remove_task(task_id)
+instrumentation.apply_tracked_changes(
+tracked_changes=message['tracked_changes'],
+model=task.context.model)
+self._task_failed(task, exception=message['exception'])
+else:
+raise RuntimeError('Invalid state')
 except BaseException as e:
 self.logger.debug('Error in process executor listener: 
{0}'.format(e))
 
-def _recv_message(self):
-connection, _ = self._server_socket.accept()
-try:
-message_len, = struct.unpack(_INT_FMT, 
self._recv_bytes(connection, _INT_SIZE))
-return 

incubator-ariatosca git commit: ARIA-68 Update runtime properties during operation

2017-01-24 Thread dankilman
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-68-commit-runtime-properties [created] 5a7e5a205


ARIA-68 Update runtime properties during operation


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

Branch: refs/heads/ARIA-68-commit-runtime-properties
Commit: 5a7e5a20527805d4e95034a1e0cff6cb48402489
Parents: 0382b22
Author: Dan Kilman 
Authored: Tue Jan 24 16:58:10 2017 +0200
Committer: Dan Kilman 
Committed: Tue Jan 24 16:58:10 2017 +0200

--
 aria/orchestrator/workflows/executor/process.py | 78 +---
 aria/storage/instrumentation.py | 13 +++-
 2 files changed, 61 insertions(+), 30 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/5a7e5a20/aria/orchestrator/workflows/executor/process.py
--
diff --git a/aria/orchestrator/workflows/executor/process.py 
b/aria/orchestrator/workflows/executor/process.py
index 9fa0302..d293a06 100644
--- a/aria/orchestrator/workflows/executor/process.py
+++ b/aria/orchestrator/workflows/executor/process.py
@@ -29,6 +29,7 @@ script_dir = os.path.dirname(__file__)
 if script_dir in sys.path:
 sys.path.remove(script_dir)
 
+import contextlib
 import io
 import threading
 import socket
@@ -136,37 +137,39 @@ class ProcessExecutor(base.BaseExecutor):
 while not self._stopped:
 try:
 # Accept messages written to the server socket
-message = self._recv_message()
-message_type = message['type']
-if message_type == 'closed':
-break
-task_id = message['task_id']
-if message_type == 'started':
-self._task_started(self._tasks[task_id])
-elif message_type == 'succeeded':
-task = self._remove_task(task_id)
-instrumentation.apply_tracked_changes(
-tracked_changes=message['tracked_changes'],
-model=task.context.model)
-self._task_succeeded(task)
-elif message_type == 'failed':
-task = self._remove_task(task_id)
-instrumentation.apply_tracked_changes(
-tracked_changes=message['tracked_changes'],
-model=task.context.model)
-self._task_failed(task, exception=message['exception'])
-else:
-raise RuntimeError('Invalid state')
+with contextlib.closing(self._server_socket.accept()[0]) as 
connection:
+message = self._recv_message(connection)
+message_type = message['type']
+if message_type == 'closed':
+break
+task_id = message['task_id']
+if message_type == 'started':
+self._task_started(self._tasks[task_id])
+elif message_type == 'apply_tracked_changes':
+task = self._tasks[task_id]
+instrumentation.apply_tracked_changes(
+tracked_changes=message['tracked_changes'],
+model=task.context.model)
+elif message_type == 'succeeded':
+task = self._remove_task(task_id)
+instrumentation.apply_tracked_changes(
+tracked_changes=message['tracked_changes'],
+model=task.context.model)
+self._task_succeeded(task)
+elif message_type == 'failed':
+task = self._remove_task(task_id)
+instrumentation.apply_tracked_changes(
+tracked_changes=message['tracked_changes'],
+model=task.context.model)
+self._task_failed(task, exception=message['exception'])
+else:
+raise RuntimeError('Invalid state')
 except BaseException as e:
 self.logger.debug('Error in process executor listener: 
{0}'.format(e))
 
-def _recv_message(self):
-connection, _ = self._server_socket.accept()
-try:
-message_len, = struct.unpack(_INT_FMT, 
self._recv_bytes(connection, _INT_SIZE))
-return jsonpickle.loads(self._recv_bytes(connection, 

incubator-ariatosca git commit: ARIA-72 Rework built-in workflows to match TOSCA normative lifecycle

2017-01-24 Thread dankilman
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/master 0382b229c -> db9ae9c70


ARIA-72 Rework built-in workflows to match TOSCA normative lifecycle


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

Branch: refs/heads/master
Commit: db9ae9c70ae0703cb3f357bf53b95d1a351a8ab0
Parents: 0382b22
Author: Tal Liron 
Authored: Tue Jan 24 09:52:36 2017 +0200
Committer: Tal Liron 
Committed: Tue Jan 24 15:48:42 2017 +0200

--
 aria/orchestrator/workflows/builtin/__init__.py |  12 +-
 .../workflows/builtin/execute_operation.py  |  30 +-
 aria/orchestrator/workflows/builtin/heal.py |   4 +-
 aria/orchestrator/workflows/builtin/install.py  |  42 +--
 aria/orchestrator/workflows/builtin/start.py|  28 ++
 aria/orchestrator/workflows/builtin/stop.py |  28 ++
 .../orchestrator/workflows/builtin/uninstall.py |  41 +--
 aria/orchestrator/workflows/builtin/utils.py|  70 +
 .../orchestrator/workflows/builtin/workflows.py | 280 +++
 tests/mock/operations.py|  48 +++-
 .../orchestrator/workflows/builtin/__init__.py  |  39 +--
 .../orchestrator/workflows/builtin/test_heal.py |   2 +
 tests/orchestrator/workflows/core/test_task.py  |   6 +-
 .../test_task_graph_into_exececution_graph.py   |   2 +-
 14 files changed, 342 insertions(+), 290 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/db9ae9c7/aria/orchestrator/workflows/builtin/__init__.py
--
diff --git a/aria/orchestrator/workflows/builtin/__init__.py 
b/aria/orchestrator/workflows/builtin/__init__.py
index 0449a8e..d43a962 100644
--- a/aria/orchestrator/workflows/builtin/__init__.py
+++ b/aria/orchestrator/workflows/builtin/__init__.py
@@ -19,13 +19,17 @@ A set of builtin workflows
 
 from .install import install
 from .uninstall import uninstall
-from .execute_operation import execute_operation
-from .heal import heal
+from .start import start
+from .stop import stop
+
+
+BUILTIN_WORKFLOWS = ('install', 'uninstall', 'start', 'stop')
 
 
 __all__ = [
+'BUILTIN_WORKFLOWS',
 'install',
 'uninstall',
-'execute_operation',
-'heal',
+'start',
+'stop'
 ]

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/db9ae9c7/aria/orchestrator/workflows/builtin/execute_operation.py
--
diff --git a/aria/orchestrator/workflows/builtin/execute_operation.py 
b/aria/orchestrator/workflows/builtin/execute_operation.py
index ddbb8e7..e76993d 100644
--- a/aria/orchestrator/workflows/builtin/execute_operation.py
+++ b/aria/orchestrator/workflows/builtin/execute_operation.py
@@ -17,9 +17,8 @@
 Builtin execute_operation workflow
 """
 
-from aria import workflow
-
-from .workflows import execute_operation_on_instance
+from ..api.task import OperationTask
+from ... import workflow
 
 
 @workflow
@@ -68,7 +67,7 @@ def execute_operation(
 # registering actual tasks to sequences
 for node_instance in filtered_node_instances:
 graph.add_tasks(
-execute_operation_on_instance(
+_create_node_instance_task(
 node_instance=node_instance,
 operation=operation,
 operation_kwargs=operation_kwargs,
@@ -102,3 +101,26 @@ def _filter_node_instances(context, node_ids=(), 
node_instance_ids=(), type_name
 _is_node_instance_by_id(node_instance.id),
 _is_node_by_type(node_instance.node.type_hierarchy))):
 yield node_instance
+
+
+def _create_node_instance_task(
+node_instance,
+operation,
+operation_kwargs,
+allow_kwargs_override):
+"""
+A workflow which executes a single operation
+:param node_instance: the node instance to install
+:param basestring operation: the operation name
+:param dict operation_kwargs:
+:param bool allow_kwargs_override:
+:return:
+"""
+
+if allow_kwargs_override is not None:
+operation_kwargs['allow_kwargs_override'] = allow_kwargs_override
+
+return OperationTask.node_instance(
+instance=node_instance,
+name=operation,
+inputs=operation_kwargs)

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/db9ae9c7/aria/orchestrator/workflows/builtin/heal.py
--
diff --git a/aria/orchestrator/workflows/builtin/heal.py 
b/aria/orchestrator/workflows/builtin/heal.py
index 

incubator-ariatosca git commit: ARIA-74 Add process executor extension registration hooks

2017-01-24 Thread dankilman
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/master eaf997484 -> 0382b229c


ARIA-74 Add process executor extension registration hooks


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

Branch: refs/heads/master
Commit: 0382b229c8eddcbf95ea7792b2bdcd9d9dda303b
Parents: eaf9974
Author: Dan Kilman 
Authored: Mon Jan 23 16:55:41 2017 +0200
Committer: Dan Kilman 
Committed: Mon Jan 23 19:21:32 2017 +0200

--
 aria/extension.py   | 15 
 aria/orchestrator/plugin.py |  9 ++-
 aria/orchestrator/workflows/executor/process.py |  5 ++
 .../executor/test_process_executor_extension.py | 80 
 4 files changed, 106 insertions(+), 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/0382b229/aria/extension.py
--
diff --git a/aria/extension.py b/aria/extension.py
index ddb7c25..4dba74f 100644
--- a/aria/extension.py
+++ b/aria/extension.py
@@ -118,8 +118,23 @@ class _ParserExtensionRegistration(_ExtensionRegistration):
 parser = _ParserExtensionRegistration()
 
 
+class _ProcessExecutorExtensionRegistration(_ExtensionRegistration):
+"""Process executor extension class decorator"""
+
+@_registrar
+def decorate(self):
+"""
+The operation function executed by the process executor will be 
decorated with the function
+returned from decorate().
+"""
+return []
+
+process_executor = _ProcessExecutorExtensionRegistration()
+
+
 def init():
 """
 Initialize all registrars by calling all registered functions
 """
 parser.init()
+process_executor.init()

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/0382b229/aria/orchestrator/plugin.py
--
diff --git a/aria/orchestrator/plugin.py b/aria/orchestrator/plugin.py
index 3005756..381504e 100644
--- a/aria/orchestrator/plugin.py
+++ b/aria/orchestrator/plugin.py
@@ -39,14 +39,17 @@ class PluginManager(object):
 """
 metadata = wagon.show(source)
 cls = self._model.plugin.model_cls
+
+os_props = metadata['build_server_os_properties']
+
 plugin = cls(
 archive_name=metadata['archive_name'],
 supported_platform=metadata['supported_platform'],
 supported_py_versions=metadata['supported_python_versions'],
 # Remove suffix colon after upgrading wagon to > 0.5.0
-
distribution=metadata['build_server_os_properties']['distribution:'],
-
distribution_release=metadata['build_server_os_properties']['distribution_version'],
-
distribution_version=metadata['build_server_os_properties']['distribution_release'],
+distribution=os_props.get('distribution:') or 
os_props.get('distribution'),
+distribution_release=os_props['distribution_version'],
+distribution_version=os_props['distribution_release'],
 package_name=metadata['package_name'],
 package_version=metadata['package_version'],
 package_source=metadata['package_source'],

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/0382b229/aria/orchestrator/workflows/executor/process.py
--
diff --git a/aria/orchestrator/workflows/executor/process.py 
b/aria/orchestrator/workflows/executor/process.py
index 2cc9178..9fa0302 100644
--- a/aria/orchestrator/workflows/executor/process.py
+++ b/aria/orchestrator/workflows/executor/process.py
@@ -39,6 +39,8 @@ import Queue
 
 import jsonpickle
 
+import aria
+from aria.extension import process_executor
 from aria.utils import imports
 from aria.utils import exceptions
 from aria.orchestrator.workflows.executor import base
@@ -291,6 +293,9 @@ def _main():
 try:
 ctx = serialization.operation_context_from_dict(context_dict)
 task_func = imports.load_attribute(operation_mapping)
+aria.install_aria_extensions()
+for decorate in process_executor.decorate():
+task_func = decorate(task_func)
 task_func(ctx=ctx, **operation_inputs)
 messenger.succeeded(tracked_changes=instrument.tracked_changes)
 except BaseException as e:

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/0382b229/tests/orchestrator/workflows/executor/test_process_executor_extension.py

incubator-ariatosca git commit: ARIA-74 Add process executor extension registration hooks [Forced Update!]

2017-01-23 Thread dankilman
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-74-process-executor-hook 90a71b371 -> 0382b229c (forced 
update)


ARIA-74 Add process executor extension registration hooks


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

Branch: refs/heads/ARIA-74-process-executor-hook
Commit: 0382b229c8eddcbf95ea7792b2bdcd9d9dda303b
Parents: eaf9974
Author: Dan Kilman 
Authored: Mon Jan 23 16:55:41 2017 +0200
Committer: Dan Kilman 
Committed: Mon Jan 23 19:21:32 2017 +0200

--
 aria/extension.py   | 15 
 aria/orchestrator/plugin.py |  9 ++-
 aria/orchestrator/workflows/executor/process.py |  5 ++
 .../executor/test_process_executor_extension.py | 80 
 4 files changed, 106 insertions(+), 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/0382b229/aria/extension.py
--
diff --git a/aria/extension.py b/aria/extension.py
index ddb7c25..4dba74f 100644
--- a/aria/extension.py
+++ b/aria/extension.py
@@ -118,8 +118,23 @@ class _ParserExtensionRegistration(_ExtensionRegistration):
 parser = _ParserExtensionRegistration()
 
 
+class _ProcessExecutorExtensionRegistration(_ExtensionRegistration):
+"""Process executor extension class decorator"""
+
+@_registrar
+def decorate(self):
+"""
+The operation function executed by the process executor will be 
decorated with the function
+returned from decorate().
+"""
+return []
+
+process_executor = _ProcessExecutorExtensionRegistration()
+
+
 def init():
 """
 Initialize all registrars by calling all registered functions
 """
 parser.init()
+process_executor.init()

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/0382b229/aria/orchestrator/plugin.py
--
diff --git a/aria/orchestrator/plugin.py b/aria/orchestrator/plugin.py
index 3005756..381504e 100644
--- a/aria/orchestrator/plugin.py
+++ b/aria/orchestrator/plugin.py
@@ -39,14 +39,17 @@ class PluginManager(object):
 """
 metadata = wagon.show(source)
 cls = self._model.plugin.model_cls
+
+os_props = metadata['build_server_os_properties']
+
 plugin = cls(
 archive_name=metadata['archive_name'],
 supported_platform=metadata['supported_platform'],
 supported_py_versions=metadata['supported_python_versions'],
 # Remove suffix colon after upgrading wagon to > 0.5.0
-
distribution=metadata['build_server_os_properties']['distribution:'],
-
distribution_release=metadata['build_server_os_properties']['distribution_version'],
-
distribution_version=metadata['build_server_os_properties']['distribution_release'],
+distribution=os_props.get('distribution:') or 
os_props.get('distribution'),
+distribution_release=os_props['distribution_version'],
+distribution_version=os_props['distribution_release'],
 package_name=metadata['package_name'],
 package_version=metadata['package_version'],
 package_source=metadata['package_source'],

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/0382b229/aria/orchestrator/workflows/executor/process.py
--
diff --git a/aria/orchestrator/workflows/executor/process.py 
b/aria/orchestrator/workflows/executor/process.py
index 2cc9178..9fa0302 100644
--- a/aria/orchestrator/workflows/executor/process.py
+++ b/aria/orchestrator/workflows/executor/process.py
@@ -39,6 +39,8 @@ import Queue
 
 import jsonpickle
 
+import aria
+from aria.extension import process_executor
 from aria.utils import imports
 from aria.utils import exceptions
 from aria.orchestrator.workflows.executor import base
@@ -291,6 +293,9 @@ def _main():
 try:
 ctx = serialization.operation_context_from_dict(context_dict)
 task_func = imports.load_attribute(operation_mapping)
+aria.install_aria_extensions()
+for decorate in process_executor.decorate():
+task_func = decorate(task_func)
 task_func(ctx=ctx, **operation_inputs)
 messenger.succeeded(tracked_changes=instrument.tracked_changes)
 except BaseException as e:


incubator-ariatosca git commit: ARIA-70 fix task plugin_name

2017-01-23 Thread dankilman
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/master 8ecf5bba9 -> eaf997484


ARIA-70 fix task plugin_name


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

Branch: refs/heads/master
Commit: eaf9974840c101a98d3a626723e37f4990e12ecb
Parents: 8ecf5bb
Author: Dan Kilman 
Authored: Sun Jan 22 20:43:40 2017 +0200
Committer: Dan Kilman 
Committed: Sun Jan 22 20:43:40 2017 +0200

--
 aria/orchestrator/workflows/core/task.py   | 1 +
 aria/storage/base_model.py | 5 +
 tests/orchestrator/workflows/core/test_task.py | 6 --
 3 files changed, 6 insertions(+), 6 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/eaf99748/aria/orchestrator/workflows/core/task.py
--
diff --git a/aria/orchestrator/workflows/core/task.py 
b/aria/orchestrator/workflows/core/task.py
index 1deb66a..4017ed0 100644
--- a/aria/orchestrator/workflows/core/task.py
+++ b/aria/orchestrator/workflows/core/task.py
@@ -135,6 +135,7 @@ class OperationTask(BaseTask):
 retry_interval=api_task.retry_interval,
 ignore_failure=api_task.ignore_failure,
 plugin=plugins[0] if plugins else None,
+plugin_name=plugin.get('name'),
 execution=self._workflow_context.execution,
 runs_on=api_task.runs_on
 )

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/eaf99748/aria/storage/base_model.py
--
diff --git a/aria/storage/base_model.py b/aria/storage/base_model.py
index 8566e66..f7d0e5b 100644
--- a/aria/storage/base_model.py
+++ b/aria/storage/base_model.py
@@ -662,10 +662,6 @@ class TaskBase(ModelMixin):
 return cls.one_to_many_relationship('plugin_fk')
 
 @declared_attr
-def plugin_name(cls):
-return association_proxy('plugin', 'name')
-
-@declared_attr
 def execution_fk(cls):
 return cls.foreign_key(ExecutionBase, nullable=True)
 
@@ -723,6 +719,7 @@ class TaskBase(ModelMixin):
 # Operation specific fields
 operation_mapping = Column(String)
 inputs = Column(Dict)
+plugin_name = Column(String)
 _runs_on = Column(Enum(*RUNS_ON, name='runs_on'), name='runs_on')
 
 @property

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/eaf99748/tests/orchestrator/workflows/core/test_task.py
--
diff --git a/tests/orchestrator/workflows/core/test_task.py 
b/tests/orchestrator/workflows/core/test_task.py
index 020de32..34088f5 100644
--- a/tests/orchestrator/workflows/core/test_task.py
+++ b/tests/orchestrator/workflows/core/test_task.py
@@ -63,12 +63,14 @@ class TestOperationTask(object):
 node_instance = ctx.model.node_instance.get_by_name(
 mock.models.DEPENDENCY_NODE_INSTANCE_NAME)
 node = node_instance.node
-node.plugins = [{'name': 'plugin1',
+plugin_name = 'plugin1'
+node.plugins = [{'name': plugin_name,
  'package_name': 'p1',
  'package_version': '0.1'}]
-node.operations['aria.interfaces.lifecycle.create'] = {'plugin': 
'plugin1'}
+node.operations['aria.interfaces.lifecycle.create'] = {'plugin': 
plugin_name}
 api_task, core_task = self._create_node_operation_task(ctx, 
node_instance)
 storage_task = ctx.model.task.get_by_name(core_task.name)
+assert storage_task.plugin_name == plugin_name
 assert storage_task.execution_name == ctx.execution.name
 assert storage_task.runs_on.id == core_task.context.node_instance.id
 assert core_task.model_task == storage_task



[GitHub] incubator-ariatosca pull request #51: ARIA-70 fix task plugin_name

2017-01-22 Thread dankilman
GitHub user dankilman opened a pull request:

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

ARIA-70 fix task plugin_name



You can merge this pull request into a Git repository by running:

$ git pull https://github.com/apache/incubator-ariatosca 
ARIA-70-fix-task-plugin-name

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/incubator-ariatosca/pull/51.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 #51


commit eaf9974840c101a98d3a626723e37f4990e12ecb
Author: Dan Kilman <d...@gigaspaces.com>
Date:   2017-01-22T18:43:40Z

ARIA-70 fix task plugin_name




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


incubator-ariatosca git commit: ARIA-70 fix task plugin_name

2017-01-22 Thread dankilman
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-70-fix-task-plugin-name [created] eaf997484


ARIA-70 fix task plugin_name


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

Branch: refs/heads/ARIA-70-fix-task-plugin-name
Commit: eaf9974840c101a98d3a626723e37f4990e12ecb
Parents: 8ecf5bb
Author: Dan Kilman 
Authored: Sun Jan 22 20:43:40 2017 +0200
Committer: Dan Kilman 
Committed: Sun Jan 22 20:43:40 2017 +0200

--
 aria/orchestrator/workflows/core/task.py   | 1 +
 aria/storage/base_model.py | 5 +
 tests/orchestrator/workflows/core/test_task.py | 6 --
 3 files changed, 6 insertions(+), 6 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/eaf99748/aria/orchestrator/workflows/core/task.py
--
diff --git a/aria/orchestrator/workflows/core/task.py 
b/aria/orchestrator/workflows/core/task.py
index 1deb66a..4017ed0 100644
--- a/aria/orchestrator/workflows/core/task.py
+++ b/aria/orchestrator/workflows/core/task.py
@@ -135,6 +135,7 @@ class OperationTask(BaseTask):
 retry_interval=api_task.retry_interval,
 ignore_failure=api_task.ignore_failure,
 plugin=plugins[0] if plugins else None,
+plugin_name=plugin.get('name'),
 execution=self._workflow_context.execution,
 runs_on=api_task.runs_on
 )

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/eaf99748/aria/storage/base_model.py
--
diff --git a/aria/storage/base_model.py b/aria/storage/base_model.py
index 8566e66..f7d0e5b 100644
--- a/aria/storage/base_model.py
+++ b/aria/storage/base_model.py
@@ -662,10 +662,6 @@ class TaskBase(ModelMixin):
 return cls.one_to_many_relationship('plugin_fk')
 
 @declared_attr
-def plugin_name(cls):
-return association_proxy('plugin', 'name')
-
-@declared_attr
 def execution_fk(cls):
 return cls.foreign_key(ExecutionBase, nullable=True)
 
@@ -723,6 +719,7 @@ class TaskBase(ModelMixin):
 # Operation specific fields
 operation_mapping = Column(String)
 inputs = Column(Dict)
+plugin_name = Column(String)
 _runs_on = Column(Enum(*RUNS_ON, name='runs_on'), name='runs_on')
 
 @property

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/eaf99748/tests/orchestrator/workflows/core/test_task.py
--
diff --git a/tests/orchestrator/workflows/core/test_task.py 
b/tests/orchestrator/workflows/core/test_task.py
index 020de32..34088f5 100644
--- a/tests/orchestrator/workflows/core/test_task.py
+++ b/tests/orchestrator/workflows/core/test_task.py
@@ -63,12 +63,14 @@ class TestOperationTask(object):
 node_instance = ctx.model.node_instance.get_by_name(
 mock.models.DEPENDENCY_NODE_INSTANCE_NAME)
 node = node_instance.node
-node.plugins = [{'name': 'plugin1',
+plugin_name = 'plugin1'
+node.plugins = [{'name': plugin_name,
  'package_name': 'p1',
  'package_version': '0.1'}]
-node.operations['aria.interfaces.lifecycle.create'] = {'plugin': 
'plugin1'}
+node.operations['aria.interfaces.lifecycle.create'] = {'plugin': 
plugin_name}
 api_task, core_task = self._create_node_operation_task(ctx, 
node_instance)
 storage_task = ctx.model.task.get_by_name(core_task.name)
+assert storage_task.plugin_name == plugin_name
 assert storage_task.execution_name == ctx.execution.name
 assert storage_task.runs_on.id == core_task.context.node_instance.id
 assert core_task.model_task == storage_task



[incubator-ariatosca] Git Push Summary

2017-01-19 Thread dankilman
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-46-execution-plugin [deleted] c4429dd59


[2/2] incubator-ariatosca git commit: ARIA-46 Execution plugin

2017-01-19 Thread dankilman
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/c4429dd5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/c4429dd5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/c4429dd5

Branch: refs/heads/master
Commit: c4429dd59a80bd6e58ba3bec4a2528eeda27a897
Parents: 385b209
Author: Dan Kilman 
Authored: Tue Jan 3 17:00:46 2017 +0200
Committer: Dan Kilman 
Committed: Thu Jan 19 18:13:51 2017 +0200

--
 appveyor.yml|   2 +-
 aria/orchestrator/context/common.py |   4 +-
 aria/orchestrator/context/operation.py  |   5 +-
 aria/orchestrator/exceptions.py |   2 +-
 aria/orchestrator/execution_plugin/__init__.py  |  33 ++
 aria/orchestrator/execution_plugin/common.py| 150 +
 aria/orchestrator/execution_plugin/constants.py |  51 ++
 .../execution_plugin/ctx_proxy/__init__.py  |  16 +
 .../execution_plugin/ctx_proxy/client.py| 105 
 .../execution_plugin/ctx_proxy/server.py| 239 
 .../execution_plugin/environment_globals.py |  60 ++
 .../orchestrator/execution_plugin/exceptions.py |  38 ++
 aria/orchestrator/execution_plugin/local.py | 125 
 .../orchestrator/execution_plugin/operations.py |  63 ++
 .../execution_plugin/ssh/__init__.py|  14 +
 .../execution_plugin/ssh/operations.py  | 192 ++
 .../orchestrator/execution_plugin/ssh/tunnel.py |  91 +++
 aria/orchestrator/workflows/api/task.py |  12 +-
 aria/orchestrator/workflows/core/engine.py  |   1 -
 aria/orchestrator/workflows/core/task.py|   3 +-
 aria/orchestrator/workflows/executor/process.py |   3 +-
 aria/storage/base_model.py  |  26 +-
 aria/storage/filesystem_rapi.py |   2 +-
 aria/utils/exceptions.py|  19 +
 requirements.txt|   5 +
 setup.py|   9 +-
 tests/orchestrator/execution_plugin/__init__.py |  14 +
 .../execution_plugin/test_common.py | 193 ++
 .../execution_plugin/test_ctx_proxy_server.py   | 359 
 .../execution_plugin/test_global_ctx.py |  28 +
 .../orchestrator/execution_plugin/test_local.py | 587 +++
 tests/orchestrator/execution_plugin/test_ssh.py | 481 +++
 tests/orchestrator/workflows/api/test_task.py   |   5 +
 tests/orchestrator/workflows/core/test_task.py  |  38 +-
 tests/orchestrator/workflows/helpers.py |  37 ++
 tests/resources/scripts/test_ssh.sh |  81 +++
 tests/test_logger.py|   5 +-
 tests/utils/test_exceptions.py  |  73 +++
 tox.ini |   7 +
 39 files changed, 3150 insertions(+), 28 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/c4429dd5/appveyor.yml
--
diff --git a/appveyor.yml b/appveyor.yml
index 3ea8635..cb1ae42 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -3,7 +3,7 @@ environment:
   TOX_ENV: pywin
 
   matrix:
-- PYTHON: C:\Python27
+- PYTHON: "C:\\Python27"
   PYTHON_VERSION: 2.7.8
   PYTHON_ARCH: 32
 

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/c4429dd5/aria/orchestrator/context/common.py
--
diff --git a/aria/orchestrator/context/common.py 
b/aria/orchestrator/context/common.py
index 53844e8..691c17d 100644
--- a/aria/orchestrator/context/common.py
+++ b/aria/orchestrator/context/common.py
@@ -113,9 +113,7 @@ class BaseContext(logger.LoggerMixin):
 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.get_resource(path=path)
 resource_content = 
self._render_resource(resource_content=resource_content,
  variables=variables)
 with open(destination, 'wb') as f:

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/c4429dd5/aria/orchestrator/context/operation.py
--
diff --git a/aria/orchestrator/context/operation.py 
b/aria/orchestrator/context/operation.py
index 19bb73a..b33d107 100644
--- a/aria/orchestrator/context/operation.py
+++ b/aria/orchestrator/context/operation.py
@@ -42,6 +42,7 @@ class 

[1/2] incubator-ariatosca git commit: ARIA-46 Execution plugin

2017-01-19 Thread dankilman
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/master 385b209db -> c4429dd59


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/c4429dd5/tests/orchestrator/execution_plugin/test_ctx_proxy_server.py
--
diff --git a/tests/orchestrator/execution_plugin/test_ctx_proxy_server.py 
b/tests/orchestrator/execution_plugin/test_ctx_proxy_server.py
new file mode 100644
index 000..98ceff9
--- /dev/null
+++ b/tests/orchestrator/execution_plugin/test_ctx_proxy_server.py
@@ -0,0 +1,359 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import os
+import time
+import sys
+import subprocess
+import StringIO
+
+import pytest
+
+from aria.orchestrator.execution_plugin import ctx_proxy
+
+
+class TestCtxProxy(object):
+
+def test_attribute_access(self, server):
+response = self.request(server, 'stub_attr', 'some_property')
+assert response == 'some_value'
+
+def test_sugared_attribute_access(self, server):
+response = self.request(server, 'stub-attr', 'some-property')
+assert response == 'some_value'
+
+def test_dict_prop_access_get_key(self, server):
+response = self.request(server, 'node', 'properties', 'prop1')
+assert response == 'value1'
+
+def test_dict_prop_access_get_key_nested(self, server):
+response = self.request(server, 'node', 'properties', 
'prop2.nested_prop1')
+assert response == 'nested_value1'
+
+def test_dict_prop_access_get_with_list_index(self, server):
+response = self.request(server, 'node', 'properties', 'prop3[2].value')
+assert response == 'value_2'
+
+def test_dict_prop_access_set(self, server, ctx):
+self.request(server, 'node', 'properties', 'prop4.key', 'new_value')
+self.request(server, 'node', 'properties', 'prop3[2].value', 
'new_value_2')
+self.request(server, 'node', 'properties', 'prop4.some.new.path',
+ 'some_new_value')
+assert ctx.node.properties['prop4']['key'] == 'new_value'
+assert ctx.node.properties['prop3'][2]['value'] == 'new_value_2'
+assert ctx.node.properties['prop4']['some']['new']['path'] == 
'some_new_value'
+
+def test_illegal_dict_access(self, server):
+self.request(server, 'node', 'properties', 'prop4.key', 'new_value')
+with pytest.raises(RuntimeError):
+self.request(server, 'node', 'properties', 'prop4.key', 
'new_value', 'what')
+
+def test_method_invocation(self, server):
+args = ['arg1', 'arg2', 'arg3']
+response_args = self.request(server, 'stub-method', *args)
+assert response_args == args
+
+def test_method_invocation_no_args(self, server):
+response = self.request(server, 'stub-method')
+assert response == []
+
+def test_method_invocation_kwargs(self, server):
+arg1 = 'arg1'
+arg2 = 'arg2'
+arg4 = 'arg4_override'
+arg5 = 'arg5'
+kwargs = dict(
+arg4=arg4,
+arg5=arg5)
+response = self.request(server, 'stub_args', arg1, arg2, kwargs)
+assert response == dict(
+arg1=arg1,
+arg2=arg2,
+arg3='arg3',
+arg4=arg4,
+args=[],
+kwargs=dict(
+arg5=arg5))
+
+def test_empty_return_value(self, server):
+response = self.request(server, 'stub_none')
+assert response is None
+
+def test_client_request_timeout(self, server):
+with pytest.raises(IOError):
+ctx_proxy.client._client_request(server.socket_url,
+ args=['stub-sleep', '0.5'],
+ timeout=0.1)
+
+def test_processing_exception(self, server):
+with pytest.raises(ctx_proxy.client._RequestError):
+self.request(server, 'property_that_does_not_exist')
+
+def test_not_json_serializable(self, server):
+with pytest.raises(ctx_proxy.client._RequestError):
+self.request(server, 'logger')
+
+def test_no_string_arg(self, server):
+args = ['stub_method', 1, 2]
+response = 

[1/2] incubator-ariatosca git commit: ARIA-46 Execution plugin [Forced Update!]

2017-01-19 Thread dankilman
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-46-execution-plugin 433d55ea6 -> c4429dd59 (forced update)


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/c4429dd5/tests/orchestrator/execution_plugin/test_ctx_proxy_server.py
--
diff --git a/tests/orchestrator/execution_plugin/test_ctx_proxy_server.py 
b/tests/orchestrator/execution_plugin/test_ctx_proxy_server.py
new file mode 100644
index 000..98ceff9
--- /dev/null
+++ b/tests/orchestrator/execution_plugin/test_ctx_proxy_server.py
@@ -0,0 +1,359 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import os
+import time
+import sys
+import subprocess
+import StringIO
+
+import pytest
+
+from aria.orchestrator.execution_plugin import ctx_proxy
+
+
+class TestCtxProxy(object):
+
+def test_attribute_access(self, server):
+response = self.request(server, 'stub_attr', 'some_property')
+assert response == 'some_value'
+
+def test_sugared_attribute_access(self, server):
+response = self.request(server, 'stub-attr', 'some-property')
+assert response == 'some_value'
+
+def test_dict_prop_access_get_key(self, server):
+response = self.request(server, 'node', 'properties', 'prop1')
+assert response == 'value1'
+
+def test_dict_prop_access_get_key_nested(self, server):
+response = self.request(server, 'node', 'properties', 
'prop2.nested_prop1')
+assert response == 'nested_value1'
+
+def test_dict_prop_access_get_with_list_index(self, server):
+response = self.request(server, 'node', 'properties', 'prop3[2].value')
+assert response == 'value_2'
+
+def test_dict_prop_access_set(self, server, ctx):
+self.request(server, 'node', 'properties', 'prop4.key', 'new_value')
+self.request(server, 'node', 'properties', 'prop3[2].value', 
'new_value_2')
+self.request(server, 'node', 'properties', 'prop4.some.new.path',
+ 'some_new_value')
+assert ctx.node.properties['prop4']['key'] == 'new_value'
+assert ctx.node.properties['prop3'][2]['value'] == 'new_value_2'
+assert ctx.node.properties['prop4']['some']['new']['path'] == 
'some_new_value'
+
+def test_illegal_dict_access(self, server):
+self.request(server, 'node', 'properties', 'prop4.key', 'new_value')
+with pytest.raises(RuntimeError):
+self.request(server, 'node', 'properties', 'prop4.key', 
'new_value', 'what')
+
+def test_method_invocation(self, server):
+args = ['arg1', 'arg2', 'arg3']
+response_args = self.request(server, 'stub-method', *args)
+assert response_args == args
+
+def test_method_invocation_no_args(self, server):
+response = self.request(server, 'stub-method')
+assert response == []
+
+def test_method_invocation_kwargs(self, server):
+arg1 = 'arg1'
+arg2 = 'arg2'
+arg4 = 'arg4_override'
+arg5 = 'arg5'
+kwargs = dict(
+arg4=arg4,
+arg5=arg5)
+response = self.request(server, 'stub_args', arg1, arg2, kwargs)
+assert response == dict(
+arg1=arg1,
+arg2=arg2,
+arg3='arg3',
+arg4=arg4,
+args=[],
+kwargs=dict(
+arg5=arg5))
+
+def test_empty_return_value(self, server):
+response = self.request(server, 'stub_none')
+assert response is None
+
+def test_client_request_timeout(self, server):
+with pytest.raises(IOError):
+ctx_proxy.client._client_request(server.socket_url,
+ args=['stub-sleep', '0.5'],
+ timeout=0.1)
+
+def test_processing_exception(self, server):
+with pytest.raises(ctx_proxy.client._RequestError):
+self.request(server, 'property_that_does_not_exist')
+
+def test_not_json_serializable(self, server):
+with pytest.raises(ctx_proxy.client._RequestError):
+self.request(server, 'logger')
+
+def test_no_string_arg(self, server):
+args = ['stub_method', 1, 2]
+   

[2/2] incubator-ariatosca git commit: ARIA-46 Execution plugin

2017-01-19 Thread dankilman
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/c4429dd5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/c4429dd5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/c4429dd5

Branch: refs/heads/ARIA-46-execution-plugin
Commit: c4429dd59a80bd6e58ba3bec4a2528eeda27a897
Parents: 385b209
Author: Dan Kilman 
Authored: Tue Jan 3 17:00:46 2017 +0200
Committer: Dan Kilman 
Committed: Thu Jan 19 18:13:51 2017 +0200

--
 appveyor.yml|   2 +-
 aria/orchestrator/context/common.py |   4 +-
 aria/orchestrator/context/operation.py  |   5 +-
 aria/orchestrator/exceptions.py |   2 +-
 aria/orchestrator/execution_plugin/__init__.py  |  33 ++
 aria/orchestrator/execution_plugin/common.py| 150 +
 aria/orchestrator/execution_plugin/constants.py |  51 ++
 .../execution_plugin/ctx_proxy/__init__.py  |  16 +
 .../execution_plugin/ctx_proxy/client.py| 105 
 .../execution_plugin/ctx_proxy/server.py| 239 
 .../execution_plugin/environment_globals.py |  60 ++
 .../orchestrator/execution_plugin/exceptions.py |  38 ++
 aria/orchestrator/execution_plugin/local.py | 125 
 .../orchestrator/execution_plugin/operations.py |  63 ++
 .../execution_plugin/ssh/__init__.py|  14 +
 .../execution_plugin/ssh/operations.py  | 192 ++
 .../orchestrator/execution_plugin/ssh/tunnel.py |  91 +++
 aria/orchestrator/workflows/api/task.py |  12 +-
 aria/orchestrator/workflows/core/engine.py  |   1 -
 aria/orchestrator/workflows/core/task.py|   3 +-
 aria/orchestrator/workflows/executor/process.py |   3 +-
 aria/storage/base_model.py  |  26 +-
 aria/storage/filesystem_rapi.py |   2 +-
 aria/utils/exceptions.py|  19 +
 requirements.txt|   5 +
 setup.py|   9 +-
 tests/orchestrator/execution_plugin/__init__.py |  14 +
 .../execution_plugin/test_common.py | 193 ++
 .../execution_plugin/test_ctx_proxy_server.py   | 359 
 .../execution_plugin/test_global_ctx.py |  28 +
 .../orchestrator/execution_plugin/test_local.py | 587 +++
 tests/orchestrator/execution_plugin/test_ssh.py | 481 +++
 tests/orchestrator/workflows/api/test_task.py   |   5 +
 tests/orchestrator/workflows/core/test_task.py  |  38 +-
 tests/orchestrator/workflows/helpers.py |  37 ++
 tests/resources/scripts/test_ssh.sh |  81 +++
 tests/test_logger.py|   5 +-
 tests/utils/test_exceptions.py  |  73 +++
 tox.ini |   7 +
 39 files changed, 3150 insertions(+), 28 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/c4429dd5/appveyor.yml
--
diff --git a/appveyor.yml b/appveyor.yml
index 3ea8635..cb1ae42 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -3,7 +3,7 @@ environment:
   TOX_ENV: pywin
 
   matrix:
-- PYTHON: C:\Python27
+- PYTHON: "C:\\Python27"
   PYTHON_VERSION: 2.7.8
   PYTHON_ARCH: 32
 

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/c4429dd5/aria/orchestrator/context/common.py
--
diff --git a/aria/orchestrator/context/common.py 
b/aria/orchestrator/context/common.py
index 53844e8..691c17d 100644
--- a/aria/orchestrator/context/common.py
+++ b/aria/orchestrator/context/common.py
@@ -113,9 +113,7 @@ class BaseContext(logger.LoggerMixin):
 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.get_resource(path=path)
 resource_content = 
self._render_resource(resource_content=resource_content,
  variables=variables)
 with open(destination, 'wb') as f:

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/c4429dd5/aria/orchestrator/context/operation.py
--
diff --git a/aria/orchestrator/context/operation.py 
b/aria/orchestrator/context/operation.py
index 19bb73a..b33d107 100644
--- a/aria/orchestrator/context/operation.py
+++ b/aria/orchestrator/context/operation.py
@@ -42,6 +42,7 @@ class 

[2/2] incubator-ariatosca git commit: ARIA-46 Execution plugin

2017-01-19 Thread dankilman
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/433d55ea
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/433d55ea
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/433d55ea

Branch: refs/heads/ARIA-46-execution-plugin
Commit: 433d55ea6ec9760fe5aa5e2c8f947d24d929d4ee
Parents: 385b209
Author: Dan Kilman 
Authored: Tue Jan 3 17:00:46 2017 +0200
Committer: Dan Kilman 
Committed: Thu Jan 19 17:56:25 2017 +0200

--
 appveyor.yml|   2 +-
 aria/orchestrator/context/common.py |   4 +-
 aria/orchestrator/context/operation.py  |   5 +-
 aria/orchestrator/exceptions.py |   2 +-
 aria/orchestrator/execution_plugin/__init__.py  |  33 ++
 aria/orchestrator/execution_plugin/common.py| 150 +
 aria/orchestrator/execution_plugin/constants.py |  51 ++
 .../execution_plugin/ctx_proxy/__init__.py  |  16 +
 .../execution_plugin/ctx_proxy/client.py| 105 
 .../execution_plugin/ctx_proxy/server.py| 239 
 .../execution_plugin/environment_globals.py |  60 ++
 .../orchestrator/execution_plugin/exceptions.py |  38 ++
 aria/orchestrator/execution_plugin/local.py | 125 
 .../orchestrator/execution_plugin/operations.py |  63 ++
 .../execution_plugin/ssh/__init__.py|  14 +
 .../execution_plugin/ssh/operations.py  | 192 ++
 .../orchestrator/execution_plugin/ssh/tunnel.py |  91 +++
 aria/orchestrator/workflows/api/task.py |  12 +-
 aria/orchestrator/workflows/core/engine.py  |   1 -
 aria/orchestrator/workflows/core/task.py|   3 +-
 aria/orchestrator/workflows/executor/process.py |   3 +-
 aria/storage/base_model.py  |  26 +-
 aria/storage/filesystem_rapi.py |   2 +-
 aria/utils/exceptions.py|  19 +
 requirements.txt|   4 +
 setup.py|   9 +-
 tests/orchestrator/execution_plugin/__init__.py |  14 +
 .../execution_plugin/test_common.py | 193 ++
 .../execution_plugin/test_ctx_proxy_server.py   | 359 
 .../execution_plugin/test_global_ctx.py |  28 +
 .../orchestrator/execution_plugin/test_local.py | 587 +++
 tests/orchestrator/execution_plugin/test_ssh.py | 481 +++
 tests/orchestrator/workflows/api/test_task.py   |   5 +
 tests/orchestrator/workflows/core/test_task.py  |  38 +-
 tests/orchestrator/workflows/helpers.py |  37 ++
 tests/resources/scripts/test_ssh.sh |  81 +++
 tests/test_logger.py|   5 +-
 tests/utils/test_exceptions.py  |  73 +++
 tox.ini |   7 +
 39 files changed, 3149 insertions(+), 28 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/433d55ea/appveyor.yml
--
diff --git a/appveyor.yml b/appveyor.yml
index 3ea8635..cb1ae42 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -3,7 +3,7 @@ environment:
   TOX_ENV: pywin
 
   matrix:
-- PYTHON: C:\Python27
+- PYTHON: "C:\\Python27"
   PYTHON_VERSION: 2.7.8
   PYTHON_ARCH: 32
 

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/433d55ea/aria/orchestrator/context/common.py
--
diff --git a/aria/orchestrator/context/common.py 
b/aria/orchestrator/context/common.py
index 53844e8..691c17d 100644
--- a/aria/orchestrator/context/common.py
+++ b/aria/orchestrator/context/common.py
@@ -113,9 +113,7 @@ class BaseContext(logger.LoggerMixin):
 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.get_resource(path=path)
 resource_content = 
self._render_resource(resource_content=resource_content,
  variables=variables)
 with open(destination, 'wb') as f:

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/433d55ea/aria/orchestrator/context/operation.py
--
diff --git a/aria/orchestrator/context/operation.py 
b/aria/orchestrator/context/operation.py
index 19bb73a..b33d107 100644
--- a/aria/orchestrator/context/operation.py
+++ b/aria/orchestrator/context/operation.py
@@ -42,6 +42,7 @@ class 

[1/2] incubator-ariatosca git commit: ARIA-46 Execution plugin [Forced Update!]

2017-01-19 Thread dankilman
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-46-execution-plugin a48d31c74 -> 433d55ea6 (forced update)


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/433d55ea/tests/orchestrator/execution_plugin/test_ctx_proxy_server.py
--
diff --git a/tests/orchestrator/execution_plugin/test_ctx_proxy_server.py 
b/tests/orchestrator/execution_plugin/test_ctx_proxy_server.py
new file mode 100644
index 000..98ceff9
--- /dev/null
+++ b/tests/orchestrator/execution_plugin/test_ctx_proxy_server.py
@@ -0,0 +1,359 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import os
+import time
+import sys
+import subprocess
+import StringIO
+
+import pytest
+
+from aria.orchestrator.execution_plugin import ctx_proxy
+
+
+class TestCtxProxy(object):
+
+def test_attribute_access(self, server):
+response = self.request(server, 'stub_attr', 'some_property')
+assert response == 'some_value'
+
+def test_sugared_attribute_access(self, server):
+response = self.request(server, 'stub-attr', 'some-property')
+assert response == 'some_value'
+
+def test_dict_prop_access_get_key(self, server):
+response = self.request(server, 'node', 'properties', 'prop1')
+assert response == 'value1'
+
+def test_dict_prop_access_get_key_nested(self, server):
+response = self.request(server, 'node', 'properties', 
'prop2.nested_prop1')
+assert response == 'nested_value1'
+
+def test_dict_prop_access_get_with_list_index(self, server):
+response = self.request(server, 'node', 'properties', 'prop3[2].value')
+assert response == 'value_2'
+
+def test_dict_prop_access_set(self, server, ctx):
+self.request(server, 'node', 'properties', 'prop4.key', 'new_value')
+self.request(server, 'node', 'properties', 'prop3[2].value', 
'new_value_2')
+self.request(server, 'node', 'properties', 'prop4.some.new.path',
+ 'some_new_value')
+assert ctx.node.properties['prop4']['key'] == 'new_value'
+assert ctx.node.properties['prop3'][2]['value'] == 'new_value_2'
+assert ctx.node.properties['prop4']['some']['new']['path'] == 
'some_new_value'
+
+def test_illegal_dict_access(self, server):
+self.request(server, 'node', 'properties', 'prop4.key', 'new_value')
+with pytest.raises(RuntimeError):
+self.request(server, 'node', 'properties', 'prop4.key', 
'new_value', 'what')
+
+def test_method_invocation(self, server):
+args = ['arg1', 'arg2', 'arg3']
+response_args = self.request(server, 'stub-method', *args)
+assert response_args == args
+
+def test_method_invocation_no_args(self, server):
+response = self.request(server, 'stub-method')
+assert response == []
+
+def test_method_invocation_kwargs(self, server):
+arg1 = 'arg1'
+arg2 = 'arg2'
+arg4 = 'arg4_override'
+arg5 = 'arg5'
+kwargs = dict(
+arg4=arg4,
+arg5=arg5)
+response = self.request(server, 'stub_args', arg1, arg2, kwargs)
+assert response == dict(
+arg1=arg1,
+arg2=arg2,
+arg3='arg3',
+arg4=arg4,
+args=[],
+kwargs=dict(
+arg5=arg5))
+
+def test_empty_return_value(self, server):
+response = self.request(server, 'stub_none')
+assert response is None
+
+def test_client_request_timeout(self, server):
+with pytest.raises(IOError):
+ctx_proxy.client._client_request(server.socket_url,
+ args=['stub-sleep', '0.5'],
+ timeout=0.1)
+
+def test_processing_exception(self, server):
+with pytest.raises(ctx_proxy.client._RequestError):
+self.request(server, 'property_that_does_not_exist')
+
+def test_not_json_serializable(self, server):
+with pytest.raises(ctx_proxy.client._RequestError):
+self.request(server, 'logger')
+
+def test_no_string_arg(self, server):
+args = ['stub_method', 1, 2]
+   

[1/2] incubator-ariatosca git commit: ARIA-46 Execution plugin [Forced Update!]

2017-01-19 Thread dankilman
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-46-execution-plugin 8ca6f51d4 -> a48d31c74 (forced update)


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/a48d31c7/tests/orchestrator/execution_plugin/test_ctx_proxy_server.py
--
diff --git a/tests/orchestrator/execution_plugin/test_ctx_proxy_server.py 
b/tests/orchestrator/execution_plugin/test_ctx_proxy_server.py
new file mode 100644
index 000..98ceff9
--- /dev/null
+++ b/tests/orchestrator/execution_plugin/test_ctx_proxy_server.py
@@ -0,0 +1,359 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import os
+import time
+import sys
+import subprocess
+import StringIO
+
+import pytest
+
+from aria.orchestrator.execution_plugin import ctx_proxy
+
+
+class TestCtxProxy(object):
+
+def test_attribute_access(self, server):
+response = self.request(server, 'stub_attr', 'some_property')
+assert response == 'some_value'
+
+def test_sugared_attribute_access(self, server):
+response = self.request(server, 'stub-attr', 'some-property')
+assert response == 'some_value'
+
+def test_dict_prop_access_get_key(self, server):
+response = self.request(server, 'node', 'properties', 'prop1')
+assert response == 'value1'
+
+def test_dict_prop_access_get_key_nested(self, server):
+response = self.request(server, 'node', 'properties', 
'prop2.nested_prop1')
+assert response == 'nested_value1'
+
+def test_dict_prop_access_get_with_list_index(self, server):
+response = self.request(server, 'node', 'properties', 'prop3[2].value')
+assert response == 'value_2'
+
+def test_dict_prop_access_set(self, server, ctx):
+self.request(server, 'node', 'properties', 'prop4.key', 'new_value')
+self.request(server, 'node', 'properties', 'prop3[2].value', 
'new_value_2')
+self.request(server, 'node', 'properties', 'prop4.some.new.path',
+ 'some_new_value')
+assert ctx.node.properties['prop4']['key'] == 'new_value'
+assert ctx.node.properties['prop3'][2]['value'] == 'new_value_2'
+assert ctx.node.properties['prop4']['some']['new']['path'] == 
'some_new_value'
+
+def test_illegal_dict_access(self, server):
+self.request(server, 'node', 'properties', 'prop4.key', 'new_value')
+with pytest.raises(RuntimeError):
+self.request(server, 'node', 'properties', 'prop4.key', 
'new_value', 'what')
+
+def test_method_invocation(self, server):
+args = ['arg1', 'arg2', 'arg3']
+response_args = self.request(server, 'stub-method', *args)
+assert response_args == args
+
+def test_method_invocation_no_args(self, server):
+response = self.request(server, 'stub-method')
+assert response == []
+
+def test_method_invocation_kwargs(self, server):
+arg1 = 'arg1'
+arg2 = 'arg2'
+arg4 = 'arg4_override'
+arg5 = 'arg5'
+kwargs = dict(
+arg4=arg4,
+arg5=arg5)
+response = self.request(server, 'stub_args', arg1, arg2, kwargs)
+assert response == dict(
+arg1=arg1,
+arg2=arg2,
+arg3='arg3',
+arg4=arg4,
+args=[],
+kwargs=dict(
+arg5=arg5))
+
+def test_empty_return_value(self, server):
+response = self.request(server, 'stub_none')
+assert response is None
+
+def test_client_request_timeout(self, server):
+with pytest.raises(IOError):
+ctx_proxy.client._client_request(server.socket_url,
+ args=['stub-sleep', '0.5'],
+ timeout=0.1)
+
+def test_processing_exception(self, server):
+with pytest.raises(ctx_proxy.client._RequestError):
+self.request(server, 'property_that_does_not_exist')
+
+def test_not_json_serializable(self, server):
+with pytest.raises(ctx_proxy.client._RequestError):
+self.request(server, 'logger')
+
+def test_no_string_arg(self, server):
+args = ['stub_method', 1, 2]
+   

[1/2] incubator-ariatosca git commit: ARIA-46 Execution plugin [Forced Update!]

2017-01-19 Thread dankilman
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-46-execution-plugin 1854b1787 -> 8ca6f51d4 (forced update)


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/8ca6f51d/tests/orchestrator/execution_plugin/test_ctx_proxy_server.py
--
diff --git a/tests/orchestrator/execution_plugin/test_ctx_proxy_server.py 
b/tests/orchestrator/execution_plugin/test_ctx_proxy_server.py
new file mode 100644
index 000..98ceff9
--- /dev/null
+++ b/tests/orchestrator/execution_plugin/test_ctx_proxy_server.py
@@ -0,0 +1,359 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import os
+import time
+import sys
+import subprocess
+import StringIO
+
+import pytest
+
+from aria.orchestrator.execution_plugin import ctx_proxy
+
+
+class TestCtxProxy(object):
+
+def test_attribute_access(self, server):
+response = self.request(server, 'stub_attr', 'some_property')
+assert response == 'some_value'
+
+def test_sugared_attribute_access(self, server):
+response = self.request(server, 'stub-attr', 'some-property')
+assert response == 'some_value'
+
+def test_dict_prop_access_get_key(self, server):
+response = self.request(server, 'node', 'properties', 'prop1')
+assert response == 'value1'
+
+def test_dict_prop_access_get_key_nested(self, server):
+response = self.request(server, 'node', 'properties', 
'prop2.nested_prop1')
+assert response == 'nested_value1'
+
+def test_dict_prop_access_get_with_list_index(self, server):
+response = self.request(server, 'node', 'properties', 'prop3[2].value')
+assert response == 'value_2'
+
+def test_dict_prop_access_set(self, server, ctx):
+self.request(server, 'node', 'properties', 'prop4.key', 'new_value')
+self.request(server, 'node', 'properties', 'prop3[2].value', 
'new_value_2')
+self.request(server, 'node', 'properties', 'prop4.some.new.path',
+ 'some_new_value')
+assert ctx.node.properties['prop4']['key'] == 'new_value'
+assert ctx.node.properties['prop3'][2]['value'] == 'new_value_2'
+assert ctx.node.properties['prop4']['some']['new']['path'] == 
'some_new_value'
+
+def test_illegal_dict_access(self, server):
+self.request(server, 'node', 'properties', 'prop4.key', 'new_value')
+with pytest.raises(RuntimeError):
+self.request(server, 'node', 'properties', 'prop4.key', 
'new_value', 'what')
+
+def test_method_invocation(self, server):
+args = ['arg1', 'arg2', 'arg3']
+response_args = self.request(server, 'stub-method', *args)
+assert response_args == args
+
+def test_method_invocation_no_args(self, server):
+response = self.request(server, 'stub-method')
+assert response == []
+
+def test_method_invocation_kwargs(self, server):
+arg1 = 'arg1'
+arg2 = 'arg2'
+arg4 = 'arg4_override'
+arg5 = 'arg5'
+kwargs = dict(
+arg4=arg4,
+arg5=arg5)
+response = self.request(server, 'stub_args', arg1, arg2, kwargs)
+assert response == dict(
+arg1=arg1,
+arg2=arg2,
+arg3='arg3',
+arg4=arg4,
+args=[],
+kwargs=dict(
+arg5=arg5))
+
+def test_empty_return_value(self, server):
+response = self.request(server, 'stub_none')
+assert response is None
+
+def test_client_request_timeout(self, server):
+with pytest.raises(IOError):
+ctx_proxy.client._client_request(server.socket_url,
+ args=['stub-sleep', '0.5'],
+ timeout=0.1)
+
+def test_processing_exception(self, server):
+with pytest.raises(ctx_proxy.client._RequestError):
+self.request(server, 'property_that_does_not_exist')
+
+def test_not_json_serializable(self, server):
+with pytest.raises(ctx_proxy.client._RequestError):
+self.request(server, 'logger')
+
+def test_no_string_arg(self, server):
+args = ['stub_method', 1, 2]
+   

[2/2] incubator-ariatosca git commit: ARIA-46 Execution plugin

2017-01-19 Thread dankilman
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/8ca6f51d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/8ca6f51d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/8ca6f51d

Branch: refs/heads/ARIA-46-execution-plugin
Commit: 8ca6f51d4e51de884480915388a50dc8cf6ef741
Parents: 385b209
Author: Dan Kilman 
Authored: Tue Jan 3 17:00:46 2017 +0200
Committer: Dan Kilman 
Committed: Thu Jan 19 15:01:27 2017 +0200

--
 appveyor.yml|   2 +-
 aria/orchestrator/context/common.py |   4 +-
 aria/orchestrator/context/operation.py  |   5 +-
 aria/orchestrator/exceptions.py |   2 +-
 aria/orchestrator/execution_plugin/__init__.py  |  33 ++
 aria/orchestrator/execution_plugin/common.py| 149 +
 aria/orchestrator/execution_plugin/constants.py |  51 ++
 .../execution_plugin/ctx_proxy/__init__.py  |  16 +
 .../execution_plugin/ctx_proxy/client.py| 105 
 .../execution_plugin/ctx_proxy/server.py| 239 
 .../execution_plugin/environment_globals.py |  60 ++
 .../orchestrator/execution_plugin/exceptions.py |  38 ++
 aria/orchestrator/execution_plugin/local.py | 125 
 .../orchestrator/execution_plugin/operations.py |  63 ++
 .../execution_plugin/ssh/__init__.py|  14 +
 .../execution_plugin/ssh/operations.py  | 192 ++
 .../orchestrator/execution_plugin/ssh/tunnel.py |  91 +++
 aria/orchestrator/workflows/api/task.py |  12 +-
 aria/orchestrator/workflows/core/engine.py  |   1 -
 aria/orchestrator/workflows/core/task.py|   3 +-
 aria/orchestrator/workflows/executor/process.py |   3 +-
 aria/storage/base_model.py  |  26 +-
 aria/storage/filesystem_rapi.py |   2 +-
 aria/utils/exceptions.py|  19 +
 requirements.txt|   3 +
 setup.py|   9 +-
 tests/orchestrator/execution_plugin/__init__.py |  14 +
 .../execution_plugin/test_common.py | 191 ++
 .../execution_plugin/test_ctx_proxy_server.py   | 359 
 .../execution_plugin/test_global_ctx.py |  28 +
 .../orchestrator/execution_plugin/test_local.py | 587 +++
 tests/orchestrator/execution_plugin/test_ssh.py | 481 +++
 tests/orchestrator/workflows/api/test_task.py   |   5 +
 tests/orchestrator/workflows/core/test_task.py  |  38 +-
 tests/orchestrator/workflows/helpers.py |  37 ++
 tests/resources/scripts/test_ssh.sh |  81 +++
 tests/test_logger.py|   5 +-
 tests/utils/test_exceptions.py  |  73 +++
 tox.ini |   7 +
 39 files changed, 3145 insertions(+), 28 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/8ca6f51d/appveyor.yml
--
diff --git a/appveyor.yml b/appveyor.yml
index 3ea8635..cb1ae42 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -3,7 +3,7 @@ environment:
   TOX_ENV: pywin
 
   matrix:
-- PYTHON: C:\Python27
+- PYTHON: "C:\\Python27"
   PYTHON_VERSION: 2.7.8
   PYTHON_ARCH: 32
 

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/8ca6f51d/aria/orchestrator/context/common.py
--
diff --git a/aria/orchestrator/context/common.py 
b/aria/orchestrator/context/common.py
index 53844e8..691c17d 100644
--- a/aria/orchestrator/context/common.py
+++ b/aria/orchestrator/context/common.py
@@ -113,9 +113,7 @@ class BaseContext(logger.LoggerMixin):
 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.get_resource(path=path)
 resource_content = 
self._render_resource(resource_content=resource_content,
  variables=variables)
 with open(destination, 'wb') as f:

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/8ca6f51d/aria/orchestrator/context/operation.py
--
diff --git a/aria/orchestrator/context/operation.py 
b/aria/orchestrator/context/operation.py
index 19bb73a..b33d107 100644
--- a/aria/orchestrator/context/operation.py
+++ b/aria/orchestrator/context/operation.py
@@ -42,6 +42,7 @@ class 

[GitHub] incubator-ariatosca pull request #50: ARIA-46 Execution plugin

2017-01-19 Thread dankilman
Github user dankilman commented on a diff in the pull request:

https://github.com/apache/incubator-ariatosca/pull/50#discussion_r96823733
  
--- Diff: aria/orchestrator/execution_plugin/exceptions.py ---
@@ -0,0 +1,36 @@
+# 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.
+
+
+class ProcessException(Exception):
+
--- End diff --

doc!


---
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.
---


[GitHub] incubator-ariatosca pull request #50: ARIA-46 Execution plugin

2017-01-19 Thread dankilman
Github user dankilman commented on a diff in the pull request:

https://github.com/apache/incubator-ariatosca/pull/50#discussion_r96822704
  
--- Diff: aria/orchestrator/execution_plugin/common.py ---
@@ -0,0 +1,145 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import json
+import os
+import tempfile
+
+import requests
+
+from . import constants
+from . import exceptions
+
+
+def is_windows():
+return os.name == 'nt'
+
+
+def download_script(ctx, script_path):
+split = script_path.split('://')
+schema = split[0]
+suffix = script_path.split('/')[-1]
+file_descriptor, dest_script_path = 
tempfile.mkstemp(suffix='-{0}'.format(suffix))
+os.close(file_descriptor)
+try:
+if schema in ['http', 'https']:
+response = requests.get(script_path)
+if response.status_code == 404:
+ctx.task.abort('Failed to download script: {0} (status 
code: {1})'
+   .format(script_path, response.status_code))
+content = response.text
+with open(dest_script_path, 'wb') as f:
+f.write(content)
+else:
+ctx.download_resource(destination=dest_script_path, 
path=script_path)
+except:
+os.remove(dest_script_path)
+raise
+return dest_script_path
+
+
+def create_process_config(script_path, process, operation_kwargs, 
quote_json_env_vars=False):
+"""
+update a process with it's environment variables, and return it.
+
+Get a dict representing a process and a dict representing the 
environment
+variables. Convert each environment variable to a format of
+ :
+.
+Finally, update the process with the newly formatted environment 
variables,
+and return the process.
+
+:param process: a dict representing a process
+:type process: dict
+:param operation_kwargs: a dict representing environment variables that
+should exist in the process' running environment.
+:type operation_kwargs: dict
+:return: the process updated with its environment variables.
+:rtype: dict
+"""
+process = process or {}
+env_vars = operation_kwargs.copy()
+if 'ctx' in env_vars:
+del env_vars['ctx']
+env_vars.update(process.get('env', {}))
+for k, v in env_vars.items():
+if isinstance(v, (dict, list, tuple, bool, int, float)):
+env_var_value = json.dumps(v)
+if is_windows():
+# These <k,v> environment variables will subsequently
+# be used in a subprocess.Popen() call, as the `env` 
parameter.
+# In some windows python versions, if an environment 
variable
+# name is not of type str (e.g. unicode), the Popen call 
will
+# fail.
+k = str(k)
+# The windows shell removes all double quotes - escape them
+# to still be able to pass JSON in env vars to the shell.
+env_var_value = env_var_value.replace('"', '\\"')
+if quote_json_env_vars:
+env_var_value = "'{0}'".format(env_var_value)
+env_vars[k] = env_var_value
+process['env'] = env_vars
+args = process.get('args')
+command = script_path
+command_prefix = process.get('command_prefix')
+if command_prefix:
+command = '{0} {1}'.format(command_prefix, command)
+if args:
+command = ' '.join([command] + [str(a) for a in args])
+process['command'] = command
+return process
+
+
+def patch_ctx(ctx):
+ctx._error = None
+task = ctx.task
+task._original_abort = task.abort
+task._original_retry = task.retry
+
+def _validate_legal_a

[1/2] incubator-ariatosca git commit: ARIA-46 Execution plugin [Forced Update!]

2017-01-19 Thread dankilman
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-46-execution-plugin 3e0a578d3 -> 1854b1787 (forced update)


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/1854b178/tests/orchestrator/execution_plugin/test_ctx_proxy_server.py
--
diff --git a/tests/orchestrator/execution_plugin/test_ctx_proxy_server.py 
b/tests/orchestrator/execution_plugin/test_ctx_proxy_server.py
new file mode 100644
index 000..98ceff9
--- /dev/null
+++ b/tests/orchestrator/execution_plugin/test_ctx_proxy_server.py
@@ -0,0 +1,359 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import os
+import time
+import sys
+import subprocess
+import StringIO
+
+import pytest
+
+from aria.orchestrator.execution_plugin import ctx_proxy
+
+
+class TestCtxProxy(object):
+
+def test_attribute_access(self, server):
+response = self.request(server, 'stub_attr', 'some_property')
+assert response == 'some_value'
+
+def test_sugared_attribute_access(self, server):
+response = self.request(server, 'stub-attr', 'some-property')
+assert response == 'some_value'
+
+def test_dict_prop_access_get_key(self, server):
+response = self.request(server, 'node', 'properties', 'prop1')
+assert response == 'value1'
+
+def test_dict_prop_access_get_key_nested(self, server):
+response = self.request(server, 'node', 'properties', 
'prop2.nested_prop1')
+assert response == 'nested_value1'
+
+def test_dict_prop_access_get_with_list_index(self, server):
+response = self.request(server, 'node', 'properties', 'prop3[2].value')
+assert response == 'value_2'
+
+def test_dict_prop_access_set(self, server, ctx):
+self.request(server, 'node', 'properties', 'prop4.key', 'new_value')
+self.request(server, 'node', 'properties', 'prop3[2].value', 
'new_value_2')
+self.request(server, 'node', 'properties', 'prop4.some.new.path',
+ 'some_new_value')
+assert ctx.node.properties['prop4']['key'] == 'new_value'
+assert ctx.node.properties['prop3'][2]['value'] == 'new_value_2'
+assert ctx.node.properties['prop4']['some']['new']['path'] == 
'some_new_value'
+
+def test_illegal_dict_access(self, server):
+self.request(server, 'node', 'properties', 'prop4.key', 'new_value')
+with pytest.raises(RuntimeError):
+self.request(server, 'node', 'properties', 'prop4.key', 
'new_value', 'what')
+
+def test_method_invocation(self, server):
+args = ['arg1', 'arg2', 'arg3']
+response_args = self.request(server, 'stub-method', *args)
+assert response_args == args
+
+def test_method_invocation_no_args(self, server):
+response = self.request(server, 'stub-method')
+assert response == []
+
+def test_method_invocation_kwargs(self, server):
+arg1 = 'arg1'
+arg2 = 'arg2'
+arg4 = 'arg4_override'
+arg5 = 'arg5'
+kwargs = dict(
+arg4=arg4,
+arg5=arg5)
+response = self.request(server, 'stub_args', arg1, arg2, kwargs)
+assert response == dict(
+arg1=arg1,
+arg2=arg2,
+arg3='arg3',
+arg4=arg4,
+args=[],
+kwargs=dict(
+arg5=arg5))
+
+def test_empty_return_value(self, server):
+response = self.request(server, 'stub_none')
+assert response is None
+
+def test_client_request_timeout(self, server):
+with pytest.raises(IOError):
+ctx_proxy.client._client_request(server.socket_url,
+ args=['stub-sleep', '0.5'],
+ timeout=0.1)
+
+def test_processing_exception(self, server):
+with pytest.raises(ctx_proxy.client._RequestError):
+self.request(server, 'property_that_does_not_exist')
+
+def test_not_json_serializable(self, server):
+with pytest.raises(ctx_proxy.client._RequestError):
+self.request(server, 'logger')
+
+def test_no_string_arg(self, server):
+args = ['stub_method', 1, 2]
+   

[2/2] incubator-ariatosca git commit: ARIA-46 Execution plugin

2017-01-19 Thread dankilman
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/1854b178
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/1854b178
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/1854b178

Branch: refs/heads/ARIA-46-execution-plugin
Commit: 1854b1787bbfe0cf2cd3a9f278d2ce80655aba7d
Parents: 385b209
Author: Dan Kilman 
Authored: Tue Jan 3 17:00:46 2017 +0200
Committer: Dan Kilman 
Committed: Thu Jan 19 14:16:36 2017 +0200

--
 appveyor.yml|   2 +-
 aria/orchestrator/context/common.py |   4 +-
 aria/orchestrator/context/operation.py  |   5 +-
 aria/orchestrator/exceptions.py |   2 +-
 aria/orchestrator/execution_plugin/__init__.py  |  33 ++
 aria/orchestrator/execution_plugin/common.py| 145 +
 aria/orchestrator/execution_plugin/constants.py |  51 ++
 .../execution_plugin/ctx_proxy/__init__.py  |  16 +
 .../execution_plugin/ctx_proxy/client.py| 105 
 .../execution_plugin/ctx_proxy/server.py| 239 
 .../execution_plugin/environment_globals.py |  60 ++
 .../orchestrator/execution_plugin/exceptions.py |  36 ++
 aria/orchestrator/execution_plugin/local.py | 125 
 .../orchestrator/execution_plugin/operations.py |  63 ++
 .../execution_plugin/ssh/__init__.py|  14 +
 .../execution_plugin/ssh/operations.py  | 192 ++
 .../orchestrator/execution_plugin/ssh/tunnel.py |  91 +++
 aria/orchestrator/workflows/api/task.py |  12 +-
 aria/orchestrator/workflows/core/engine.py  |   1 -
 aria/orchestrator/workflows/core/task.py|   3 +-
 aria/orchestrator/workflows/executor/process.py |   3 +-
 aria/storage/base_model.py  |  24 +-
 aria/storage/filesystem_rapi.py |   2 +-
 aria/utils/exceptions.py|  19 +
 requirements.txt|   3 +
 setup.py|   9 +-
 tests/orchestrator/execution_plugin/__init__.py |  14 +
 .../execution_plugin/test_common.py | 191 ++
 .../execution_plugin/test_ctx_proxy_server.py   | 359 
 .../execution_plugin/test_global_ctx.py |  28 +
 .../orchestrator/execution_plugin/test_local.py | 587 +++
 tests/orchestrator/execution_plugin/test_ssh.py | 481 +++
 tests/orchestrator/workflows/api/test_task.py   |   5 +
 tests/orchestrator/workflows/core/test_task.py  |  38 +-
 tests/orchestrator/workflows/helpers.py |  37 ++
 tests/resources/scripts/test_ssh.sh |  81 +++
 tests/test_logger.py|   5 +-
 tests/utils/test_exceptions.py  |  73 +++
 tox.ini |   7 +
 39 files changed, 3138 insertions(+), 27 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/1854b178/appveyor.yml
--
diff --git a/appveyor.yml b/appveyor.yml
index 3ea8635..cb1ae42 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -3,7 +3,7 @@ environment:
   TOX_ENV: pywin
 
   matrix:
-- PYTHON: C:\Python27
+- PYTHON: "C:\\Python27"
   PYTHON_VERSION: 2.7.8
   PYTHON_ARCH: 32
 

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/1854b178/aria/orchestrator/context/common.py
--
diff --git a/aria/orchestrator/context/common.py 
b/aria/orchestrator/context/common.py
index 53844e8..691c17d 100644
--- a/aria/orchestrator/context/common.py
+++ b/aria/orchestrator/context/common.py
@@ -113,9 +113,7 @@ class BaseContext(logger.LoggerMixin):
 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.get_resource(path=path)
 resource_content = 
self._render_resource(resource_content=resource_content,
  variables=variables)
 with open(destination, 'wb') as f:

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/1854b178/aria/orchestrator/context/operation.py
--
diff --git a/aria/orchestrator/context/operation.py 
b/aria/orchestrator/context/operation.py
index 19bb73a..b33d107 100644
--- a/aria/orchestrator/context/operation.py
+++ b/aria/orchestrator/context/operation.py
@@ -42,6 +42,7 @@ class 

[2/2] incubator-ariatosca git commit: ARIA-46 Execution plugin

2017-01-19 Thread dankilman
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/3e0a578d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/3e0a578d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/3e0a578d

Branch: refs/heads/ARIA-46-execution-plugin
Commit: 3e0a578d314f82c4425e2c7749614bbe3f4bdd5b
Parents: 385b209
Author: Dan Kilman 
Authored: Tue Jan 3 17:00:46 2017 +0200
Committer: Dan Kilman 
Committed: Thu Jan 19 14:15:56 2017 +0200

--
 aria/orchestrator/context/common.py |   4 +-
 aria/orchestrator/context/operation.py  |   5 +-
 aria/orchestrator/exceptions.py |   2 +-
 aria/orchestrator/execution_plugin/__init__.py  |  33 ++
 aria/orchestrator/execution_plugin/common.py| 145 +
 aria/orchestrator/execution_plugin/constants.py |  51 ++
 .../execution_plugin/ctx_proxy/__init__.py  |  16 +
 .../execution_plugin/ctx_proxy/client.py| 105 
 .../execution_plugin/ctx_proxy/server.py| 239 
 .../execution_plugin/environment_globals.py |  60 ++
 .../orchestrator/execution_plugin/exceptions.py |  36 ++
 aria/orchestrator/execution_plugin/local.py | 125 
 .../orchestrator/execution_plugin/operations.py |  63 ++
 .../execution_plugin/ssh/__init__.py|  14 +
 .../execution_plugin/ssh/operations.py  | 192 ++
 .../orchestrator/execution_plugin/ssh/tunnel.py |  91 +++
 aria/orchestrator/workflows/api/task.py |  12 +-
 aria/orchestrator/workflows/core/engine.py  |   1 -
 aria/orchestrator/workflows/core/task.py|   3 +-
 aria/orchestrator/workflows/executor/process.py |   3 +-
 aria/storage/base_model.py  |  24 +-
 aria/storage/filesystem_rapi.py |   2 +-
 aria/utils/exceptions.py|  19 +
 requirements.txt|   3 +
 setup.py|   9 +-
 tests/orchestrator/execution_plugin/__init__.py |  14 +
 .../execution_plugin/test_common.py | 191 ++
 .../execution_plugin/test_ctx_proxy_server.py   | 359 
 .../execution_plugin/test_global_ctx.py |  28 +
 .../orchestrator/execution_plugin/test_local.py | 587 +++
 tests/orchestrator/execution_plugin/test_ssh.py | 481 +++
 tests/orchestrator/workflows/api/test_task.py   |   5 +
 tests/orchestrator/workflows/core/test_task.py  |  38 +-
 tests/orchestrator/workflows/helpers.py |  37 ++
 tests/resources/scripts/test_ssh.sh |  81 +++
 tests/test_logger.py|   5 +-
 tests/utils/test_exceptions.py  |  73 +++
 tox.ini |   7 +
 38 files changed, 3137 insertions(+), 26 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/3e0a578d/aria/orchestrator/context/common.py
--
diff --git a/aria/orchestrator/context/common.py 
b/aria/orchestrator/context/common.py
index 53844e8..691c17d 100644
--- a/aria/orchestrator/context/common.py
+++ b/aria/orchestrator/context/common.py
@@ -113,9 +113,7 @@ class BaseContext(logger.LoggerMixin):
 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.get_resource(path=path)
 resource_content = 
self._render_resource(resource_content=resource_content,
  variables=variables)
 with open(destination, 'wb') as f:

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/3e0a578d/aria/orchestrator/context/operation.py
--
diff --git a/aria/orchestrator/context/operation.py 
b/aria/orchestrator/context/operation.py
index 19bb73a..b33d107 100644
--- a/aria/orchestrator/context/operation.py
+++ b/aria/orchestrator/context/operation.py
@@ -42,6 +42,7 @@ class BaseOperationContext(BaseContext):
 **kwargs)
 self._task_id = task_id
 self._actor_id = actor_id
+self._task = None
 
 def __repr__(self):
 details = 'operation_mapping={task.operation_mapping}; ' \
@@ -55,7 +56,9 @@ class BaseOperationContext(BaseContext):
 The task in the model storage
 :return: Task model
 """
-return self.model.task.get(self._task_id)
+if not self._task:
+self._task = 

[1/2] incubator-ariatosca git commit: ARIA-46 Execution plugin [Forced Update!]

2017-01-19 Thread dankilman
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-46-execution-plugin bcef1e054 -> 3e0a578d3 (forced update)


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/3e0a578d/tests/orchestrator/execution_plugin/test_ctx_proxy_server.py
--
diff --git a/tests/orchestrator/execution_plugin/test_ctx_proxy_server.py 
b/tests/orchestrator/execution_plugin/test_ctx_proxy_server.py
new file mode 100644
index 000..98ceff9
--- /dev/null
+++ b/tests/orchestrator/execution_plugin/test_ctx_proxy_server.py
@@ -0,0 +1,359 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import os
+import time
+import sys
+import subprocess
+import StringIO
+
+import pytest
+
+from aria.orchestrator.execution_plugin import ctx_proxy
+
+
+class TestCtxProxy(object):
+
+def test_attribute_access(self, server):
+response = self.request(server, 'stub_attr', 'some_property')
+assert response == 'some_value'
+
+def test_sugared_attribute_access(self, server):
+response = self.request(server, 'stub-attr', 'some-property')
+assert response == 'some_value'
+
+def test_dict_prop_access_get_key(self, server):
+response = self.request(server, 'node', 'properties', 'prop1')
+assert response == 'value1'
+
+def test_dict_prop_access_get_key_nested(self, server):
+response = self.request(server, 'node', 'properties', 
'prop2.nested_prop1')
+assert response == 'nested_value1'
+
+def test_dict_prop_access_get_with_list_index(self, server):
+response = self.request(server, 'node', 'properties', 'prop3[2].value')
+assert response == 'value_2'
+
+def test_dict_prop_access_set(self, server, ctx):
+self.request(server, 'node', 'properties', 'prop4.key', 'new_value')
+self.request(server, 'node', 'properties', 'prop3[2].value', 
'new_value_2')
+self.request(server, 'node', 'properties', 'prop4.some.new.path',
+ 'some_new_value')
+assert ctx.node.properties['prop4']['key'] == 'new_value'
+assert ctx.node.properties['prop3'][2]['value'] == 'new_value_2'
+assert ctx.node.properties['prop4']['some']['new']['path'] == 
'some_new_value'
+
+def test_illegal_dict_access(self, server):
+self.request(server, 'node', 'properties', 'prop4.key', 'new_value')
+with pytest.raises(RuntimeError):
+self.request(server, 'node', 'properties', 'prop4.key', 
'new_value', 'what')
+
+def test_method_invocation(self, server):
+args = ['arg1', 'arg2', 'arg3']
+response_args = self.request(server, 'stub-method', *args)
+assert response_args == args
+
+def test_method_invocation_no_args(self, server):
+response = self.request(server, 'stub-method')
+assert response == []
+
+def test_method_invocation_kwargs(self, server):
+arg1 = 'arg1'
+arg2 = 'arg2'
+arg4 = 'arg4_override'
+arg5 = 'arg5'
+kwargs = dict(
+arg4=arg4,
+arg5=arg5)
+response = self.request(server, 'stub_args', arg1, arg2, kwargs)
+assert response == dict(
+arg1=arg1,
+arg2=arg2,
+arg3='arg3',
+arg4=arg4,
+args=[],
+kwargs=dict(
+arg5=arg5))
+
+def test_empty_return_value(self, server):
+response = self.request(server, 'stub_none')
+assert response is None
+
+def test_client_request_timeout(self, server):
+with pytest.raises(IOError):
+ctx_proxy.client._client_request(server.socket_url,
+ args=['stub-sleep', '0.5'],
+ timeout=0.1)
+
+def test_processing_exception(self, server):
+with pytest.raises(ctx_proxy.client._RequestError):
+self.request(server, 'property_that_does_not_exist')
+
+def test_not_json_serializable(self, server):
+with pytest.raises(ctx_proxy.client._RequestError):
+self.request(server, 'logger')
+
+def test_no_string_arg(self, server):
+args = ['stub_method', 1, 2]
+   

[1/2] incubator-ariatosca git commit: ARIA-46 Execution plugin [Forced Update!]

2017-01-17 Thread dankilman
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-46-execution-plugin 06b2f4d47 -> f91799a49 (forced update)


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/f91799a4/tests/orchestrator/execution_plugin/test_global_ctx.py
--
diff --git a/tests/orchestrator/execution_plugin/test_global_ctx.py 
b/tests/orchestrator/execution_plugin/test_global_ctx.py
new file mode 100644
index 000..dad7547
--- /dev/null
+++ b/tests/orchestrator/execution_plugin/test_global_ctx.py
@@ -0,0 +1,28 @@
+# 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 aria.orchestrator import execution_plugin
+
+
+def test_python_script_scope():
+assert execution_plugin.ctx is None
+assert execution_plugin.inputs is None
+ctx = object()
+inputs = object()
+with execution_plugin.python_script_scope(operation_ctx=ctx, 
operation_inputs=inputs):
+assert execution_plugin.ctx is ctx
+assert execution_plugin.inputs is inputs
+assert execution_plugin.ctx is None
+assert execution_plugin.inputs is None

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/f91799a4/tests/orchestrator/execution_plugin/test_local.py
--
diff --git a/tests/orchestrator/execution_plugin/test_local.py 
b/tests/orchestrator/execution_plugin/test_local.py
new file mode 100644
index 000..497da48
--- /dev/null
+++ b/tests/orchestrator/execution_plugin/test_local.py
@@ -0,0 +1,587 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import json
+import os
+
+import pytest
+
+from aria import workflow
+from aria.orchestrator import events
+from aria.orchestrator.workflows import api
+from aria.orchestrator.workflows.exceptions import ExecutorException
+from aria.orchestrator.exceptions import TaskAbortException, TaskRetryException
+from aria.orchestrator.execution_plugin import operations
+from aria.orchestrator.execution_plugin.exceptions import ProcessException
+from aria.orchestrator.execution_plugin import local
+from aria.orchestrator.execution_plugin import constants
+from aria.orchestrator.workflows.executor import process
+from aria.orchestrator.workflows.core import engine
+
+from tests import mock, storage
+from tests.orchestrator.workflows.helpers import events_collector
+
+IS_WINDOWS = os.name == 'nt'
+
+
+class TestLocalRunScript(object):
+
+def test_script_path_parameter(self, executor, workflow_context, tmpdir):
+script_path = self._create_script(
+tmpdir,
+linux_script='''#! /bin/bash -e
+ctx node-instance runtime-properties map.key value
+''',
+windows_script='''
+ctx node-instance runtime-properties map.key value
+''')
+props = self._run(
+executor, workflow_context,
+script_path=script_path)
+assert props['map']['key'] == 'value'
+
+def test_process_env(self, executor, workflow_context, tmpdir):
+script_path = self._create_script(
+tmpdir,
+linux_script='''#! /bin/bash -e
+ctx node-instance runtime-properties map.key1 $key1
+ctx node-instance runtime-properties map.key2 $key2
+''',
+windows_script='''
+ctx node-instance runtime-properties map.key1 %key1%
+ctx node-instance runtime-properties map.key2 %key2%
+''')
+   

[6/6] incubator-ariatosca git commit: ARIA-46 Execution plugin

2017-01-17 Thread dankilman
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/06b2f4d4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/06b2f4d4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/06b2f4d4

Branch: refs/heads/ARIA-46-execution-plugin
Commit: 06b2f4d47a3a11f1557b70a89b7a03ab56d5a92f
Parents: 385b209
Author: Dan Kilman 
Authored: Tue Jan 3 17:00:46 2017 +0200
Committer: Dan Kilman 
Committed: Tue Jan 17 12:48:38 2017 +0200

--
 MANIFEST.in |   1 +
 aria/orchestrator/execution_plugin/__init__.py  |  33 ++
 aria/orchestrator/execution_plugin/common.py| 145 +
 aria/orchestrator/execution_plugin/constants.py |  51 ++
 .../execution_plugin/ctx_proxy/__init__.py  |  16 +
 .../execution_plugin/ctx_proxy/client.py| 105 
 .../execution_plugin/ctx_proxy/server.py| 240 
 .../execution_plugin/environment_globals.py |  60 ++
 .../orchestrator/execution_plugin/exceptions.py |  38 ++
 aria/orchestrator/execution_plugin/local.py | 123 
 .../orchestrator/execution_plugin/operations.py |  59 ++
 .../execution_plugin/ssh/__init__.py|  14 +
 .../execution_plugin/ssh/operations.py  | 190 ++
 .../orchestrator/execution_plugin/ssh/tunnel.py |  91 +++
 aria/orchestrator/workflows/api/task.py |  12 +-
 aria/orchestrator/workflows/core/engine.py  |   1 -
 aria/orchestrator/workflows/core/task.py|   3 +-
 aria/storage/base_model.py  |  24 +-
 aria/storage/filesystem_rapi.py |   2 +-
 requirements.txt|   3 +
 setup.py|   9 +-
 tests/orchestrator/execution_plugin/__init__.py |  14 +
 .../execution_plugin/test_common.py | 193 +++
 .../execution_plugin/test_ctx_proxy_server.py   | 355 
 .../orchestrator/execution_plugin/test_local.py | 572 +++
 tests/orchestrator/execution_plugin/test_ssh.py | 378 
 tests/orchestrator/workflows/api/test_task.py   |   5 +
 tests/orchestrator/workflows/core/test_task.py  |  38 +-
 28 files changed, 2756 insertions(+), 19 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/06b2f4d4/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/06b2f4d4/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/06b2f4d4/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..b77474c
--- /dev/null
+++ b/aria/orchestrator/execution_plugin/common.py
@@ -0,0 +1,145 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  

[4/6] incubator-ariatosca git commit: ARIA-63 Implement attribute tracking for subprocesses

2017-01-17 Thread dankilman
ARIA-63 Implement attribute tracking for subprocesses


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

Branch: refs/heads/ARIA-46-execution-plugin
Commit: 385b209db2bf797cdd9877c3d031f3b258b8f79f
Parents: 61b7094
Author: Dan Kilman 
Authored: Sun Jan 15 17:42:23 2017 +0200
Committer: Dan Kilman 
Committed: Tue Jan 17 12:46:04 2017 +0200

--
 aria/orchestrator/workflows/executor/process.py |  48 ++--
 aria/storage/instrumentation.py | 157 +++
 aria/storage/type.py|  38 ++-
 tests/.pylintrc |   2 +-
 .../test_process_executor_tracked_changes.py|  95 +++
 tests/storage/test_instrumentation.py   | 275 +++
 6 files changed, 595 insertions(+), 20 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/385b209d/aria/orchestrator/workflows/executor/process.py
--
diff --git a/aria/orchestrator/workflows/executor/process.py 
b/aria/orchestrator/workflows/executor/process.py
index e0a8aeb..51596c3 100644
--- a/aria/orchestrator/workflows/executor/process.py
+++ b/aria/orchestrator/workflows/executor/process.py
@@ -42,6 +42,8 @@ import jsonpickle
 from aria.utils import imports
 from aria.orchestrator.workflows.executor import base
 from aria.orchestrator.context import serialization
+from aria.storage import instrumentation
+from aria.storage import type as storage_type
 
 _IS_WIN = os.name == 'nt'
 
@@ -139,10 +141,17 @@ class ProcessExecutor(base.BaseExecutor):
 if message_type == 'started':
 self._task_started(self._tasks[task_id])
 elif message_type == 'succeeded':
-self._task_succeeded(self._remove_task(task_id))
+task = self._remove_task(task_id)
+instrumentation.apply_tracked_changes(
+tracked_changes=message['tracked_changes'],
+model=task.context.model)
+self._task_succeeded(task)
 elif message_type == 'failed':
-self._task_failed(self._remove_task(task_id),
-  exception=message['exception'])
+task = self._remove_task(task_id)
+instrumentation.apply_tracked_changes(
+tracked_changes=message['tracked_changes'],
+model=task.context.model)
+self._task_failed(task, exception=message['exception'])
 else:
 raise RuntimeError('Invalid state')
 except BaseException as e:
@@ -227,26 +236,27 @@ class _Messenger(object):
 """Task started message"""
 self._send_message(type='started')
 
-def succeeded(self):
+def succeeded(self, tracked_changes):
 """Task succeeded message"""
-self._send_message(type='succeeded')
+self._send_message(type='succeeded', tracked_changes=tracked_changes)
 
-def failed(self, exception):
+def failed(self, tracked_changes, exception):
 """Task failed message"""
-self._send_message(type='failed', exception=exception)
+self._send_message(type='failed', tracked_changes=tracked_changes, 
exception=exception)
 
 def closed(self):
 """Executor closed message"""
 self._send_message(type='closed')
 
-def _send_message(self, type, exception=None):
+def _send_message(self, type, tracked_changes=None, exception=None):
 sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
 sock.connect(('localhost', self.port))
 try:
 data = jsonpickle.dumps({
 'type': type,
 'task_id': self.task_id,
-'exception': exception
+'exception': exception,
+'tracked_changes': tracked_changes
 })
 sock.send(struct.pack(_INT_FMT, len(data)))
 sock.sendall(data)
@@ -271,13 +281,19 @@ def _main():
 operation_mapping = arguments['operation_mapping']
 operation_inputs = arguments['operation_inputs']
 context_dict = arguments['context']
-try:
-ctx = serialization.operation_context_from_dict(context_dict)
-task_func = imports.load_attribute(operation_mapping)
-task_func(ctx=ctx, **operation_inputs)
-messenger.succeeded()
-except BaseException as e:
-

[2/6] incubator-ariatosca git commit: ARIA-59 Inherit default interfaces in relationships

2017-01-17 Thread dankilman
ARIA-59 Inherit default interfaces in relationships


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

Branch: refs/heads/ARIA-46-execution-plugin
Commit: dac4da7f616fa34d15e13e7162c706b9c3bd02a6
Parents: 17d07ed
Author: Tal Liron 
Authored: Sun Jan 8 23:12:12 2017 +0200
Committer: Ran Ziv 
Committed: Sun Jan 8 23:12:35 2017 +0200

--
 extensions/aria_extension_tosca/__init__.py |  3 +--
 .../simple_v1_0/modeling/requirements.py| 12 ++--
 2 files changed, 7 insertions(+), 8 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/dac4da7f/extensions/aria_extension_tosca/__init__.py
--
diff --git a/extensions/aria_extension_tosca/__init__.py 
b/extensions/aria_extension_tosca/__init__.py
index d93dce2..ff4fa7d 100644
--- a/extensions/aria_extension_tosca/__init__.py
+++ b/extensions/aria_extension_tosca/__init__.py
@@ -53,5 +53,4 @@ MODULES = (
 'simple_nfv_v1_0')
 
 __all__ = (
-'MODULES',
-'install_aria_extension')
+'MODULES',)

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/dac4da7f/extensions/aria_extension_tosca/simple_v1_0/modeling/requirements.py
--
diff --git 
a/extensions/aria_extension_tosca/simple_v1_0/modeling/requirements.py 
b/extensions/aria_extension_tosca/simple_v1_0/modeling/requirements.py
index 9dea874..8f6c38f 100644
--- a/extensions/aria_extension_tosca/simple_v1_0/modeling/requirements.py
+++ b/extensions/aria_extension_tosca/simple_v1_0/modeling/requirements.py
@@ -192,6 +192,12 @@ def 
convert_requirement_from_definition_to_assignment(context, requirement_defin
 # InterfaceDefinition:
 relationship_interface_definitions = 
OrderedDict(relationship_type._get_interfaces(context))
 
+# Convert interface definitions to templates
+convert_requirement_interface_definitions_from_type_to_raw_template(
+context,
+raw['relationship'],
+relationship_interface_definitions)
+
 if relationship_definition:
 # Merge extra interface definitions
 # InterfaceDefinition:
@@ -207,12 +213,6 @@ def 
convert_requirement_from_definition_to_assignment(context, requirement_defin
 raw['relationship']['interfaces'] = OrderedDict()
 for interface_name, interface in interfaces.iteritems():
 raw['relationship']['interfaces'][interface_name] = 
interface._raw
-else:
-# Convert interface definitions to templates
-
convert_requirement_interface_definitions_from_type_to_raw_template(
-context,
-raw['relationship'],
-relationship_interface_definitions)
 
 return \
 RequirementAssignment(name=requirement_definition._name, raw=raw, 
container=container), \



[5/6] incubator-ariatosca git commit: ARIA-46 Execution plugin

2017-01-17 Thread dankilman
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/06b2f4d4/tests/orchestrator/execution_plugin/test_local.py
--
diff --git a/tests/orchestrator/execution_plugin/test_local.py 
b/tests/orchestrator/execution_plugin/test_local.py
new file mode 100644
index 000..8123ae8
--- /dev/null
+++ b/tests/orchestrator/execution_plugin/test_local.py
@@ -0,0 +1,572 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import json
+import os
+
+import pytest
+
+from aria import workflow
+from aria.orchestrator.workflows import api
+from aria.orchestrator.exceptions import TaskAbortException
+from aria.orchestrator.execution_plugin import operations
+from aria.orchestrator.execution_plugin.exceptions import ProcessException
+from aria.orchestrator.execution_plugin import local
+from aria.orchestrator.execution_plugin import constants
+from aria.orchestrator.workflows.executor import process
+from aria.orchestrator.workflows.core import engine
+
+from tests import mock, storage
+
+IS_WINDOWS = os.name == 'nt'
+
+import logging
+logging.basicConfig()
+
+
+class TestLocalRunScript(object):
+
+def test_script_path_parameter(self, executor, workflow_context, tmpdir):
+script_path = self._create_script(
+tmpdir,
+linux_script='''#! /bin/bash -e
+ctx node-instance runtime-properties map.key value
+''',
+windows_script='''
+ctx node-instance runtime-properties map.key value
+''')
+props = self._run(
+executor, workflow_context,
+script_path=script_path)
+assert props['map']['key'] == 'value'
+
+def test_process_env(self, executor, workflow_context, tmpdir):
+script_path = self._create_script(
+tmpdir,
+linux_script='''#! /bin/bash -e
+ctx node-instance runtime-properties map.key1 $key1
+ctx node-instance runtime-properties map.key2 $key2
+''',
+windows_script='''
+ctx node-instance runtime-properties map.key1 %key1%
+ctx node-instance runtime-properties map.key2 %key2%
+''')
+props = self._run(
+executor, workflow_context,
+script_path=script_path,
+process={
+'env': {
+'key1': 'value1',
+'key2': 'value2'
+}
+})
+p_map = props['map']
+assert p_map['key1'] == 'value1'
+assert p_map['key2'] == 'value2'
+
+def test_process_cwd(self, executor, workflow_context, tmpdir):
+script_path = self._create_script(
+tmpdir,
+linux_script='''#! /bin/bash -e
+ctx node-instance runtime-properties map.cwd $PWD
+''',
+windows_script='''
+ctx node-instance runtime-properties map.cwd %CD%
+''')
+tmpdir = str(tmpdir)
+props = self._run(
+executor, workflow_context,
+script_path=script_path,
+process={
+'cwd': tmpdir
+})
+p_map = props['map']
+assert p_map['cwd'] == tmpdir
+
+def test_process_command_prefix(self, executor, workflow_context, tmpdir):
+use_ctx = 'ctx node-instance runtime-properties map.key value'
+python_script = ['import subprocess',
+ 'subprocess.Popen("{0}").split(' 
')).communicate()[0]'.format(use_ctx)]
+script_path = self._create_script(
+tmpdir,
+linux_script='\n'.join(python_script),
+windows_script='''
+ctx node-instance runtime-properties map.key $env:TEST_KEY
+''',
+windows_suffix='.ps1')
+# TODO: this (powershell) happens implicitly
+command_prefix = 'powershell' if IS_WINDOWS else 'python'
+props = self._run(
+executor, workflow_context,
+script_path=script_path,
+process={
+'env': {'TEST_KEY': 'value'},
+'command_prefix': command_prefix
+})
+p_map = props['map']
+assert p_map['key'] == 

[1/2] incubator-ariatosca git commit: ARIA-60 Fix use of thread locals in parser context [Forced Update!]

2017-01-17 Thread dankilman
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-63-runtime-properties-modification aa3dcd2de -> 385b209db 
(forced update)


ARIA-60 Fix use of thread locals in parser context


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

Branch: refs/heads/ARIA-63-runtime-properties-modification
Commit: 61b7094d8fbd7cd34cebc14ab7cd537386143e57
Parents: dac4da7
Author: Tal Liron 
Authored: Sun Jan 15 16:45:35 2017 +0200
Committer: Ran Ziv 
Committed: Sun Jan 15 16:46:05 2017 +0200

--
 aria/parser/consumption/context.py | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/61b7094d/aria/parser/consumption/context.py
--
diff --git a/aria/parser/consumption/context.py 
b/aria/parser/consumption/context.py
index 8fb9bb6..a8b75df 100644
--- a/aria/parser/consumption/context.py
+++ b/aria/parser/consumption/context.py
@@ -24,6 +24,9 @@ from ..modeling import ModelingContext
 from .style import Style
 
 
+_thread_locals = threading.local()
+
+
 class ConsumptionContext(object):
 """
 Properties:
@@ -44,8 +47,7 @@ class ConsumptionContext(object):
 Gets the context attached to the current thread if there is one.
 """
 
-thread_locals = threading.local()
-return getattr(thread_locals, 'aria_consumption_context', None)
+return getattr(_thread_locals, 'aria_consumption_context', None)
 
 def __init__(self, set_thread_local=True):
 self.args = []
@@ -65,8 +67,7 @@ class ConsumptionContext(object):
 Attaches this context to the current thread.
 """
 
-thread_locals = threading.local()
-thread_locals.aria_consumption_context = self
+_thread_locals.aria_consumption_context = self
 
 def write(self, string):
 """



incubator-ariatosca git commit: ARIA-63 Implement attribute tracking for subprocesses [Forced Update!]

2017-01-16 Thread dankilman
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-63-runtime-properties-modification 9f29d2912 -> 036f9c8ea 
(forced update)


ARIA-63 Implement attribute tracking for subprocesses


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

Branch: refs/heads/ARIA-63-runtime-properties-modification
Commit: 036f9c8eadffc774a12b1df8a11b277191bbd916
Parents: dac4da7
Author: Dan Kilman 
Authored: Sun Jan 15 17:42:23 2017 +0200
Committer: Dan Kilman 
Committed: Tue Jan 17 05:06:58 2017 +0200

--
 aria/orchestrator/workflows/executor/process.py |  47 ++--
 aria/storage/instrumentation.py | 157 +++
 aria/storage/type.py|  35 ++-
 tests/.pylintrc |   2 +-
 .../test_process_executor_tracked_changes.py|  95 +++
 tests/storage/test_instrumentation.py   | 274 +++
 6 files changed, 590 insertions(+), 20 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/036f9c8e/aria/orchestrator/workflows/executor/process.py
--
diff --git a/aria/orchestrator/workflows/executor/process.py 
b/aria/orchestrator/workflows/executor/process.py
index e0a8aeb..cd80287 100644
--- a/aria/orchestrator/workflows/executor/process.py
+++ b/aria/orchestrator/workflows/executor/process.py
@@ -42,6 +42,8 @@ import jsonpickle
 from aria.utils import imports
 from aria.orchestrator.workflows.executor import base
 from aria.orchestrator.context import serialization
+from aria.storage import instrumentation
+from aria.storage import type as storage_type
 
 _IS_WIN = os.name == 'nt'
 
@@ -139,10 +141,17 @@ class ProcessExecutor(base.BaseExecutor):
 if message_type == 'started':
 self._task_started(self._tasks[task_id])
 elif message_type == 'succeeded':
-self._task_succeeded(self._remove_task(task_id))
+task = self._remove_task(task_id)
+instrumentation.apply_tracked_changes(
+tracked_changes=message['tracked_changes'],
+model=task.context.model)
+self._task_succeeded(task)
 elif message_type == 'failed':
-self._task_failed(self._remove_task(task_id),
-  exception=message['exception'])
+task = self._remove_task(task_id)
+instrumentation.apply_tracked_changes(
+tracked_changes=message['tracked_changes'],
+model=task.context.model)
+self._task_failed(task, exception=message['exception'])
 else:
 raise RuntimeError('Invalid state')
 except BaseException as e:
@@ -227,26 +236,27 @@ class _Messenger(object):
 """Task started message"""
 self._send_message(type='started')
 
-def succeeded(self):
+def succeeded(self, tracked_changes):
 """Task succeeded message"""
-self._send_message(type='succeeded')
+self._send_message(type='succeeded', tracked_changes=tracked_changes)
 
-def failed(self, exception):
+def failed(self, tracked_changes, exception):
 """Task failed message"""
-self._send_message(type='failed', exception=exception)
+self._send_message(type='failed', tracked_changes=tracked_changes, 
exception=exception)
 
 def closed(self):
 """Executor closed message"""
 self._send_message(type='closed')
 
-def _send_message(self, type, exception=None):
+def _send_message(self, type, tracked_changes=None, exception=None):
 sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
 sock.connect(('localhost', self.port))
 try:
 data = jsonpickle.dumps({
 'type': type,
 'task_id': self.task_id,
-'exception': exception
+'exception': exception,
+'tracked_changes': tracked_changes
 })
 sock.send(struct.pack(_INT_FMT, len(data)))
 sock.sendall(data)
@@ -271,13 +281,18 @@ def _main():
 operation_mapping = arguments['operation_mapping']
 operation_inputs = arguments['operation_inputs']
 context_dict = arguments['context']
-try:
-ctx = serialization.operation_context_from_dict(context_dict)
-task_func = 

incubator-ariatosca git commit: ARIA-63 Implement attribute tracking for subprocesses [Forced Update!]

2017-01-16 Thread dankilman
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-63-runtime-properties-modification e81f42758 -> 9f29d2912 
(forced update)


ARIA-63 Implement attribute tracking for subprocesses


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

Branch: refs/heads/ARIA-63-runtime-properties-modification
Commit: 9f29d2912142039d1dc8e1398eefc323803a8e73
Parents: dac4da7
Author: Dan Kilman 
Authored: Sun Jan 15 17:42:23 2017 +0200
Committer: Dan Kilman 
Committed: Tue Jan 17 04:36:23 2017 +0200

--
 aria/orchestrator/workflows/executor/process.py |  49 ++--
 aria/storage/instrumentation.py | 124 +
 aria/storage/type.py|  20 +-
 tests/.pylintrc |   2 +-
 .../test_process_executor_tracked_changes.py|  95 +++
 tests/storage/test_instrumentation.py   | 274 +++
 6 files changed, 544 insertions(+), 20 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/9f29d291/aria/orchestrator/workflows/executor/process.py
--
diff --git a/aria/orchestrator/workflows/executor/process.py 
b/aria/orchestrator/workflows/executor/process.py
index e0a8aeb..3c86c51 100644
--- a/aria/orchestrator/workflows/executor/process.py
+++ b/aria/orchestrator/workflows/executor/process.py
@@ -42,6 +42,8 @@ import jsonpickle
 from aria.utils import imports
 from aria.orchestrator.workflows.executor import base
 from aria.orchestrator.context import serialization
+from aria.storage import instrumentation
+from aria.storage import type as storage_type
 
 _IS_WIN = os.name == 'nt'
 
@@ -139,10 +141,17 @@ class ProcessExecutor(base.BaseExecutor):
 if message_type == 'started':
 self._task_started(self._tasks[task_id])
 elif message_type == 'succeeded':
-self._task_succeeded(self._remove_task(task_id))
+task = self._remove_task(task_id)
+instrumentation.apply_tracked_changes(
+tracked_changes=message['tracked_changes'],
+model=task.context.model)
+self._task_succeeded(task)
 elif message_type == 'failed':
-self._task_failed(self._remove_task(task_id),
-  exception=message['exception'])
+task = self._remove_task(task_id)
+instrumentation.apply_tracked_changes(
+tracked_changes=message['tracked_changes'],
+model=task.context.model)
+self._task_failed(task, exception=message['exception'])
 else:
 raise RuntimeError('Invalid state')
 except BaseException as e:
@@ -227,26 +236,27 @@ class _Messenger(object):
 """Task started message"""
 self._send_message(type='started')
 
-def succeeded(self):
+def succeeded(self, tracked_changes):
 """Task succeeded message"""
-self._send_message(type='succeeded')
+self._send_message(type='succeeded', tracked_changes=tracked_changes)
 
-def failed(self, exception):
+def failed(self, tracked_changes, exception):
 """Task failed message"""
-self._send_message(type='failed', exception=exception)
+self._send_message(type='failed', tracked_changes=tracked_changes, 
exception=exception)
 
 def closed(self):
 """Executor closed message"""
 self._send_message(type='closed')
 
-def _send_message(self, type, exception=None):
+def _send_message(self, type, tracked_changes=None, exception=None):
 sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
 sock.connect(('localhost', self.port))
 try:
 data = jsonpickle.dumps({
 'type': type,
 'task_id': self.task_id,
-'exception': exception
+'exception': exception,
+'tracked_changes': tracked_changes
 })
 sock.send(struct.pack(_INT_FMT, len(data)))
 sock.sendall(data)
@@ -271,13 +281,20 @@ def _main():
 operation_mapping = arguments['operation_mapping']
 operation_inputs = arguments['operation_inputs']
 context_dict = arguments['context']
-try:
-ctx = serialization.operation_context_from_dict(context_dict)
-task_func = 

[GitHub] incubator-ariatosca pull request #49: ARIA-63 Implement attribute tracking f...

2017-01-16 Thread dankilman
GitHub user dankilman opened a pull request:

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

ARIA-63 Implement attribute tracking for subprocesses



You can merge this pull request into a Git repository by running:

$ git pull https://github.com/apache/incubator-ariatosca 
ARIA-63-runtime-properties-modification

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/incubator-ariatosca/pull/49.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 #49


commit 62cfb82d7c34853ecae1c49fb60e5145a2e26a27
Author: Dan Kilman <d...@gigaspaces.com>
Date:   2017-01-15T15:42:23Z

ARIA-63 Implement attribute tracking for subprocesses




---
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.
---


[2/2] incubator-ariatosca git commit: ARIA-46 Execution plugin

2017-01-09 Thread dankilman
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/e203f6ce
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/e203f6ce
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/e203f6ce

Branch: refs/heads/ARIA-46-execution-plugin
Commit: e203f6ce9b3a3221589c0284b8b5532c622d97bf
Parents: 3caf177
Author: Dan Kilman 
Authored: Tue Jan 3 17:00:46 2017 +0200
Committer: Dan Kilman 
Committed: Mon Jan 9 19:17:29 2017 +0200

--
 MANIFEST.in |   1 +
 aria/orchestrator/execution_plugin/__init__.py  |  33 ++
 aria/orchestrator/execution_plugin/common.py| 150 +
 aria/orchestrator/execution_plugin/constants.py |  51 ++
 .../execution_plugin/ctx_proxy/__init__.py  |  16 +
 .../execution_plugin/ctx_proxy/client.py| 105 
 .../execution_plugin/ctx_proxy/server.py| 240 
 .../execution_plugin/environment_globals.py |  60 ++
 .../orchestrator/execution_plugin/exceptions.py |  38 ++
 aria/orchestrator/execution_plugin/local.py | 123 
 .../orchestrator/execution_plugin/operations.py |  59 ++
 .../execution_plugin/ssh/__init__.py|  14 +
 .../execution_plugin/ssh/operations.py  | 190 ++
 .../orchestrator/execution_plugin/ssh/tunnel.py |  91 +++
 aria/orchestrator/workflows/api/task.py |  12 +-
 aria/orchestrator/workflows/core/engine.py  |   1 -
 aria/orchestrator/workflows/core/task.py|   3 +-
 aria/orchestrator/workflows/executor/process.py |   3 +
 aria/storage/base_model.py  |  26 +-
 aria/storage/filesystem_rapi.py |   2 +-
 requirements.txt|   3 +
 setup.py|   9 +-
 tests/orchestrator/execution_plugin/__init__.py |  14 +
 .../execution_plugin/test_common.py | 193 ++
 .../execution_plugin/test_ctx_proxy_server.py   | 355 +++
 .../orchestrator/execution_plugin/test_local.py | 586 +++
 tests/orchestrator/execution_plugin/test_ssh.py | 545 +
 27 files changed, 2910 insertions(+), 13 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/e203f6ce/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/e203f6ce/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/e203f6ce/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..c13555a
--- /dev/null
+++ b/aria/orchestrator/execution_plugin/common.py
@@ -0,0 +1,150 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for 

incubator-ariatosca git commit: ARIA-46 Execution plugin [Forced Update!]

2017-01-08 Thread dankilman
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-46-execution-plugin b12c12429 -> 76337bb47 (forced update)


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/76337bb4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/76337bb4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/76337bb4

Branch: refs/heads/ARIA-46-execution-plugin
Commit: 76337bb47475eb160910f0953d957dd7691ab3b1
Parents: 3caf177
Author: Dan Kilman 
Authored: Tue Jan 3 17:00:46 2017 +0200
Committer: Dan Kilman 
Committed: Sun Jan 8 11:37:49 2017 +0200

--
 MANIFEST.in |   1 +
 aria/orchestrator/execution_plugin/__init__.py  |  33 ++
 aria/orchestrator/execution_plugin/common.py| 146 
 aria/orchestrator/execution_plugin/constants.py |  51 +++
 .../execution_plugin/ctx_proxy/__init__.py  |  16 +
 .../execution_plugin/ctx_proxy/client.py| 105 ++
 .../execution_plugin/ctx_proxy/server.py| 240 +
 .../execution_plugin/environment_globals.py |  60 
 .../orchestrator/execution_plugin/exceptions.py |  36 ++
 aria/orchestrator/execution_plugin/local.py | 123 +++
 .../orchestrator/execution_plugin/operations.py |  59 +++
 .../execution_plugin/ssh/__init__.py|  14 +
 .../execution_plugin/ssh/operations.py  | 210 +++
 .../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 +-
 tests/orchestrator/execution_plugin/__init__.py |  14 +
 .../execution_plugin/test_ctx_proxy_server.py   | 355 +++
 21 files changed, 1596 insertions(+), 11 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/76337bb4/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/76337bb4/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/76337bb4/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..fb6e2b0
--- /dev/null
+++ b/aria/orchestrator/execution_plugin/common.py
@@ -0,0 +1,146 @@
+# 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 

incubator-ariatosca git commit: ARIA-46 Execution plugin [Forced Update!]

2017-01-06 Thread dankilman
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-46-execution-plugin 15ab3e914 -> b12c12429 (forced update)


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/b12c1242
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/b12c1242
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/b12c1242

Branch: refs/heads/ARIA-46-execution-plugin
Commit: b12c1242931a9e8e124533029cf192bebfaa5bff
Parents: 3caf177
Author: Dan Kilman 
Authored: Tue Jan 3 17:00:46 2017 +0200
Committer: Dan Kilman 
Committed: Fri Jan 6 20:33:26 2017 +0200

--
 MANIFEST.in |   1 +
 aria/orchestrator/execution_plugin/__init__.py  |  33 +++
 aria/orchestrator/execution_plugin/common.py| 146 +++
 aria/orchestrator/execution_plugin/constants.py |  51 
 .../execution_plugin/ctx_proxy/__init__.py  |  16 ++
 .../execution_plugin/ctx_proxy/client.py| 105 
 .../execution_plugin/ctx_proxy/server.py| 240 +++
 .../execution_plugin/environment_globals.py |  60 +
 .../orchestrator/execution_plugin/exceptions.py |  36 +++
 aria/orchestrator/execution_plugin/local.py | 123 ++
 .../orchestrator/execution_plugin/operations.py |  59 +
 .../execution_plugin/ssh/__init__.py|  14 ++
 .../execution_plugin/ssh/operations.py  | 210 
 .../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, 1227 insertions(+), 11 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/b12c1242/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/b12c1242/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/b12c1242/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..fb6e2b0
--- /dev/null
+++ b/aria/orchestrator/execution_plugin/common.py
@@ -0,0 +1,146 @@
+# 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 

incubator-ariatosca git commit: ARIA-46 Execution plugin

2017-01-05 Thread dankilman
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 Kilman 
Authored: 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 

[1/2] incubator-ariatosca git commit: ARIA-55 Implement task retry and abort mechanism [Forced Update!]

2017-01-05 Thread dankilman
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 Kilman 
Authored: 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,
 )
 

[2/3] incubator-ariatosca git commit: ARIA-34 Adding get/download resource and render API (as jinja template)

2017-01-05 Thread dankilman
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 Kilman 
Authored: 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

2017-01-05 Thread dankilman
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 Kilman 
Authored: 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,
+ 

incubator-ariatosca git commit: ARIA-56 Implement ip property on node instance model

2017-01-05 Thread dankilman
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 Kilman 
Authored: 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!]

2017-01-05 Thread dankilman
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 Kilman 
Authored: 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 

incubator-ariatosca git commit: ARIA-55 Implement task retry and abort mechanism

2017-01-05 Thread dankilman
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 Kilman 
Authored: 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 

[incubator-ariatosca] Git Push Summary

2017-01-05 Thread dankilman
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!]

2017-01-05 Thread dankilman
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 Kilman 
Authored: 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

[GitHub] incubator-ariatosca pull request #40: ARIA-55 Implement task retry and abort...

2017-01-05 Thread dankilman
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.
---


[GitHub] incubator-ariatosca pull request #41: ARIA-34 Adding get/download resource a...

2017-01-05 Thread dankilman
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.
---


incubator-ariatosca git commit: ARIA-34 Adding get/download resource and render API (as jinja template) [Forced Update!]

2017-01-05 Thread dankilman
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 Kilman 
Authored: 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...

2017-01-05 Thread dankilman
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 Kilman <d...@gigaspaces.com>
Date:   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)

2017-01-05 Thread dankilman
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 Kilman 
Authored: 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...

2017-01-05 Thread dankilman
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 Kilman <d...@gigaspaces.com>
Date:   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.
---


[GitHub] incubator-ariatosca pull request #40: ARIA-55 Implement task retry and abort...

2017-01-05 Thread dankilman
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 Kilman <d...@gigaspaces.com>
Date:   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.
---


incubator-ariatosca git commit: ARIA-55 Implement task retry and abort mechanism

2017-01-05 Thread dankilman
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 Kilman 
Authored: 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 

[GitHub] incubator-ariatosca pull request #33: Genericize-storage-models

2016-12-22 Thread dankilman
Github user dankilman commented on a diff in the pull request:

https://github.com/apache/incubator-ariatosca/pull/33#discussion_r93617348
  
--- Diff: aria/storage/structure.py ---
@@ -39,6 +39,8 @@
 
 class ModelMixin(object):
 
+# _private_fields = []
--- End diff --

restore


---
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.
---


[GitHub] incubator-ariatosca pull request #33: Genericize-storage-models

2016-12-22 Thread dankilman
Github user dankilman commented on a diff in the pull request:

https://github.com/apache/incubator-ariatosca/pull/33#discussion_r93617315
  
--- Diff: aria/orchestrator/workflows/core/task.py ---
@@ -135,7 +134,7 @@ def __init__(self, api_task, *args, **kwargs):
 max_attempts=api_task.max_attempts,
 retry_interval=api_task.retry_interval,
 ignore_failure=api_task.ignore_failure,
-plugin_fk=plugin_id,
+plugin=plugins[0] if plugins else None,
--- End diff --

put back


---
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.
---


[GitHub] incubator-ariatosca pull request #33: Genericize-storage-models

2016-12-22 Thread dankilman
Github user dankilman commented on a diff in the pull request:

https://github.com/apache/incubator-ariatosca/pull/33#discussion_r93609634
  
--- Diff: aria/storage/structure.py ---
@@ -0,0 +1,180 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""
+Aria's storage.structures module
+Path: aria.storage.structures
+
+models module holds aria's models.
+
+classes:
+* Field - represents a single field.
+* IterField - represents an iterable field.
+* PointerField - represents a single pointer field.
+* IterPointerField - represents an iterable pointers field.
+* Model - abstract model implementation.
+"""
+
+from sqlalchemy.orm import relationship, backref
+from sqlalchemy.ext import associationproxy
+from sqlalchemy import (
+Column,
+ForeignKey,
+Integer,
+Text
+)
+
+
+class ModelMixin(object):
+
+@classmethod
+def id_column_name(cls):
+raise NotImplementedError
+
+@classmethod
+def name_column_name(cls):
+raise NotImplementedError
+
+@classmethod
+def _get_cls_by_tablename(cls, tablename):
+"""Return class reference mapped to table.
+
+ :param tablename: String with name of table.
+ :return: Class reference or None.
+ """
+if tablename in (cls.__name__, cls.__tablename__):
+return cls
+
+for table_cls in cls._decl_class_registry.values():
+if tablename in (getattr(table_cls, '__name__', None),
+ getattr(table_cls, '__tablename__', None)):
+return table_cls
+
+@classmethod
+def foreign_key(cls, table, nullable=False):
+"""Return a ForeignKey object with the relevant
+
+:param table: Unique id column in the parent table
+:param nullable: Should the column be allowed to remain empty
+"""
+table = cls._get_cls_by_tablename(table.__tablename__)
+foreign_key_str = 
'{tablename}.{unique_id}'.format(tablename=table.__tablename__,
+   
unique_id=table.id_column_name())
+column = Column(ForeignKey(foreign_key_str, ondelete='CASCADE'),
+nullable=nullable)
+column.__remote_table_name = table.__name__
+return column
+
+@classmethod
+def one_to_many_relationship(cls,
+ foreign_key_column,
+ backreference=None):
+"""Return a one-to-many SQL relationship object
+Meant to be used from inside the *child* object
+
+:param parent_class: Class of the parent table
+:param cls: Class of the child table
+:param foreign_key_column: The column of the foreign key (from the 
child table)
+:param backreference: The name to give to the reference to the 
child (on the parent table)
+"""
+parent_table = cls._get_cls_by_tablename(
+getattr(cls, foreign_key_column).__remote_table_name)
+primaryjoin_str = '{parent_class_name}.{parent_unique_id} == ' \
+  '{child_class.__name__}.{foreign_key_column}'\
+.format(
+parent_class_name=parent_table.__name__,
+parent_unique_id=parent_table.id_column_name(),
+child_class=cls,
+foreign_key_column=foreign_key_column
+)
+return relationship(
+parent_table.__name__,
+primaryjoin=primaryjoin_str,
+foreign_keys=[getattr(cls, foreign_key_column)],
+# The following line make sure that when the *parent* is
+

[GitHub] incubator-ariatosca pull request #33: Genericize-storage-models

2016-12-22 Thread dankilman
Github user dankilman commented on a diff in the pull request:

https://github.com/apache/incubator-ariatosca/pull/33#discussion_r93606793
  
--- Diff: aria/orchestrator/workflows/builtin/heal.py ---
@@ -163,10 +163,11 @@ def heal_install(ctx, graph, failing_node_instances, 
targeted_node_instances):
 
 
 def _get_contained_subgraph(context, host_node_instance):
-contained_instances = [node_instance
-   for node_instance in context.node_instances
-   if node_instance.host_id == 
host_node_instance.id and
-   node_instance.id != node_instance.host_id]
+contained_instances = [
--- End diff --

bug


---
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.
---


[GitHub] incubator-ariatosca pull request #33: Genericize-storage-models

2016-12-22 Thread dankilman
Github user dankilman commented on a diff in the pull request:

https://github.com/apache/incubator-ariatosca/pull/33#discussion_r93606315
  
--- Diff: aria/orchestrator/context/workflow.py ---
@@ -86,9 +85,11 @@ def nodes(self):
 """
 Iterator over nodes
 """
+key = 
'deployment_{0}'.format(self.model.node_instance.model_cls.name_column_name())
+
 return self.model.node.iter(
 filters={
-'deployment_id': self.deployment.id
+key: getattr(self.deployment, 
self.deployment.name_column_name())
--- End diff --

simplify?


---
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: Provide (initial) means for serializing an operation context object [Forced Update!]

2016-12-21 Thread dankilman
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-40-serialize-context-data 7b11deb7f -> 8ec2d1c24 (forced 
update)


Provide (initial) means for serializing an operation context object


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

Branch: refs/heads/ARIA-40-serialize-context-data
Commit: 8ec2d1c245a995c9788537d233f3b1ce6db5f0ba
Parents: 5cf84ee
Author: Dan Kilman 
Authored: Mon Dec 19 17:05:54 2016 +0200
Committer: Dan Kilman 
Committed: Wed Dec 21 16:10:41 2016 +0200

--
 aria/__init__.py| 26 +++---
 aria/orchestrator/context/common.py | 11 +--
 aria/orchestrator/context/operation.py  | 21 +++--
 aria/orchestrator/context/serialize.py  | 94 
 aria/orchestrator/context/workflow.py   | 13 ++-
 aria/orchestrator/workflows/core/task.py| 11 ++-
 aria/orchestrator/workflows/events_logging.py   |  6 +-
 aria/orchestrator/workflows/executor/process.py | 22 +++--
 aria/storage/filesystem_rapi.py |  5 +-
 tests/__init__.py   |  4 +
 tests/mock/context.py   | 18 +++-
 tests/orchestrator/context/test_serialize.py| 77 
 tests/orchestrator/workflows/core/test_task.py  |  1 +
 .../workflows/executor/test_executor.py | 19 ++--
 .../workflows/executor/test_process_executor.py | 11 ++-
 15 files changed, 279 insertions(+), 60 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/8ec2d1c2/aria/__init__.py
--
diff --git a/aria/__init__.py b/aria/__init__.py
index 0f7bec6..cc362c0 100644
--- a/aria/__init__.py
+++ b/aria/__init__.py
@@ -41,8 +41,6 @@ __all__ = (
 'operation',
 )
 
-_resource_storage = {}
-
 
 def install_aria_extensions():
 """
@@ -61,7 +59,7 @@ def install_aria_extensions():
 
 def application_model_storage(api, api_kwargs=None):
 """
-Initiate model storage for the supplied storage driver
+Initiate model storage
 """
 models = [
 storage.models.Plugin,
@@ -85,17 +83,15 @@ def application_model_storage(api, api_kwargs=None):
 return storage.ModelStorage(api, items=models, api_kwargs=api_kwargs or {})
 
 
-def application_resource_storage(driver):
+def application_resource_storage(api, api_kwargs=None):
 """
-Initiate resource storage for the supplied storage driver
+Initiate resource storage
 """
-if driver not in _resource_storage:
-_resource_storage[driver] = storage.ResourceStorage(
-driver,
-resources=[
-'blueprint',
-'deployment',
-'plugin',
-'snapshot',
-])
-return _resource_storage[driver]
+return storage.ResourceStorage(
+api,
+api_kwargs=api_kwargs or {},
+items=[
+'blueprint',
+'deployment',
+'plugin',
+])

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/8ec2d1c2/aria/orchestrator/context/common.py
--
diff --git a/aria/orchestrator/context/common.py 
b/aria/orchestrator/context/common.py
index 14efd9d..fdbe152 100644
--- a/aria/orchestrator/context/common.py
+++ b/aria/orchestrator/context/common.py
@@ -29,13 +29,9 @@ class BaseContext(logger.LoggerMixin):
 def __init__(
 self,
 name,
+deployment_id,
 model_storage,
 resource_storage,
-deployment_id,
-workflow_name,
-task_max_attempts=1,
-task_retry_interval=0,
-task_ignore_failure=False,
 **kwargs):
 super(BaseContext, self).__init__(**kwargs)
 self._name = name
@@ -43,16 +39,11 @@ class BaseContext(logger.LoggerMixin):
 self._model = model_storage
 self._resource = resource_storage
 self._deployment_id = deployment_id
-self._workflow_name = workflow_name
-self._task_max_attempts = task_max_attempts
-self._task_retry_interval = task_retry_interval
-self._task_ignore_failure = task_ignore_failure
 
 def __repr__(self):
 return (
 '{name}(name={self.name}, '
 'deployment_id={self._deployment_id}, '
-'workflow_name={self._workflow_name}, '
 .format(name=self.__class__.__name__, self=self))
 
 @property


[GitHub] incubator-ariatosca pull request #35: Provide (initial) means for serializin...

2016-12-21 Thread dankilman
GitHub user dankilman opened a pull request:

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

Provide (initial) means for serializing an operation context object



You can merge this pull request into a Git repository by running:

$ git pull https://github.com/apache/incubator-ariatosca 
ARIA-40-serialize-context-data

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/incubator-ariatosca/pull/35.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 #35


commit 7b11deb7f2dc759e636ef7fa28194a48a6fa21b6
Author: Dan Kilman <d...@gigaspaces.com>
Date:   2016-12-19T15:05:54Z

Provide (initial) means for serializing an operation context object




---
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: Provide (initial) means for serializing an operation context object

2016-12-21 Thread dankilman
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-40-serialize-context-data [created] 7b11deb7f


Provide (initial) means for serializing an operation context object


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

Branch: refs/heads/ARIA-40-serialize-context-data
Commit: 7b11deb7f2dc759e636ef7fa28194a48a6fa21b6
Parents: 5cf84ee
Author: Dan Kilman 
Authored: Mon Dec 19 17:05:54 2016 +0200
Committer: Dan Kilman 
Committed: Wed Dec 21 16:02:02 2016 +0200

--
 aria/__init__.py| 26 +++---
 aria/orchestrator/context/common.py | 11 +--
 aria/orchestrator/context/operation.py  | 21 +++--
 aria/orchestrator/context/serialize.py  | 94 
 aria/orchestrator/context/workflow.py   | 13 ++-
 aria/orchestrator/workflows/core/task.py| 11 ++-
 aria/orchestrator/workflows/events_logging.py   |  6 +-
 aria/orchestrator/workflows/executor/process.py | 22 +++--
 aria/storage/filesystem_rapi.py |  5 +-
 tests/__init__.py   |  4 +
 tests/mock/context.py   | 18 +++-
 tests/orchestrator/context/test_serialize.py| 77 
 .../orchestrator/workflows/core/test_engine.py  |  1 +
 .../workflows/executor/test_executor.py | 19 ++--
 .../workflows/executor/test_process_executor.py | 11 ++-
 15 files changed, 279 insertions(+), 60 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/7b11deb7/aria/__init__.py
--
diff --git a/aria/__init__.py b/aria/__init__.py
index 0f7bec6..cc362c0 100644
--- a/aria/__init__.py
+++ b/aria/__init__.py
@@ -41,8 +41,6 @@ __all__ = (
 'operation',
 )
 
-_resource_storage = {}
-
 
 def install_aria_extensions():
 """
@@ -61,7 +59,7 @@ def install_aria_extensions():
 
 def application_model_storage(api, api_kwargs=None):
 """
-Initiate model storage for the supplied storage driver
+Initiate model storage
 """
 models = [
 storage.models.Plugin,
@@ -85,17 +83,15 @@ def application_model_storage(api, api_kwargs=None):
 return storage.ModelStorage(api, items=models, api_kwargs=api_kwargs or {})
 
 
-def application_resource_storage(driver):
+def application_resource_storage(api, api_kwargs=None):
 """
-Initiate resource storage for the supplied storage driver
+Initiate resource storage
 """
-if driver not in _resource_storage:
-_resource_storage[driver] = storage.ResourceStorage(
-driver,
-resources=[
-'blueprint',
-'deployment',
-'plugin',
-'snapshot',
-])
-return _resource_storage[driver]
+return storage.ResourceStorage(
+api,
+api_kwargs=api_kwargs or {},
+items=[
+'blueprint',
+'deployment',
+'plugin',
+])

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/7b11deb7/aria/orchestrator/context/common.py
--
diff --git a/aria/orchestrator/context/common.py 
b/aria/orchestrator/context/common.py
index 14efd9d..fdbe152 100644
--- a/aria/orchestrator/context/common.py
+++ b/aria/orchestrator/context/common.py
@@ -29,13 +29,9 @@ class BaseContext(logger.LoggerMixin):
 def __init__(
 self,
 name,
+deployment_id,
 model_storage,
 resource_storage,
-deployment_id,
-workflow_name,
-task_max_attempts=1,
-task_retry_interval=0,
-task_ignore_failure=False,
 **kwargs):
 super(BaseContext, self).__init__(**kwargs)
 self._name = name
@@ -43,16 +39,11 @@ class BaseContext(logger.LoggerMixin):
 self._model = model_storage
 self._resource = resource_storage
 self._deployment_id = deployment_id
-self._workflow_name = workflow_name
-self._task_max_attempts = task_max_attempts
-self._task_retry_interval = task_retry_interval
-self._task_ignore_failure = task_ignore_failure
 
 def __repr__(self):
 return (
 '{name}(name={self.name}, '
 'deployment_id={self._deployment_id}, '
-'workflow_name={self._workflow_name}, '
 .format(name=self.__class__.__name__, self=self))
 
 @property


incubator-ariatosca git commit: ARIA-26 Implement operation plugin mechanism

2016-12-19 Thread dankilman
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/master 04c9bd079 -> 5cf84eebe


ARIA-26 Implement operation plugin 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/5cf84eeb
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/5cf84eeb
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/5cf84eeb

Branch: refs/heads/master
Commit: 5cf84eebe425bbade0d9285081cebf5d0a62a675
Parents: 04c9bd0
Author: Dan Kilman 
Authored: Sun Nov 27 16:31:29 2016 +0200
Committer: Dan Kilman 
Committed: Mon Dec 19 15:47:38 2016 +0200

--
 aria/cli/commands.py|   4 +-
 aria/orchestrator/exceptions.py |   7 +
 aria/orchestrator/plugin.py | 105 +++
 aria/orchestrator/workflows/api/task.py |  44 ++-
 aria/orchestrator/workflows/core/task.py|  12 +-
 .../orchestrator/workflows/executor/__init__.py |   2 +-
 aria/orchestrator/workflows/executor/base.py|   6 +-
 .../orchestrator/workflows/executor/blocking.py |  36 ---
 .../workflows/executor/multiprocess.py  |  98 ---
 aria/orchestrator/workflows/executor/process.py | 277 +++
 aria/orchestrator/workflows/executor/thread.py  |   4 +-
 aria/storage/models.py  |  15 +-
 aria/utils/plugin.py|  20 ++
 requirements.txt|   3 +-
 tests/mock/models.py|  16 ++
 tests/orchestrator/workflows/api/test_task.py   |  51 +++-
 tests/orchestrator/workflows/core/test_task.py  |  16 +-
 .../workflows/executor/test_executor.py | 111 
 .../workflows/executor/test_process_executor.py | 130 +
 tests/resources/__init__.py |  19 ++
 .../plugins/mock-plugin1/mock_plugin1.py|  27 ++
 tests/resources/plugins/mock-plugin1/setup.py   |  28 ++
 tests/storage/test_models.py| 188 ++---
 tests/utils/__init__.py |  14 +
 tests/utils/test_plugin.py  |  77 ++
 25 files changed, 990 insertions(+), 320 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/5cf84eeb/aria/cli/commands.py
--
diff --git a/aria/cli/commands.py b/aria/cli/commands.py
index 141da07..1cd765f 100644
--- a/aria/cli/commands.py
+++ b/aria/cli/commands.py
@@ -34,7 +34,7 @@ from ..logger import LoggerMixin
 from ..storage import (FileSystemModelDriver, FileSystemResourceDriver)
 from ..orchestrator.context.workflow import WorkflowContext
 from ..orchestrator.workflows.core.engine import Engine
-from ..orchestrator.workflows.executor.thread import ThreadExecutor
+from ..orchestrator.workflows.executor.process import ProcessExecutor
 from ..parser import iter_specifications
 from ..parser.consumption import (
 ConsumptionContext,
@@ -252,7 +252,7 @@ class ExecuteCommand(BaseCommand):
 )
 workflow_function = self._load_workflow_handler(workflow['operation'])
 tasks_graph = workflow_function(workflow_context, 
**workflow_context.parameters)
-executor = ThreadExecutor()
+executor = ProcessExecutor()
 workflow_engine = Engine(executor=executor,
  workflow_context=workflow_context,
  tasks_graph=tasks_graph)

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/5cf84eeb/aria/orchestrator/exceptions.py
--
diff --git a/aria/orchestrator/exceptions.py b/aria/orchestrator/exceptions.py
index 1a48194..74e9002 100644
--- a/aria/orchestrator/exceptions.py
+++ b/aria/orchestrator/exceptions.py
@@ -23,3 +23,10 @@ class OrchestratorError(AriaError):
 Orchestrator based exception
 """
 pass
+
+
+class PluginAlreadyExistsError(AriaError):
+"""
+Raised when a plugin with the same package name and package version 
already exists
+"""
+pass

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/5cf84eeb/aria/orchestrator/plugin.py
--
diff --git a/aria/orchestrator/plugin.py b/aria/orchestrator/plugin.py
new file mode 100644
index 000..3005756
--- /dev/null
+++ b/aria/orchestrator/plugin.py
@@ -0,0 +1,105 @@
+# 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 

incubator-ariatosca git commit: ARIA-26 Implement operation plugin mechanism [Forced Update!]

2016-12-19 Thread dankilman
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-26-plugin-mechanism 9d626da95 -> 5cf84eebe (forced update)


ARIA-26 Implement operation plugin 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/5cf84eeb
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/5cf84eeb
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/5cf84eeb

Branch: refs/heads/ARIA-26-plugin-mechanism
Commit: 5cf84eebe425bbade0d9285081cebf5d0a62a675
Parents: 04c9bd0
Author: Dan Kilman 
Authored: Sun Nov 27 16:31:29 2016 +0200
Committer: Dan Kilman 
Committed: Mon Dec 19 15:47:38 2016 +0200

--
 aria/cli/commands.py|   4 +-
 aria/orchestrator/exceptions.py |   7 +
 aria/orchestrator/plugin.py | 105 +++
 aria/orchestrator/workflows/api/task.py |  44 ++-
 aria/orchestrator/workflows/core/task.py|  12 +-
 .../orchestrator/workflows/executor/__init__.py |   2 +-
 aria/orchestrator/workflows/executor/base.py|   6 +-
 .../orchestrator/workflows/executor/blocking.py |  36 ---
 .../workflows/executor/multiprocess.py  |  98 ---
 aria/orchestrator/workflows/executor/process.py | 277 +++
 aria/orchestrator/workflows/executor/thread.py  |   4 +-
 aria/storage/models.py  |  15 +-
 aria/utils/plugin.py|  20 ++
 requirements.txt|   3 +-
 tests/mock/models.py|  16 ++
 tests/orchestrator/workflows/api/test_task.py   |  51 +++-
 tests/orchestrator/workflows/core/test_task.py  |  16 +-
 .../workflows/executor/test_executor.py | 111 
 .../workflows/executor/test_process_executor.py | 130 +
 tests/resources/__init__.py |  19 ++
 .../plugins/mock-plugin1/mock_plugin1.py|  27 ++
 tests/resources/plugins/mock-plugin1/setup.py   |  28 ++
 tests/storage/test_models.py| 188 ++---
 tests/utils/__init__.py |  14 +
 tests/utils/test_plugin.py  |  77 ++
 25 files changed, 990 insertions(+), 320 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/5cf84eeb/aria/cli/commands.py
--
diff --git a/aria/cli/commands.py b/aria/cli/commands.py
index 141da07..1cd765f 100644
--- a/aria/cli/commands.py
+++ b/aria/cli/commands.py
@@ -34,7 +34,7 @@ from ..logger import LoggerMixin
 from ..storage import (FileSystemModelDriver, FileSystemResourceDriver)
 from ..orchestrator.context.workflow import WorkflowContext
 from ..orchestrator.workflows.core.engine import Engine
-from ..orchestrator.workflows.executor.thread import ThreadExecutor
+from ..orchestrator.workflows.executor.process import ProcessExecutor
 from ..parser import iter_specifications
 from ..parser.consumption import (
 ConsumptionContext,
@@ -252,7 +252,7 @@ class ExecuteCommand(BaseCommand):
 )
 workflow_function = self._load_workflow_handler(workflow['operation'])
 tasks_graph = workflow_function(workflow_context, 
**workflow_context.parameters)
-executor = ThreadExecutor()
+executor = ProcessExecutor()
 workflow_engine = Engine(executor=executor,
  workflow_context=workflow_context,
  tasks_graph=tasks_graph)

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/5cf84eeb/aria/orchestrator/exceptions.py
--
diff --git a/aria/orchestrator/exceptions.py b/aria/orchestrator/exceptions.py
index 1a48194..74e9002 100644
--- a/aria/orchestrator/exceptions.py
+++ b/aria/orchestrator/exceptions.py
@@ -23,3 +23,10 @@ class OrchestratorError(AriaError):
 Orchestrator based exception
 """
 pass
+
+
+class PluginAlreadyExistsError(AriaError):
+"""
+Raised when a plugin with the same package name and package version 
already exists
+"""
+pass

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/5cf84eeb/aria/orchestrator/plugin.py
--
diff --git a/aria/orchestrator/plugin.py b/aria/orchestrator/plugin.py
new file mode 100644
index 000..3005756
--- /dev/null
+++ b/aria/orchestrator/plugin.py
@@ -0,0 +1,105 @@
+# 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 

incubator-ariatosca git commit: ARIA-26 Implement operation plugin mechanism [Forced Update!]

2016-12-19 Thread dankilman
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-26-plugin-mechanism 7eab26c15 -> 9d626da95 (forced update)


ARIA-26 Implement operation plugin 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/9d626da9
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/9d626da9
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/9d626da9

Branch: refs/heads/ARIA-26-plugin-mechanism
Commit: 9d626da95ef39af6e12e152e0b9b12130eecc860
Parents: 04c9bd0
Author: Dan Kilman 
Authored: Sun Nov 27 16:31:29 2016 +0200
Committer: Dan Kilman 
Committed: Mon Dec 19 14:07:23 2016 +0200

--
 aria/cli/commands.py|   4 +-
 aria/orchestrator/exceptions.py |   7 +
 aria/orchestrator/plugin.py |  84 +++
 aria/orchestrator/workflows/api/task.py |  42 +++-
 aria/orchestrator/workflows/core/task.py|  10 +-
 .../orchestrator/workflows/executor/__init__.py |   2 +-
 aria/orchestrator/workflows/executor/base.py|   6 +-
 .../orchestrator/workflows/executor/blocking.py |  36 ---
 .../workflows/executor/multiprocess.py  |  98 
 aria/orchestrator/workflows/executor/process.py | 226 +++
 aria/orchestrator/workflows/executor/thread.py  |   4 +-
 aria/storage/models.py  |  15 +-
 aria/utils/plugin.py|  20 ++
 requirements.txt|   3 +-
 tests/mock/models.py|  16 ++
 tests/orchestrator/workflows/api/test_task.py   |  51 -
 tests/orchestrator/workflows/core/test_task.py  |  16 +-
 .../workflows/executor/test_executor.py | 111 -
 .../workflows/executor/test_process_executor.py | 121 ++
 tests/resources/__init__.py |  19 ++
 .../plugins/mock-plugin1/mock_plugin1.py|  27 +++
 tests/resources/plugins/mock-plugin1/setup.py   |  28 +++
 tests/storage/test_models.py| 188 +++
 tests/utils/__init__.py |  14 ++
 tests/utils/test_plugin.py  |  77 +++
 25 files changed, 905 insertions(+), 320 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/9d626da9/aria/cli/commands.py
--
diff --git a/aria/cli/commands.py b/aria/cli/commands.py
index 141da07..1cd765f 100644
--- a/aria/cli/commands.py
+++ b/aria/cli/commands.py
@@ -34,7 +34,7 @@ from ..logger import LoggerMixin
 from ..storage import (FileSystemModelDriver, FileSystemResourceDriver)
 from ..orchestrator.context.workflow import WorkflowContext
 from ..orchestrator.workflows.core.engine import Engine
-from ..orchestrator.workflows.executor.thread import ThreadExecutor
+from ..orchestrator.workflows.executor.process import ProcessExecutor
 from ..parser import iter_specifications
 from ..parser.consumption import (
 ConsumptionContext,
@@ -252,7 +252,7 @@ class ExecuteCommand(BaseCommand):
 )
 workflow_function = self._load_workflow_handler(workflow['operation'])
 tasks_graph = workflow_function(workflow_context, 
**workflow_context.parameters)
-executor = ThreadExecutor()
+executor = ProcessExecutor()
 workflow_engine = Engine(executor=executor,
  workflow_context=workflow_context,
  tasks_graph=tasks_graph)

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/9d626da9/aria/orchestrator/exceptions.py
--
diff --git a/aria/orchestrator/exceptions.py b/aria/orchestrator/exceptions.py
index 1a48194..74e9002 100644
--- a/aria/orchestrator/exceptions.py
+++ b/aria/orchestrator/exceptions.py
@@ -23,3 +23,10 @@ class OrchestratorError(AriaError):
 Orchestrator based exception
 """
 pass
+
+
+class PluginAlreadyExistsError(AriaError):
+"""
+Raised when a plugin with the same package name and package version 
already exists
+"""
+pass

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/9d626da9/aria/orchestrator/plugin.py
--
diff --git a/aria/orchestrator/plugin.py b/aria/orchestrator/plugin.py
new file mode 100644
index 000..4161af4
--- /dev/null
+++ b/aria/orchestrator/plugin.py
@@ -0,0 +1,84 @@
+# 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 

incubator-ariatosca git commit: ARIA-26 Implement operation plugin mechanism [Forced Update!]

2016-12-19 Thread dankilman
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-26-plugin-mechanism 93d68b58c -> 7eab26c15 (forced update)


ARIA-26 Implement operation plugin 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/7eab26c1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/7eab26c1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/7eab26c1

Branch: refs/heads/ARIA-26-plugin-mechanism
Commit: 7eab26c1511e36987fb26c275c261b7b828772c0
Parents: 04c9bd0
Author: Dan Kilman 
Authored: Sun Nov 27 16:31:29 2016 +0200
Committer: Dan Kilman 
Committed: Mon Dec 19 13:14:30 2016 +0200

--
 aria/cli/commands.py|   4 +-
 aria/orchestrator/exceptions.py |   7 +
 aria/orchestrator/plugin.py |  84 +++
 aria/orchestrator/workflows/api/task.py |  42 +++-
 aria/orchestrator/workflows/core/task.py|  10 +-
 .../orchestrator/workflows/executor/__init__.py |   2 +-
 aria/orchestrator/workflows/executor/base.py|   6 +-
 .../orchestrator/workflows/executor/blocking.py |  36 ---
 .../workflows/executor/multiprocess.py  |  98 -
 aria/orchestrator/workflows/executor/process.py | 219 +++
 aria/orchestrator/workflows/executor/thread.py  |   4 +-
 aria/storage/models.py  |  15 +-
 aria/utils/plugin.py|  20 ++
 requirements.txt|   3 +-
 tests/mock/models.py|  16 ++
 tests/orchestrator/workflows/api/test_task.py   |  51 -
 tests/orchestrator/workflows/core/test_task.py  |  16 +-
 .../workflows/executor/test_executor.py | 111 +-
 .../workflows/executor/test_process_executor.py | 121 ++
 tests/resources/__init__.py |  19 ++
 .../plugins/mock-plugin1/mock_plugin1.py|  27 +++
 tests/resources/plugins/mock-plugin1/setup.py   |  28 +++
 tests/storage/test_models.py| 188 
 tests/utils/__init__.py |  14 ++
 tests/utils/test_plugin.py  |  77 +++
 25 files changed, 898 insertions(+), 320 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/7eab26c1/aria/cli/commands.py
--
diff --git a/aria/cli/commands.py b/aria/cli/commands.py
index 141da07..1cd765f 100644
--- a/aria/cli/commands.py
+++ b/aria/cli/commands.py
@@ -34,7 +34,7 @@ from ..logger import LoggerMixin
 from ..storage import (FileSystemModelDriver, FileSystemResourceDriver)
 from ..orchestrator.context.workflow import WorkflowContext
 from ..orchestrator.workflows.core.engine import Engine
-from ..orchestrator.workflows.executor.thread import ThreadExecutor
+from ..orchestrator.workflows.executor.process import ProcessExecutor
 from ..parser import iter_specifications
 from ..parser.consumption import (
 ConsumptionContext,
@@ -252,7 +252,7 @@ class ExecuteCommand(BaseCommand):
 )
 workflow_function = self._load_workflow_handler(workflow['operation'])
 tasks_graph = workflow_function(workflow_context, 
**workflow_context.parameters)
-executor = ThreadExecutor()
+executor = ProcessExecutor()
 workflow_engine = Engine(executor=executor,
  workflow_context=workflow_context,
  tasks_graph=tasks_graph)

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/7eab26c1/aria/orchestrator/exceptions.py
--
diff --git a/aria/orchestrator/exceptions.py b/aria/orchestrator/exceptions.py
index 1a48194..74e9002 100644
--- a/aria/orchestrator/exceptions.py
+++ b/aria/orchestrator/exceptions.py
@@ -23,3 +23,10 @@ class OrchestratorError(AriaError):
 Orchestrator based exception
 """
 pass
+
+
+class PluginAlreadyExistsError(AriaError):
+"""
+Raised when a plugin with the same package name and package version 
already exists
+"""
+pass

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/7eab26c1/aria/orchestrator/plugin.py
--
diff --git a/aria/orchestrator/plugin.py b/aria/orchestrator/plugin.py
new file mode 100644
index 000..4161af4
--- /dev/null
+++ b/aria/orchestrator/plugin.py
@@ -0,0 +1,84 @@
+# 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 

[GitHub] incubator-ariatosca pull request #34: ARIA-26 Implement operation plugin mec...

2016-12-18 Thread dankilman
Github user dankilman commented on a diff in the pull request:

https://github.com/apache/incubator-ariatosca/pull/34#discussion_r92946871
  
--- Diff: tests/utils/test_plugin.py ---
@@ -0,0 +1,75 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import os
+
+import pytest
+
+from aria import application_model_storage
+from aria.utils import plugin
+from aria.storage.sql_mapi import SQLAlchemyModelAPI
+
+from .. import storage
+
+
+PACKAGE_NAME = 'mock-plugin'
+PACKAGE_VERSION = '100'
+
+
+class TestPluginManager(object):
+
+def test_install(self, plugin_manager, mock_plugin, model, 
plugins_dir):
+plugin = plugin_manager.install(mock_plugin)
+assert plugin.package_name == PACKAGE_NAME
+assert plugin.package_version == PACKAGE_VERSION
+assert plugin == model.plugin.get(plugin.id)
+plugin_prefix = os.path.join(plugins_dir, 
'{0}-{1}'.format(PACKAGE_NAME, PACKAGE_VERSION))
+assert os.path.isdir(plugin_prefix)
+assert plugin_prefix == plugin_manager.get_plugin_prefix(plugin)
+
+def test_install_already_exits(self, plugin_manager, mock_plugin):
+plugin_manager.install(mock_plugin)
+with pytest.raises(RuntimeError):
--- End diff --

exception 


---
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.
---


[GitHub] incubator-ariatosca pull request #34: ARIA-26 Implement operation plugin mec...

2016-12-18 Thread dankilman
Github user dankilman commented on a diff in the pull request:

https://github.com/apache/incubator-ariatosca/pull/34#discussion_r92946339
  
--- Diff: aria/orchestrator/workflows/executor/thread.py ---
@@ -26,7 +26,8 @@
 
 class ThreadExecutor(BaseExecutor):
 """
-Executor which runs tasks in a separate thread
+Executor which runs tasks in a separate thread. It's easier writing 
tests
+using this executor rather than the full blown subprocess executor.
--- End diff --

tell this is not relevant for running operations


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


incubator-ariatosca git commit: ARIA-26 Implement operation plugin mechanism [Forced Update!]

2016-12-18 Thread dankilman
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-26-plugin-mechanism 7068d0f11 -> 93d68b58c (forced update)


ARIA-26 Implement operation plugin 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/93d68b58
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/93d68b58
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/93d68b58

Branch: refs/heads/ARIA-26-plugin-mechanism
Commit: 93d68b58c3a0ba20057f006e7bb990d597f2def8
Parents: 04c9bd0
Author: Dan Kilman 
Authored: Sun Nov 27 16:31:29 2016 +0200
Committer: Dan Kilman 
Committed: Sun Dec 18 17:21:16 2016 +0200

--
 aria/cli/commands.py|   4 +-
 aria/orchestrator/workflows/api/task.py |  42 +++-
 aria/orchestrator/workflows/core/task.py|  10 +-
 .../orchestrator/workflows/executor/__init__.py |   2 +-
 aria/orchestrator/workflows/executor/base.py|   6 +-
 .../orchestrator/workflows/executor/blocking.py |  36 ---
 .../workflows/executor/multiprocess.py  |  98 -
 aria/orchestrator/workflows/executor/process.py | 219 +++
 aria/orchestrator/workflows/executor/thread.py  |   3 +-
 aria/storage/models.py  |  15 +-
 aria/utils/plugin.py|  86 
 requirements.txt|   3 +-
 setup.py|   3 +-
 tests/mock/models.py|  16 ++
 tests/orchestrator/workflows/api/test_task.py   |  51 -
 tests/orchestrator/workflows/core/test_task.py  |  16 +-
 .../workflows/executor/test_executor.py | 111 +-
 .../workflows/executor/test_process_executor.py | 120 ++
 tests/resources/__init__.py |  19 ++
 .../plugins/mock-plugin1/mock_plugin1.py|  27 +++
 tests/resources/plugins/mock-plugin1/setup.py   |  28 +++
 tests/storage/test_models.py| 188 
 tests/utils/__init__.py |  14 ++
 tests/utils/test_plugin.py  |  75 +++
 24 files changed, 871 insertions(+), 321 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/93d68b58/aria/cli/commands.py
--
diff --git a/aria/cli/commands.py b/aria/cli/commands.py
index 141da07..1cd765f 100644
--- a/aria/cli/commands.py
+++ b/aria/cli/commands.py
@@ -34,7 +34,7 @@ from ..logger import LoggerMixin
 from ..storage import (FileSystemModelDriver, FileSystemResourceDriver)
 from ..orchestrator.context.workflow import WorkflowContext
 from ..orchestrator.workflows.core.engine import Engine
-from ..orchestrator.workflows.executor.thread import ThreadExecutor
+from ..orchestrator.workflows.executor.process import ProcessExecutor
 from ..parser import iter_specifications
 from ..parser.consumption import (
 ConsumptionContext,
@@ -252,7 +252,7 @@ class ExecuteCommand(BaseCommand):
 )
 workflow_function = self._load_workflow_handler(workflow['operation'])
 tasks_graph = workflow_function(workflow_context, 
**workflow_context.parameters)
-executor = ThreadExecutor()
+executor = ProcessExecutor()
 workflow_engine = Engine(executor=executor,
  workflow_context=workflow_context,
  tasks_graph=tasks_graph)

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/93d68b58/aria/orchestrator/workflows/api/task.py
--
diff --git a/aria/orchestrator/workflows/api/task.py 
b/aria/orchestrator/workflows/api/task.py
index 1c12407..70f9773 100644
--- a/aria/orchestrator/workflows/api/task.py
+++ b/aria/orchestrator/workflows/api/task.py
@@ -67,11 +67,11 @@ class OperationTask(BaseTask):
  max_attempts=None,
  retry_interval=None,
  ignore_failure=None,
- inputs=None):
+ inputs=None,
+ plugin=None):
 """
 Creates an operation task using the name, details, node instance and 
any additional kwargs.
 :param name: the operation of the name.
-:param operation_details: the details for the operation.
 :param actor: the operation host on which this operation is registered.
 :param inputs: operation inputs.
 """
@@ -82,6 +82,7 @@ class OperationTask(BaseTask):
 self.name = '{name}.{actor.id}'.format(name=name, actor=actor)
 self.operation_mapping = operation_mapping
 self.inputs = inputs or {}
+self.plugin = plugin or {}
 

incubator-ariatosca git commit: ARIA-26 Implement operation plugin mechanism [Forced Update!]

2016-12-18 Thread dankilman
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-26-plugin-mechanism 6fa4c66ad -> 7068d0f11 (forced update)


ARIA-26 Implement operation plugin 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/7068d0f1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/7068d0f1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/7068d0f1

Branch: refs/heads/ARIA-26-plugin-mechanism
Commit: 7068d0f11b72a35476e10804980002685d4dc54c
Parents: 04c9bd0
Author: Dan Kilman 
Authored: Sun Nov 27 16:31:29 2016 +0200
Committer: Dan Kilman 
Committed: Sun Dec 18 14:45:09 2016 +0200

--
 aria/cli/commands.py|   4 +-
 aria/orchestrator/workflows/api/task.py |  42 ++--
 aria/orchestrator/workflows/core/task.py|  10 +-
 .../orchestrator/workflows/executor/__init__.py |   2 +-
 .../orchestrator/workflows/executor/blocking.py |  36 
 .../workflows/executor/multiprocess.py  |  98 -
 aria/orchestrator/workflows/executor/process.py | 211 +++
 aria/orchestrator/workflows/executor/thread.py  |   3 +-
 aria/storage/models.py  |  15 +-
 aria/utils/plugin.py|  86 
 requirements.txt|   3 +-
 setup.py|   3 +-
 tests/mock/models.py|  16 ++
 tests/orchestrator/workflows/api/test_task.py   |  51 -
 tests/orchestrator/workflows/core/test_task.py  |  16 +-
 .../workflows/executor/test_executor.py | 111 +-
 .../workflows/executor/test_process_executor.py | 120 +++
 tests/resources/__init__.py |  19 ++
 .../plugins/mock-plugin1/mock_plugin1.py|  27 +++
 tests/resources/plugins/mock-plugin1/setup.py   |  28 +++
 tests/storage/test_models.py| 188 -
 tests/utils/__init__.py |  14 ++
 tests/utils/test_plugin.py  |  75 +++
 23 files changed, 861 insertions(+), 317 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/7068d0f1/aria/cli/commands.py
--
diff --git a/aria/cli/commands.py b/aria/cli/commands.py
index 141da07..1cd765f 100644
--- a/aria/cli/commands.py
+++ b/aria/cli/commands.py
@@ -34,7 +34,7 @@ from ..logger import LoggerMixin
 from ..storage import (FileSystemModelDriver, FileSystemResourceDriver)
 from ..orchestrator.context.workflow import WorkflowContext
 from ..orchestrator.workflows.core.engine import Engine
-from ..orchestrator.workflows.executor.thread import ThreadExecutor
+from ..orchestrator.workflows.executor.process import ProcessExecutor
 from ..parser import iter_specifications
 from ..parser.consumption import (
 ConsumptionContext,
@@ -252,7 +252,7 @@ class ExecuteCommand(BaseCommand):
 )
 workflow_function = self._load_workflow_handler(workflow['operation'])
 tasks_graph = workflow_function(workflow_context, 
**workflow_context.parameters)
-executor = ThreadExecutor()
+executor = ProcessExecutor()
 workflow_engine = Engine(executor=executor,
  workflow_context=workflow_context,
  tasks_graph=tasks_graph)

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/7068d0f1/aria/orchestrator/workflows/api/task.py
--
diff --git a/aria/orchestrator/workflows/api/task.py 
b/aria/orchestrator/workflows/api/task.py
index 1c12407..70f9773 100644
--- a/aria/orchestrator/workflows/api/task.py
+++ b/aria/orchestrator/workflows/api/task.py
@@ -67,11 +67,11 @@ class OperationTask(BaseTask):
  max_attempts=None,
  retry_interval=None,
  ignore_failure=None,
- inputs=None):
+ inputs=None,
+ plugin=None):
 """
 Creates an operation task using the name, details, node instance and 
any additional kwargs.
 :param name: the operation of the name.
-:param operation_details: the details for the operation.
 :param actor: the operation host on which this operation is registered.
 :param inputs: operation inputs.
 """
@@ -82,6 +82,7 @@ class OperationTask(BaseTask):
 self.name = '{name}.{actor.id}'.format(name=name, actor=actor)
 self.operation_mapping = operation_mapping
 self.inputs = inputs or {}
+self.plugin = plugin or {}
 self.max_attempts = 

incubator-ariatosca git commit: ARIA-26 TBD [Forced Update!]

2016-12-18 Thread dankilman
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-26-plugin-mechanism c67a93197 -> 6d9e7254f (forced update)


ARIA-26 TBD


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

Branch: refs/heads/ARIA-26-plugin-mechanism
Commit: 6d9e7254f1f96ec0eb96455f09c9d0b33e4beb64
Parents: 04c9bd0
Author: Dan Kilman 
Authored: Sun Nov 27 16:31:29 2016 +0200
Committer: Dan Kilman 
Committed: Sun Dec 18 12:51:20 2016 +0200

--
 aria/cli/commands.py|   4 +-
 aria/orchestrator/workflows/api/task.py |  42 ++--
 aria/orchestrator/workflows/core/task.py|  10 +-
 .../orchestrator/workflows/executor/__init__.py |   2 +-
 .../orchestrator/workflows/executor/blocking.py |  36 
 .../workflows/executor/multiprocess.py  |  98 -
 aria/orchestrator/workflows/executor/process.py | 204 +++
 aria/orchestrator/workflows/executor/thread.py  |   3 +-
 aria/storage/models.py  |  15 +-
 aria/utils/plugin.py|  86 
 requirements.txt|   3 +-
 setup.py|   3 +-
 tests/mock/models.py|  16 ++
 tests/orchestrator/workflows/api/test_task.py   |  51 -
 tests/orchestrator/workflows/core/test_task.py  |  16 +-
 .../workflows/executor/test_executor.py | 107 +-
 .../workflows/executor/test_process_executor.py |  96 +
 tests/resources/__init__.py |  19 ++
 .../plugins/mock-plugin1/mock_plugin1.py|  27 +++
 tests/resources/plugins/mock-plugin1/setup.py   |  28 +++
 tests/storage/test_models.py| 188 -
 tests/utils/__init__.py |  14 ++
 tests/utils/test_plugin.py  |  75 +++
 23 files changed, 826 insertions(+), 317 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/6d9e7254/aria/cli/commands.py
--
diff --git a/aria/cli/commands.py b/aria/cli/commands.py
index 141da07..1cd765f 100644
--- a/aria/cli/commands.py
+++ b/aria/cli/commands.py
@@ -34,7 +34,7 @@ from ..logger import LoggerMixin
 from ..storage import (FileSystemModelDriver, FileSystemResourceDriver)
 from ..orchestrator.context.workflow import WorkflowContext
 from ..orchestrator.workflows.core.engine import Engine
-from ..orchestrator.workflows.executor.thread import ThreadExecutor
+from ..orchestrator.workflows.executor.process import ProcessExecutor
 from ..parser import iter_specifications
 from ..parser.consumption import (
 ConsumptionContext,
@@ -252,7 +252,7 @@ class ExecuteCommand(BaseCommand):
 )
 workflow_function = self._load_workflow_handler(workflow['operation'])
 tasks_graph = workflow_function(workflow_context, 
**workflow_context.parameters)
-executor = ThreadExecutor()
+executor = ProcessExecutor()
 workflow_engine = Engine(executor=executor,
  workflow_context=workflow_context,
  tasks_graph=tasks_graph)

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/6d9e7254/aria/orchestrator/workflows/api/task.py
--
diff --git a/aria/orchestrator/workflows/api/task.py 
b/aria/orchestrator/workflows/api/task.py
index 1c12407..70f9773 100644
--- a/aria/orchestrator/workflows/api/task.py
+++ b/aria/orchestrator/workflows/api/task.py
@@ -67,11 +67,11 @@ class OperationTask(BaseTask):
  max_attempts=None,
  retry_interval=None,
  ignore_failure=None,
- inputs=None):
+ inputs=None,
+ plugin=None):
 """
 Creates an operation task using the name, details, node instance and 
any additional kwargs.
 :param name: the operation of the name.
-:param operation_details: the details for the operation.
 :param actor: the operation host on which this operation is registered.
 :param inputs: operation inputs.
 """
@@ -82,6 +82,7 @@ class OperationTask(BaseTask):
 self.name = '{name}.{actor.id}'.format(name=name, actor=actor)
 self.operation_mapping = operation_mapping
 self.inputs = inputs or {}
+self.plugin = plugin or {}
 self.max_attempts = (self.workflow_context._task_max_attempts

incubator-ariatosca git commit: ARIA-26 TBD [Forced Update!]

2016-12-18 Thread dankilman
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-26-plugin-mechanism d68fefb54 -> c67a93197 (forced update)


ARIA-26 TBD


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

Branch: refs/heads/ARIA-26-plugin-mechanism
Commit: c67a931974ec9d5a9c6dae38b5824a660fc6396c
Parents: 04c9bd0
Author: Dan Kilman 
Authored: Sun Nov 27 16:31:29 2016 +0200
Committer: Dan Kilman 
Committed: Sun Dec 18 12:40:37 2016 +0200

--
 aria/cli/commands.py|   4 +-
 aria/orchestrator/workflows/api/task.py |  42 +++--
 aria/orchestrator/workflows/core/task.py|  10 +-
 .../orchestrator/workflows/executor/__init__.py |   2 +-
 .../orchestrator/workflows/executor/blocking.py |  36 
 .../workflows/executor/multiprocess.py  |  98 --
 aria/orchestrator/workflows/executor/process.py | 183 ++
 aria/orchestrator/workflows/executor/thread.py  |   3 +-
 aria/storage/models.py  |  15 +-
 aria/utils/plugin.py|  86 +
 requirements.txt|   3 +-
 setup.py|   3 +-
 tests/mock/models.py|  16 ++
 tests/orchestrator/workflows/api/test_task.py   |  51 -
 tests/orchestrator/workflows/core/test_task.py  |  16 +-
 .../workflows/executor/test_executor.py | 111 +--
 .../workflows/executor/test_process_executor.py |  96 ++
 tests/resources/__init__.py |  19 ++
 .../plugins/mock-plugin1/mock_plugin1.py|  27 +++
 tests/resources/plugins/mock-plugin1/setup.py   |  28 +++
 tests/storage/test_models.py| 188 +--
 tests/utils/__init__.py |  14 ++
 tests/utils/test_plugin.py  |  75 
 23 files changed, 809 insertions(+), 317 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/c67a9319/aria/cli/commands.py
--
diff --git a/aria/cli/commands.py b/aria/cli/commands.py
index 141da07..1cd765f 100644
--- a/aria/cli/commands.py
+++ b/aria/cli/commands.py
@@ -34,7 +34,7 @@ from ..logger import LoggerMixin
 from ..storage import (FileSystemModelDriver, FileSystemResourceDriver)
 from ..orchestrator.context.workflow import WorkflowContext
 from ..orchestrator.workflows.core.engine import Engine
-from ..orchestrator.workflows.executor.thread import ThreadExecutor
+from ..orchestrator.workflows.executor.process import ProcessExecutor
 from ..parser import iter_specifications
 from ..parser.consumption import (
 ConsumptionContext,
@@ -252,7 +252,7 @@ class ExecuteCommand(BaseCommand):
 )
 workflow_function = self._load_workflow_handler(workflow['operation'])
 tasks_graph = workflow_function(workflow_context, 
**workflow_context.parameters)
-executor = ThreadExecutor()
+executor = ProcessExecutor()
 workflow_engine = Engine(executor=executor,
  workflow_context=workflow_context,
  tasks_graph=tasks_graph)

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/c67a9319/aria/orchestrator/workflows/api/task.py
--
diff --git a/aria/orchestrator/workflows/api/task.py 
b/aria/orchestrator/workflows/api/task.py
index 1c12407..70f9773 100644
--- a/aria/orchestrator/workflows/api/task.py
+++ b/aria/orchestrator/workflows/api/task.py
@@ -67,11 +67,11 @@ class OperationTask(BaseTask):
  max_attempts=None,
  retry_interval=None,
  ignore_failure=None,
- inputs=None):
+ inputs=None,
+ plugin=None):
 """
 Creates an operation task using the name, details, node instance and 
any additional kwargs.
 :param name: the operation of the name.
-:param operation_details: the details for the operation.
 :param actor: the operation host on which this operation is registered.
 :param inputs: operation inputs.
 """
@@ -82,6 +82,7 @@ class OperationTask(BaseTask):
 self.name = '{name}.{actor.id}'.format(name=name, actor=actor)
 self.operation_mapping = operation_mapping
 self.inputs = inputs or {}
+self.plugin = plugin or {}
 self.max_attempts = (self.workflow_context._task_max_attempts
 

incubator-ariatosca git commit: ARIA-26 TBD [Forced Update!]

2016-12-14 Thread dankilman
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-26-plugin-mechanism d12c00711 -> d68fefb54 (forced update)


ARIA-26 TBD


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

Branch: refs/heads/ARIA-26-plugin-mechanism
Commit: d68fefb54c326c5089caf0beb2392c472a99da7d
Parents: 04c9bd0
Author: Dan Kilman 
Authored: Sun Nov 27 16:31:29 2016 +0200
Committer: Dan Kilman 
Committed: Wed Dec 14 20:06:14 2016 +0200

--
 aria/cli/commands.py|   4 +-
 aria/orchestrator/workflows/api/task.py |  42 +++--
 aria/orchestrator/workflows/core/task.py|  10 +-
 .../orchestrator/workflows/executor/__init__.py |   2 +-
 .../orchestrator/workflows/executor/blocking.py |  36 
 .../workflows/executor/multiprocess.py  |  97 ++
 aria/orchestrator/workflows/executor/thread.py  |   3 +-
 aria/storage/models.py  |  15 +-
 aria/utils/plugin.py|  86 +
 requirements.txt|   3 +-
 tests/mock/models.py|  16 ++
 tests/orchestrator/workflows/api/test_task.py   |  51 -
 tests/orchestrator/workflows/core/test_task.py  |  16 +-
 .../workflows/executor/test_executor.py | 106 +--
 .../executor/test_multiprocess_executor.py  |  88 +
 tests/resources/__init__.py |  19 ++
 .../plugins/mock-plugin1/mock_plugin1.py|  27 +++
 tests/resources/plugins/mock-plugin1/setup.py   |  28 +++
 tests/storage/test_models.py| 188 +--
 tests/utils/__init__.py |  14 ++
 tests/utils/test_plugin.py  |  75 
 21 files changed, 675 insertions(+), 251 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/d68fefb5/aria/cli/commands.py
--
diff --git a/aria/cli/commands.py b/aria/cli/commands.py
index 141da07..825be68 100644
--- a/aria/cli/commands.py
+++ b/aria/cli/commands.py
@@ -34,7 +34,7 @@ from ..logger import LoggerMixin
 from ..storage import (FileSystemModelDriver, FileSystemResourceDriver)
 from ..orchestrator.context.workflow import WorkflowContext
 from ..orchestrator.workflows.core.engine import Engine
-from ..orchestrator.workflows.executor.thread import ThreadExecutor
+from ..orchestrator.workflows.executor.multiprocess import MultiprocessExecutor
 from ..parser import iter_specifications
 from ..parser.consumption import (
 ConsumptionContext,
@@ -252,7 +252,7 @@ class ExecuteCommand(BaseCommand):
 )
 workflow_function = self._load_workflow_handler(workflow['operation'])
 tasks_graph = workflow_function(workflow_context, 
**workflow_context.parameters)
-executor = ThreadExecutor()
+executor = MultiprocessExecutor()
 workflow_engine = Engine(executor=executor,
  workflow_context=workflow_context,
  tasks_graph=tasks_graph)

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/d68fefb5/aria/orchestrator/workflows/api/task.py
--
diff --git a/aria/orchestrator/workflows/api/task.py 
b/aria/orchestrator/workflows/api/task.py
index 1c12407..70f9773 100644
--- a/aria/orchestrator/workflows/api/task.py
+++ b/aria/orchestrator/workflows/api/task.py
@@ -67,11 +67,11 @@ class OperationTask(BaseTask):
  max_attempts=None,
  retry_interval=None,
  ignore_failure=None,
- inputs=None):
+ inputs=None,
+ plugin=None):
 """
 Creates an operation task using the name, details, node instance and 
any additional kwargs.
 :param name: the operation of the name.
-:param operation_details: the details for the operation.
 :param actor: the operation host on which this operation is registered.
 :param inputs: operation inputs.
 """
@@ -82,6 +82,7 @@ class OperationTask(BaseTask):
 self.name = '{name}.{actor.id}'.format(name=name, actor=actor)
 self.operation_mapping = operation_mapping
 self.inputs = inputs or {}
+self.plugin = plugin or {}
 self.max_attempts = (self.workflow_context._task_max_attempts
  if max_attempts is None else max_attempts)
 self.retry_interval = 

  1   2   3   >