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/03/30 13:32:38 UTC
incubator-ariatosca git commit: fixed execution inputs
Repository: incubator-ariatosca
Updated Branches:
refs/heads/ARIA-48-aria-cli 744be225c -> 81e5847ac
fixed execution inputs
Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/81e5847a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/81e5847a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/81e5847a
Branch: refs/heads/ARIA-48-aria-cli
Commit: 81e5847ac7cbca1d55d9c870a28574b7c11fe39a
Parents: 744be22
Author: Ran Ziv <ra...@gigaspaces.com>
Authored: Thu Mar 30 16:32:33 2017 +0300
Committer: Ran Ziv <ra...@gigaspaces.com>
Committed: Thu Mar 30 16:32:33 2017 +0300
----------------------------------------------------------------------
aria/modeling/orchestration.py | 5 ++++-
aria/orchestrator/workflow_runner.py | 24 ++++++++++++++----------
2 files changed, 18 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/81e5847a/aria/modeling/orchestration.py
----------------------------------------------------------------------
diff --git a/aria/modeling/orchestration.py b/aria/modeling/orchestration.py
index a2ac6dd..f00571e 100644
--- a/aria/modeling/orchestration.py
+++ b/aria/modeling/orchestration.py
@@ -96,7 +96,6 @@ class ExecutionBase(ModelMixin):
ended_at = Column(DateTime, nullable=True, index=True)
error = Column(Text, nullable=True)
is_system_workflow = Column(Boolean, nullable=False, default=False)
- parameters = Column(Dict)
status = Column(Enum(*STATES, name='execution_status'), default=PENDING)
workflow_name = Column(Text)
@@ -104,6 +103,10 @@ class ExecutionBase(ModelMixin):
def service(cls):
return relationship.many_to_one(cls, 'service')
+ @declared_attr
+ def inputs(cls):
+ return relationship.many_to_many(cls, 'parameter', prefix='inputs', dict_key='name')
+
# region foreign keys
@declared_attr
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/81e5847a/aria/orchestrator/workflow_runner.py
----------------------------------------------------------------------
diff --git a/aria/orchestrator/workflow_runner.py b/aria/orchestrator/workflow_runner.py
index a529a84..124104e 100644
--- a/aria/orchestrator/workflow_runner.py
+++ b/aria/orchestrator/workflow_runner.py
@@ -32,7 +32,7 @@ from ..utils.imports import import_fullname
DEFAULT_TASK_MAX_ATTEMPTS = 1
DEFAULT_TASK_RETRY_INTERVAL = 1
-# TODO move this constant somewhere in the DSL parser
+# TODO move this constant somewhere in the DSL parser?
WORKFLOW_POLICY_INTERNAL_PROPERTIES = ('implementation', 'dependencies')
@@ -67,9 +67,10 @@ class WorkflowRunner(object):
task_max_attempts=task_max_attempts,
task_retry_interval=task_retry_interval)
- # merged_inputs_dict = {input.name: input.value for input in self.execution.inputs.values()}
- # self._tasks_graph = workflow_fn(ctx=workflow_context, **merged_inputs_dict)
- self._tasks_graph = workflow_fn(ctx=workflow_context)
+ # transforming the execution inputs to dict, to pass them to the workflow function
+ execution_inputs_dict = {input.name: input.value for input in
+ self.execution.inputs.values()}
+ self._tasks_graph = workflow_fn(ctx=workflow_context, **execution_inputs_dict)
self._engine = Engine(
executor=ProcessExecutor(plugin_manager=plugin_manager),
@@ -96,14 +97,17 @@ class WorkflowRunner(object):
execution = models.Execution(
created_at=datetime.utcnow(),
service=self.service,
- workflow_name=self._workflow_name)
+ workflow_name=self._workflow_name,
+ inputs={})
- # workflow_inputs = {k: v for k, v in
- # self.service.workflows[self._workflow_name].properties
- # if k not in WORKFLOW_POLICY_INTERNAL_PROPERTIES}
+ # built-in workflows don't have any inputs, and are also
+ # not a part of the service's workflows field
+ if self._workflow_name not in BUILTIN_WORKFLOWS:
+ workflow_inputs = {k: v for k, v in
+ self.service.workflows[self._workflow_name].properties
+ if k not in WORKFLOW_POLICY_INTERNAL_PROPERTIES}
- # input_models = modeling_utils.create_inputs(inputs, workflow_inputs)
- # execution.parameters = input_models
+ execution.inputs = modeling_utils.create_inputs(inputs, workflow_inputs)
self._model_storage.execution.put(execution)
return execution