[incubator-ariatosca] Git Push Summary
Repository: incubator-ariatosca Updated Branches: refs/heads/ARIA-108-delete-resource-api [deleted] d34721228
[jira] [Commented] (ARIA-108) Add "Delete" API for resources API
[ https://issues.apache.org/jira/browse/ARIA-108?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15873123#comment-15873123 ] ASF GitHub Bot commented on ARIA-108: - Github user asfgit closed the pull request at: https://github.com/apache/incubator-ariatosca/pull/71 > Add "Delete" API for resources API > -- > > Key: ARIA-108 > URL: https://issues.apache.org/jira/browse/ARIA-108 > Project: AriaTosca > Issue Type: Story >Reporter: Ran Ziv >Assignee: Ran Ziv > Fix For: 0.1.0 > > > Resources API currently only has "Upload", "Download", "Read" - it should > also expose "Delete" functionality so removed service template's resources > may be removed once the template has been deleted. -- This message was sent by Atlassian JIRA (v6.3.15#6346)
[jira] [Commented] (ARIA-108) Add "Delete" API for resources API
[ https://issues.apache.org/jira/browse/ARIA-108?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15873122#comment-15873122 ] ASF subversion and git services commented on ARIA-108: -- Commit d347212289e0427f06a6d08097a453c3f0449e4b in incubator-ariatosca's branch refs/heads/master from [~ran] [ https://git-wip-us.apache.org/repos/asf?p=incubator-ariatosca.git;h=d347212 ] ARIA-108 Add API for deleting a resource for resource storage > Add "Delete" API for resources API > -- > > Key: ARIA-108 > URL: https://issues.apache.org/jira/browse/ARIA-108 > Project: AriaTosca > Issue Type: Story >Reporter: Ran Ziv >Assignee: Ran Ziv > Fix For: 0.1.0 > > > Resources API currently only has "Upload", "Download", "Read" - it should > also expose "Delete" functionality so removed service template's resources > may be removed once the template has been deleted. -- This message was sent by Atlassian JIRA (v6.3.15#6346)
[GitHub] incubator-ariatosca pull request #71: ARIA-108 Add API for deleting a resour...
Github user asfgit closed the pull request at: https://github.com/apache/incubator-ariatosca/pull/71 --- 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-108 Add API for deleting a resource for resource storage
Repository: incubator-ariatosca Updated Branches: refs/heads/master 96581d9f9 -> d34721228 ARIA-108 Add API for deleting a resource for resource storage Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/d3472122 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/d3472122 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/d3472122 Branch: refs/heads/master Commit: d347212289e0427f06a6d08097a453c3f0449e4b Parents: 96581d9 Author: Ran ZivAuthored: Thu Feb 16 16:38:51 2017 +0200 Committer: Ran Ziv Committed: Sat Feb 18 13:01:13 2017 +0200 -- aria/storage/api.py| 15 - aria/storage/filesystem_rapi.py| 41 - tests/storage/test_resource_storage.py | 90 - 3 files changed, 129 insertions(+), 17 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/d3472122/aria/storage/api.py -- diff --git a/aria/storage/api.py b/aria/storage/api.py index 09a4dd9..ed8a2ff 100644 --- a/aria/storage/api.py +++ b/aria/storage/api.py @@ -135,7 +135,7 @@ class ResourceAPI(StorageAPI): """ return self._name -def read(self, entry_id, path=None, **kwargs): +def read(self, entry_id, path, **kwargs): """ Get a bytesteam from the storage. @@ -144,7 +144,18 @@ class ResourceAPI(StorageAPI): :param kwargs: :return: """ -raise NotImplementedError('Subclass must implement abstract data method') +raise NotImplementedError('Subclass must implement abstract read method') + +def delete(self, entry_id, path, **kwargs): +""" +Delete a resource from the storage. + +:param entry_id: +:param path: +:param kwargs: +:return: +""" +raise NotImplementedError('Subclass must implement abstract delete method') def download(self, entry_id, destination, path=None, **kwargs): """ http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/d3472122/aria/storage/filesystem_rapi.py -- diff --git a/aria/storage/filesystem_rapi.py b/aria/storage/filesystem_rapi.py index 6693dbd..3ddc520 100644 --- a/aria/storage/filesystem_rapi.py +++ b/aria/storage/filesystem_rapi.py @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. """ -SQLalchemy based RAPI +File system based RAPI """ import os import shutil @@ -92,14 +92,13 @@ class FileSystemResourceAPI(api.ResourceAPI): except (OSError, IOError): pass -def read(self, entry_id, path=None, **_): +def read(self, entry_id, path, **_): """ Retrieve the content of a file system storage resource. -:param str entry_type: the type of the entry. :param str entry_id: the id of the entry. -:param str path: a path to a specific resource. -:return: the content of the file +:param str path: a path to the specific resource to read. +:return: the content of the file. :rtype: bytes """ resource_relative_path = os.path.join(self.name, entry_id, path or '') @@ -110,7 +109,9 @@ class FileSystemResourceAPI(api.ResourceAPI): if not os.path.isfile(resource): resources = os.listdir(resource) if len(resources) != 1: -raise exceptions.StorageError('No resource in path: {0}'.format(resource)) +raise exceptions.StorageError( +'Failed to read {0}; Reading a directory is ' +'only allowed when it contains a single resource'.format(resource)) resource = os.path.join(resource, resources[0]) with open(resource, 'rb') as resource_file: return resource_file.read() @@ -119,10 +120,9 @@ class FileSystemResourceAPI(api.ResourceAPI): """ Download a specific file or dir from the file system resource storage. -:param str entry_type: the name of the entry. -:param str entry_id: the id of the entry -:param str destination: the destination of the files. -:param str path: a path on the remote machine relative to the root of the entry. +:param str entry_id: the id of the entry. +:param str destination: the destination to download to +:param str path: the path to download relative to the root of the entry (otherwise all). """ resource_relative_path = os.path.join(self.name, entry_id, path or '')
[jira] [Resolved] (ARIA-79) Handle attributes update concurrency issues
[ https://issues.apache.org/jira/browse/ARIA-79?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Ran Ziv resolved ARIA-79. - Resolution: Fixed Fix Version/s: 0.1.0 > Handle attributes update concurrency issues > --- > > Key: ARIA-79 > URL: https://issues.apache.org/jira/browse/ARIA-79 > Project: AriaTosca > Issue Type: Bug >Reporter: Ran Ziv >Assignee: Maxim Orlov > Fix For: 0.1.0 > > > Multiple operations may update a node instance's attributes / > runtime-properties concurrently, overriding one another's changes. > Some form of versioning lock should be used to prevent this from happening. -- This message was sent by Atlassian JIRA (v6.3.15#6346)
[jira] [Reopened] (ARIA-88) Add blueprint examples
[ https://issues.apache.org/jira/browse/ARIA-88?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Ran Ziv reopened ARIA-88: - > Add blueprint examples > -- > > Key: ARIA-88 > URL: https://issues.apache.org/jira/browse/ARIA-88 > Project: AriaTosca > Issue Type: Story >Reporter: Ran Ziv >Assignee: Tal Liron >Priority: Minor > Fix For: 0.1.0 > > -- This message was sent by Atlassian JIRA (v6.3.15#6346)
[jira] [Closed] (ARIA-108) Add "Delete" API for resources API
[ https://issues.apache.org/jira/browse/ARIA-108?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Ran Ziv closed ARIA-108. > Add "Delete" API for resources API > -- > > Key: ARIA-108 > URL: https://issues.apache.org/jira/browse/ARIA-108 > Project: AriaTosca > Issue Type: Story >Reporter: Ran Ziv >Assignee: Ran Ziv > Fix For: 0.1.0 > > > Resources API currently only has "Upload", "Download", "Read" - it should > also expose "Delete" functionality so removed service template's resources > may be removed once the template has been deleted. -- This message was sent by Atlassian JIRA (v6.3.15#6346)
[jira] [Resolved] (ARIA-108) Add "Delete" API for resources API
[ https://issues.apache.org/jira/browse/ARIA-108?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Ran Ziv resolved ARIA-108. -- Resolution: Fixed Fix Version/s: 0.1.0 > Add "Delete" API for resources API > -- > > Key: ARIA-108 > URL: https://issues.apache.org/jira/browse/ARIA-108 > Project: AriaTosca > Issue Type: Story >Reporter: Ran Ziv >Assignee: Ran Ziv > Fix For: 0.1.0 > > > Resources API currently only has "Upload", "Download", "Read" - it should > also expose "Delete" functionality so removed service template's resources > may be removed once the template has been deleted. -- This message was sent by Atlassian JIRA (v6.3.15#6346)
[jira] [Closed] (ARIA-79) Handle attributes update concurrency issues
[ https://issues.apache.org/jira/browse/ARIA-79?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Ran Ziv closed ARIA-79. --- > Handle attributes update concurrency issues > --- > > Key: ARIA-79 > URL: https://issues.apache.org/jira/browse/ARIA-79 > Project: AriaTosca > Issue Type: Bug >Reporter: Ran Ziv >Assignee: Maxim Orlov > Fix For: 0.1.0 > > > Multiple operations may update a node instance's attributes / > runtime-properties concurrently, overriding one another's changes. > Some form of versioning lock should be used to prevent this from happening. -- This message was sent by Atlassian JIRA (v6.3.15#6346)
[jira] [Resolved] (ARIA-88) Add blueprint examples
[ https://issues.apache.org/jira/browse/ARIA-88?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Ran Ziv resolved ARIA-88. - Resolution: Fixed Fix Version/s: 0.1.0 > Add blueprint examples > -- > > Key: ARIA-88 > URL: https://issues.apache.org/jira/browse/ARIA-88 > Project: AriaTosca > Issue Type: Story >Reporter: Ran Ziv >Assignee: Tal Liron >Priority: Minor > Fix For: 0.1.0 > > -- This message was sent by Atlassian JIRA (v6.3.15#6346)
[jira] [Closed] (ARIA-88) Add blueprint examples
[ https://issues.apache.org/jira/browse/ARIA-88?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Ran Ziv closed ARIA-88. --- > Add blueprint examples > -- > > Key: ARIA-88 > URL: https://issues.apache.org/jira/browse/ARIA-88 > Project: AriaTosca > Issue Type: Story >Reporter: Ran Ziv >Assignee: Tal Liron >Priority: Minor > Fix For: 0.1.0 > > -- This message was sent by Atlassian JIRA (v6.3.15#6346)
[jira] [Commented] (ARIA-108) Add "Delete" API for resources API
[ https://issues.apache.org/jira/browse/ARIA-108?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15873109#comment-15873109 ] ASF subversion and git services commented on ARIA-108: -- Commit d347212289e0427f06a6d08097a453c3f0449e4b in incubator-ariatosca's branch refs/heads/ARIA-108-delete-resource-api from [~ran] [ https://git-wip-us.apache.org/repos/asf?p=incubator-ariatosca.git;h=d347212 ] ARIA-108 Add API for deleting a resource for resource storage > Add "Delete" API for resources API > -- > > Key: ARIA-108 > URL: https://issues.apache.org/jira/browse/ARIA-108 > Project: AriaTosca > Issue Type: Story >Reporter: Ran Ziv >Assignee: Ran Ziv > > Resources API currently only has "Upload", "Download", "Read" - it should > also expose "Delete" functionality so removed service template's resources > may be removed once the template has been deleted. -- This message was sent by Atlassian JIRA (v6.3.15#6346)
[2/2] incubator-ariatosca git commit: ARIA-108 Add API for deleting a resource for resource storage
ARIA-108 Add API for deleting a resource for resource storage Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/d3472122 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/d3472122 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/d3472122 Branch: refs/heads/ARIA-108-delete-resource-api Commit: d347212289e0427f06a6d08097a453c3f0449e4b Parents: 96581d9 Author: Ran ZivAuthored: Thu Feb 16 16:38:51 2017 +0200 Committer: Ran Ziv Committed: Sat Feb 18 13:01:13 2017 +0200 -- aria/storage/api.py| 15 - aria/storage/filesystem_rapi.py| 41 - tests/storage/test_resource_storage.py | 90 - 3 files changed, 129 insertions(+), 17 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/d3472122/aria/storage/api.py -- diff --git a/aria/storage/api.py b/aria/storage/api.py index 09a4dd9..ed8a2ff 100644 --- a/aria/storage/api.py +++ b/aria/storage/api.py @@ -135,7 +135,7 @@ class ResourceAPI(StorageAPI): """ return self._name -def read(self, entry_id, path=None, **kwargs): +def read(self, entry_id, path, **kwargs): """ Get a bytesteam from the storage. @@ -144,7 +144,18 @@ class ResourceAPI(StorageAPI): :param kwargs: :return: """ -raise NotImplementedError('Subclass must implement abstract data method') +raise NotImplementedError('Subclass must implement abstract read method') + +def delete(self, entry_id, path, **kwargs): +""" +Delete a resource from the storage. + +:param entry_id: +:param path: +:param kwargs: +:return: +""" +raise NotImplementedError('Subclass must implement abstract delete method') def download(self, entry_id, destination, path=None, **kwargs): """ http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/d3472122/aria/storage/filesystem_rapi.py -- diff --git a/aria/storage/filesystem_rapi.py b/aria/storage/filesystem_rapi.py index 6693dbd..3ddc520 100644 --- a/aria/storage/filesystem_rapi.py +++ b/aria/storage/filesystem_rapi.py @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. """ -SQLalchemy based RAPI +File system based RAPI """ import os import shutil @@ -92,14 +92,13 @@ class FileSystemResourceAPI(api.ResourceAPI): except (OSError, IOError): pass -def read(self, entry_id, path=None, **_): +def read(self, entry_id, path, **_): """ Retrieve the content of a file system storage resource. -:param str entry_type: the type of the entry. :param str entry_id: the id of the entry. -:param str path: a path to a specific resource. -:return: the content of the file +:param str path: a path to the specific resource to read. +:return: the content of the file. :rtype: bytes """ resource_relative_path = os.path.join(self.name, entry_id, path or '') @@ -110,7 +109,9 @@ class FileSystemResourceAPI(api.ResourceAPI): if not os.path.isfile(resource): resources = os.listdir(resource) if len(resources) != 1: -raise exceptions.StorageError('No resource in path: {0}'.format(resource)) +raise exceptions.StorageError( +'Failed to read {0}; Reading a directory is ' +'only allowed when it contains a single resource'.format(resource)) resource = os.path.join(resource, resources[0]) with open(resource, 'rb') as resource_file: return resource_file.read() @@ -119,10 +120,9 @@ class FileSystemResourceAPI(api.ResourceAPI): """ Download a specific file or dir from the file system resource storage. -:param str entry_type: the name of the entry. -:param str entry_id: the id of the entry -:param str destination: the destination of the files. -:param str path: a path on the remote machine relative to the root of the entry. +:param str entry_id: the id of the entry. +:param str destination: the destination to download to +:param str path: the path to download relative to the root of the entry (otherwise all). """ resource_relative_path = os.path.join(self.name, entry_id, path or '') resource = os.path.join(self.directory, resource_relative_path) @@ -138,9
[1/2] incubator-ariatosca git commit: ARIA-79-concurrent-modifications [Forced Update!]
Repository: incubator-ariatosca Updated Branches: refs/heads/ARIA-108-delete-resource-api c50557fad -> d34721228 (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/96581d9f Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/96581d9f Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/96581d9f Branch: refs/heads/ARIA-108-delete-resource-api Commit: 96581d9f9b00736d3c83ecda20d2e9f81073d4da Parents: 787d7e7 Author: Dan KilmanAuthored: Mon Jan 30 16:49:00 2017 +0200 Committer: mxmrlv Committed: Fri Feb 17 21:12:36 2017 +0200 -- aria/.pylintrc | 2 +- aria/orchestrator/workflows/executor/process.py | 162 +++--- aria/storage/instrumentation.py | 73 +++-- aria/storage/modeling/instance_elements.py | 5 +- aria/storage/sql_mapi.py| 4 + aria/storage_initializer.py | 1 - tests/mock/models.py| 2 - ...process_executor_concurrent_modifications.py | 164 +++ tests/requirements.txt | 3 +- tests/storage/test_structures.py| 1 - 10 files changed, 338 insertions(+), 79 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/96581d9f/aria/.pylintrc -- diff --git a/aria/.pylintrc b/aria/.pylintrc index ee4d0ef..b7656a3 100644 --- a/aria/.pylintrc +++ b/aria/.pylintrc @@ -250,7 +250,7 @@ docstring-min-length=-1 [ELIF] # Maximum number of nested blocks for function / method body -max-nested-blocks=5 +max-nested-blocks=7 [SIMILARITIES] http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/96581d9f/aria/orchestrator/workflows/executor/process.py -- diff --git a/aria/orchestrator/workflows/executor/process.py b/aria/orchestrator/workflows/executor/process.py index 560ac43..75bbbce 100644 --- a/aria/orchestrator/workflows/executor/process.py +++ b/aria/orchestrator/workflows/executor/process.py @@ -53,6 +53,8 @@ _IS_WIN = os.name == 'nt' _INT_FMT = 'I' _INT_SIZE = struct.calcsize(_INT_FMT) +UPDATE_TRACKED_CHANGES_FAILED_STR = \ +'Some changes failed writing to storage. For more info refer to the log.' class ProcessExecutor(base.BaseExecutor): @@ -74,6 +76,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 +140,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': -
[jira] [Commented] (ARIA-79) Handle attributes update concurrency issues
[ https://issues.apache.org/jira/browse/ARIA-79?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15873106#comment-15873106 ] ASF GitHub Bot commented on ARIA-79: Github user asfgit closed the pull request at: https://github.com/apache/incubator-ariatosca/pull/64 > Handle attributes update concurrency issues > --- > > Key: ARIA-79 > URL: https://issues.apache.org/jira/browse/ARIA-79 > Project: AriaTosca > Issue Type: Bug >Reporter: Ran Ziv >Assignee: Maxim Orlov > > Multiple operations may update a node instance's attributes / > runtime-properties concurrently, overriding one another's changes. > Some form of versioning lock should be used to prevent this from happening. -- This message was sent by Atlassian JIRA (v6.3.15#6346)
[incubator-ariatosca] Git Push Summary
Repository: incubator-ariatosca Updated Branches: refs/heads/ARIA-79-concurrent-storage-modifications [deleted] 96581d9f9
[GitHub] incubator-ariatosca pull request #64: ARIA-79-concurrent-modifications
Github user asfgit closed the pull request at: https://github.com/apache/incubator-ariatosca/pull/64 --- 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
Repository: incubator-ariatosca Updated Branches: refs/heads/master 787d7e7e6 -> 96581d9f9 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/96581d9f Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/96581d9f Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/96581d9f Branch: refs/heads/master Commit: 96581d9f9b00736d3c83ecda20d2e9f81073d4da Parents: 787d7e7 Author: Dan KilmanAuthored: Mon Jan 30 16:49:00 2017 +0200 Committer: mxmrlv Committed: Fri Feb 17 21:12:36 2017 +0200 -- aria/.pylintrc | 2 +- aria/orchestrator/workflows/executor/process.py | 162 +++--- aria/storage/instrumentation.py | 73 +++-- aria/storage/modeling/instance_elements.py | 5 +- aria/storage/sql_mapi.py| 4 + aria/storage_initializer.py | 1 - tests/mock/models.py| 2 - ...process_executor_concurrent_modifications.py | 164 +++ tests/requirements.txt | 3 +- tests/storage/test_structures.py| 1 - 10 files changed, 338 insertions(+), 79 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/96581d9f/aria/.pylintrc -- diff --git a/aria/.pylintrc b/aria/.pylintrc index ee4d0ef..b7656a3 100644 --- a/aria/.pylintrc +++ b/aria/.pylintrc @@ -250,7 +250,7 @@ docstring-min-length=-1 [ELIF] # Maximum number of nested blocks for function / method body -max-nested-blocks=5 +max-nested-blocks=7 [SIMILARITIES] http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/96581d9f/aria/orchestrator/workflows/executor/process.py -- diff --git a/aria/orchestrator/workflows/executor/process.py b/aria/orchestrator/workflows/executor/process.py index 560ac43..75bbbce 100644 --- a/aria/orchestrator/workflows/executor/process.py +++ b/aria/orchestrator/workflows/executor/process.py @@ -53,6 +53,8 @@ _IS_WIN = os.name == 'nt' _INT_FMT = 'I' _INT_SIZE = struct.calcsize(_INT_FMT) +UPDATE_TRACKED_CHANGES_FAILED_STR = \ +'Some changes failed writing to storage. For more info refer to the log.' class ProcessExecutor(base.BaseExecutor): @@ -74,6 +76,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 +140,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) -