You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ariatosca.apache.org by ra...@apache.org on 2017/04/06 08:29:54 UTC

[28/32] incubator-ariatosca git commit: workflow runner now works with service id rather than name

workflow runner now works with service id rather than 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/ecbf7e48
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/ecbf7e48
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/ecbf7e48

Branch: refs/heads/ARIA-48-aria-cli
Commit: ecbf7e48c09f15a0d5ff8f304104814d18702c97
Parents: 98b60ec
Author: Ran Ziv <ra...@gigaspaces.com>
Authored: Tue Apr 4 16:23:13 2017 +0300
Committer: Ran Ziv <ra...@gigaspaces.com>
Committed: Thu Apr 6 11:29:17 2017 +0300

----------------------------------------------------------------------
 aria/cli/commands/executions.py      | 3 ++-
 aria/orchestrator/workflow_runner.py | 8 ++++----
 2 files changed, 6 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/ecbf7e48/aria/cli/commands/executions.py
----------------------------------------------------------------------
diff --git a/aria/cli/commands/executions.py b/aria/cli/commands/executions.py
index 635ae63..cc8bf6c 100644
--- a/aria/cli/commands/executions.py
+++ b/aria/cli/commands/executions.py
@@ -124,10 +124,11 @@ def start(workflow_name,
 
     `WORKFLOW_NAME` is the name of the workflow to execute (e.g. `uninstall`)
     """
+    service = model_storage.service.get_by_name(service_name)
     executor = DryExecutor() if dry else None  # use WorkflowRunner's default executor
 
     workflow_runner = \
-        WorkflowRunner(workflow_name, service_name, inputs,
+        WorkflowRunner(workflow_name, service.id, inputs,
                        model_storage, resource_storage, plugin_manager,
                        executor, task_max_attempts, task_retry_interval)
 

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/ecbf7e48/aria/orchestrator/workflow_runner.py
----------------------------------------------------------------------
diff --git a/aria/orchestrator/workflow_runner.py b/aria/orchestrator/workflow_runner.py
index cb19ebc..b7a81f4 100644
--- a/aria/orchestrator/workflow_runner.py
+++ b/aria/orchestrator/workflow_runner.py
@@ -38,17 +38,17 @@ WORKFLOW_POLICY_INTERNAL_PROPERTIES = ('implementation', 'dependencies')
 
 class WorkflowRunner(object):
 
-    def __init__(self, workflow_name, service_name, inputs,
+    def __init__(self, workflow_name, service_id, inputs,
                  model_storage, resource_storage, plugin_manager,
                  executor=None, task_max_attempts=DEFAULT_TASK_MAX_ATTEMPTS,
                  task_retry_interval=DEFAULT_TASK_RETRY_INTERVAL):
 
         self._model_storage = model_storage
         self._workflow_name = workflow_name
-        service = model_storage.service.get_by_name(service_name)
+
         # the IDs are stored rather than the models themselves, so this module could be used
         # by several threads without raising errors on model objects shared between threads
-        self._service_id = service.id
+        self._service_id = service_id
 
         self._validate_workflow_exists_for_service()
 
@@ -61,7 +61,7 @@ class WorkflowRunner(object):
             name=self.__class__.__name__,
             model_storage=self._model_storage,
             resource_storage=resource_storage,
-            service_id=service.id,
+            service_id=service_id,
             execution_id=execution.id,
             workflow_name=workflow_name,
             task_max_attempts=task_max_attempts,