You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ariatosca.apache.org by em...@apache.org on 2017/05/24 21:25:10 UTC
incubator-ariatosca git commit: Fixes
Repository: incubator-ariatosca
Updated Branches:
refs/heads/ARIA-149-functions-in-operation-configuration 13888d247 -> f776a3992
Fixes
* Rename implementation/inputs to function/arguments in Task API
* Rename "create_parameters" to "merge_parameter_values" and improve
* Change workflow "function" back to "implementation"
Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/f776a399
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/f776a399
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/f776a399
Branch: refs/heads/ARIA-149-functions-in-operation-configuration
Commit: f776a39923284327f6c5239cd6add3e569a642a9
Parents: 13888d2
Author: Tal Liron <ta...@gmail.com>
Authored: Wed May 24 14:54:07 2017 -0500
Committer: Tal Liron <ta...@gmail.com>
Committed: Wed May 24 16:24:59 2017 -0500
----------------------------------------------------------------------
aria/cli/execution_logging.py | 4 +-
aria/modeling/exceptions.py | 6 +
aria/modeling/orchestration.py | 14 +-
aria/modeling/service_template.py | 2 +-
aria/modeling/utils.py | 129 +++++++++++--------
aria/orchestrator/context/operation.py | 4 +-
.../execution_plugin/instantiation.py | 2 +-
aria/orchestrator/workflow_runner.py | 2 +-
aria/orchestrator/workflows/api/task.py | 82 ++++++++----
.../workflows/builtin/execute_operation.py | 2 +-
aria/orchestrator/workflows/core/task.py | 4 +-
aria/orchestrator/workflows/events_logging.py | 8 +-
aria/orchestrator/workflows/executor/base.py | 4 +-
aria/orchestrator/workflows/executor/celery.py | 6 +-
aria/orchestrator/workflows/executor/dry.py | 6 +-
aria/orchestrator/workflows/executor/process.py | 12 +-
aria/orchestrator/workflows/executor/thread.py | 6 +-
.../profiles/aria-1.0/aria-1.0.yaml | 8 +-
.../simple_v1_0/modeling/__init__.py | 4 +-
tests/modeling/test_models.py | 12 +-
tests/orchestrator/context/test_operation.py | 32 ++---
tests/orchestrator/context/test_serialize.py | 4 +-
tests/orchestrator/context/test_toolbelt.py | 4 +-
.../orchestrator/execution_plugin/test_local.py | 8 +-
tests/orchestrator/execution_plugin/test_ssh.py | 6 +-
tests/orchestrator/workflows/api/test_task.py | 20 +--
.../orchestrator/workflows/core/test_engine.py | 40 +++---
tests/orchestrator/workflows/core/test_task.py | 4 +-
.../test_task_graph_into_execution_graph.py | 4 +-
.../orchestrator/workflows/executor/__init__.py | 6 +-
.../workflows/executor/test_executor.py | 10 +-
.../workflows/executor/test_process_executor.py | 2 +-
...process_executor_concurrent_modifications.py | 4 +-
.../executor/test_process_executor_extension.py | 18 +--
.../test_process_executor_tracked_changes.py | 14 +-
35 files changed, 275 insertions(+), 218 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/f776a399/aria/cli/execution_logging.py
----------------------------------------------------------------------
diff --git a/aria/cli/execution_logging.py b/aria/cli/execution_logging.py
index b23165f..b3252f0 100644
--- a/aria/cli/execution_logging.py
+++ b/aria/cli/execution_logging.py
@@ -105,8 +105,8 @@ def stylize_log(item, mark_pattern):
# implementation
if item.task:
# operation task
- implementation = item.task.implementation
- inputs = dict(i.unwrap() for i in item.task.inputs.values())
+ implementation = item.task.function
+ inputs = dict(arg.unwrap() for arg in item.task.arguments.values())
else:
# execution task
implementation = item.execution.workflow_name
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/f776a399/aria/modeling/exceptions.py
----------------------------------------------------------------------
diff --git a/aria/modeling/exceptions.py b/aria/modeling/exceptions.py
index d0e3e22..e784d1a 100644
--- a/aria/modeling/exceptions.py
+++ b/aria/modeling/exceptions.py
@@ -57,3 +57,9 @@ class UndeclaredParametersException(ParameterException):
"""
ARIA modeling exception: Undeclared parameters have been provided.
"""
+
+
+class ForbiddenParameterNamesException(ParameterException):
+ """
+ ARIA modeling exception: Forbidden parameter names have been used.
+ """
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/f776a399/aria/modeling/orchestration.py
----------------------------------------------------------------------
diff --git a/aria/modeling/orchestration.py b/aria/modeling/orchestration.py
index ab9d34d..97de552 100644
--- a/aria/modeling/orchestration.py
+++ b/aria/modeling/orchestration.py
@@ -230,10 +230,10 @@ class TaskBase(ModelMixin):
:vartype relationship: :class:`Relationship`
:ivar plugin: The implementing plugin (set to None for default execution plugin)
:vartype plugin: :class:`Plugin`
- :ivar inputs: Parameters that can be used by this task
- :vartype inputs: {basestring: :class:`Parameter`}
- :ivar implementation: Python path to an ``@operation`` function
- :vartype implementation: basestring
+ :ivar function: Python path to an ``@operation`` function
+ :vartype function: basestring
+ :ivar arguments: Arguments that can be used by this task
+ :vartype arguments: {basestring: :class:`Parameter`}
:ivar max_attempts: Maximum number of retries allowed in case of failure
:vartype max_attempts: int
:ivar retry_interval: Interval between retries (in seconds)
@@ -300,10 +300,10 @@ class TaskBase(ModelMixin):
return relationship.many_to_one(cls, 'execution')
@declared_attr
- def inputs(cls):
- return relationship.many_to_many(cls, 'parameter', prefix='inputs', dict_key='name')
+ def arguments(cls):
+ return relationship.many_to_many(cls, 'parameter', prefix='arguments', dict_key='name')
- implementation = Column(String)
+ function = Column(String)
max_attempts = Column(Integer, default=1)
retry_interval = Column(Float, default=0)
ignore_failure = Column(Boolean, default=False)
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/f776a399/aria/modeling/service_template.py
----------------------------------------------------------------------
diff --git a/aria/modeling/service_template.py b/aria/modeling/service_template.py
index 496aacf..7fcfd01 100644
--- a/aria/modeling/service_template.py
+++ b/aria/modeling/service_template.py
@@ -287,7 +287,7 @@ class ServiceTemplateBase(TemplateModelMixin):
service_template=self)
context.modeling.instance = service
- service.inputs = utils.create_parameters(inputs or {}, self.inputs)
+ service.inputs = utils.merge_parameter_values(inputs, self.inputs)
# TODO: now that we have inputs, we should scan properties and inputs and evaluate functions
for plugin_specification in self.plugin_specifications.itervalues():
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/f776a399/aria/modeling/utils.py
----------------------------------------------------------------------
diff --git a/aria/modeling/utils.py b/aria/modeling/utils.py
index 6f4022c..df19cb0 100644
--- a/aria/modeling/utils.py
+++ b/aria/modeling/utils.py
@@ -52,84 +52,95 @@ class NodeTemplateContainerHolder(object):
return self.container.service_template
-def create_parameters(parameters, declared_parameters):
+def merge_parameter_values(parameter_values, declared_parameters, forbidden_names=None):
"""
- Validates, merges, and wraps parameter values according to those declared by a type.
+ Merges parameter values according to those declared by a type.
- Exceptions will be raised for validation errors:
+ Exceptions will be raised for validation errors.
- * :class:`aria.modeling.exceptions.UndeclaredParametersException` if a key in ``parameters``
- does not exist in ``declared_parameters``
- * :class:`aria.modeling.exceptions.MissingRequiredParametersException` if a key in
- ``declared_parameters`` does not exist in ``parameters`` and also has no default value
- * :class:`aria.modeling.exceptions.ParametersOfWrongTypeException` if a value in ``parameters``
- does not match its type in ``declared_parameters``
-
- :param parameters: Provided parameter values
- :type parameters: {basestring, object}
- :param declared_parameters: Declared parameters
+ :param parameter_values: provided parameter values or None
+ :type parameter_values: {basestring, object}
+ :param declared_parameters: declared parameters
:type declared_parameters: {basestring, :class:`aria.modeling.models.Parameter`}
- :return: The merged parameters
+ :param forbidden_names: parameters will be validated against these names
+ :type forbidden_names: [basestring]
+ :return: the merged parameters
:rtype: {basestring, :class:`aria.modeling.models.Parameter`}
+ :raises aria.modeling.exceptions.UndeclaredParametersException: if a key in ``parameter_values``
+ does not exist in ``declared_parameters``
+ :raises aria.modeling.exceptions.MissingRequiredParametersException: if a key in
+ ``declared_parameters`` does not exist in ``parameter_values`` and also has no default
+ value
+ :raises aria.modeling.exceptions.ForbiddenParameterNamesException: if a parameter name is in
+ ``forbidden_names``
+ :raises aria.modeling.exceptions.ParametersOfWrongTypeException: if a value in
+ ``parameter_values`` does not match its type in ``declared_parameters``
"""
- merged_parameters = _merge_and_validate_parameters(parameters, declared_parameters)
-
from . import models
- parameters_models = OrderedDict()
- for parameter_name, parameter_value in merged_parameters.iteritems():
- parameter = models.Parameter( # pylint: disable=unexpected-keyword-arg
- name=parameter_name,
- type_name=declared_parameters[parameter_name].type_name,
- description=declared_parameters[parameter_name].description,
- value=parameter_value)
- parameters_models[parameter.name] = parameter
-
- return parameters_models
-
-
-def _merge_and_validate_parameters(parameters, declared_parameters):
- merged_parameters = OrderedDict(parameters)
-
- missing_parameters = []
- wrong_type_parameters = OrderedDict()
- for parameter_name, declared_parameter in declared_parameters.iteritems():
- if parameter_name not in parameters:
- if declared_parameter.value is not None:
- merged_parameters[parameter_name] = declared_parameter.value # apply default value
- else:
- missing_parameters.append(parameter_name)
- else:
- # Validate parameter type
+
+ parameter_values = parameter_values or {}
+
+ undeclared_names = list(set(parameter_values.keys()).difference(declared_parameters.keys()))
+ if undeclared_names:
+ raise exceptions.UndeclaredParametersException(
+ 'Undeclared parameters have been provided: {0}; Declared: {1}'
+ .format(_comma_separated_quoted(undeclared_names),
+ _comma_separated_quoted(declared_parameters.keys())))
+
+ parameters = OrderedDict()
+
+ missing_names = []
+ wrong_type_values = OrderedDict()
+ for declared_parameter_name, declared_parameter in declared_parameters.iteritems():
+ if declared_parameter_name in parameter_values:
+ # Value has been provided
+ value = parameter_values[declared_parameter_name]
+
+ # Validate type
+ type_name = declared_parameter.type_name
try:
- validate_value_type(parameters[parameter_name], declared_parameter.type_name)
+ validate_value_type(value, type_name)
except ValueError:
- wrong_type_parameters[parameter_name] = declared_parameter.type_name
+ wrong_type_values[declared_parameter_name] = type_name
except RuntimeError:
# TODO: This error shouldn't be raised (or caught), but right now we lack support
# for custom data_types, which will raise this error. Skipping their validation.
pass
- if missing_parameters:
+ # Wrap in Parameter model
+ parameters[declared_parameter_name] = models.Parameter( # pylint: disable=unexpected-keyword-arg
+ name=declared_parameter_name,
+ type_name=type_name,
+ description=declared_parameter.description,
+ value=value)
+ elif declared_parameter.value is not None:
+ # Copy default value from declaration
+ parameters[declared_parameter_name] = declared_parameter.instantiate(None)
+ else:
+ # Required value has not been provided
+ missing_names.append(declared_parameter_name)
+
+ if missing_names:
raise exceptions.MissingRequiredParametersException(
- 'Required parameters {0} have not been specified; Expected parameters: {1}'
- .format(missing_parameters, declared_parameters.keys()))
+ 'Declared parameters {0} have not been provided values'
+ .format(_comma_separated_quoted(missing_names)))
+
+ if forbidden_names:
+ used_forbidden_names = list(set(forbidden_names).intersection(parameters.keys()))
+ if used_forbidden_names:
+ raise exceptions.ForbiddenParameterNamesException(
+ 'Forbidden parameter names have been used: {0}'
+ .format(_comma_separated_quoted(used_forbidden_names)))
- if wrong_type_parameters:
+ if wrong_type_values:
error_message = StringIO()
- for param_name, param_type in wrong_type_parameters.iteritems():
- error_message.write('Parameter "{0}" must be of type {1}{2}'
+ for param_name, param_type in wrong_type_values.iteritems():
+ error_message.write('Parameter "{0}" is not of declared type "{1}"{2}'
.format(param_name, param_type, os.linesep))
raise exceptions.ParametersOfWrongTypeException(error_message.getvalue())
- undeclared_parameters = [parameter_name for parameter_name in parameters.keys()
- if parameter_name not in declared_parameters]
- if undeclared_parameters:
- raise exceptions.UndeclaredParametersException(
- 'Undeclared parameters have been specified: {0}; Expected parameters: {1}'
- .format(undeclared_parameters, declared_parameters.keys()))
-
- return merged_parameters
+ return parameters
def coerce_dict_values(the_dict, report_issues=False):
@@ -202,6 +213,10 @@ def dump_interfaces(interfaces, name='Interfaces'):
interface.dump()
+def _comma_separated_quoted(names):
+ return ', '.join('"{0}"'.format(name) for name in names)
+
+
class classproperty(object): # pylint: disable=invalid-name
def __init__(self, f):
self._func = f
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/f776a399/aria/orchestrator/context/operation.py
----------------------------------------------------------------------
diff --git a/aria/orchestrator/context/operation.py b/aria/orchestrator/context/operation.py
index 68a02aa..f7b5200 100644
--- a/aria/orchestrator/context/operation.py
+++ b/aria/orchestrator/context/operation.py
@@ -38,8 +38,8 @@ class BaseOperationContext(BaseContext):
self._register_logger(task_id=self.task.id, level=logger_level)
def __repr__(self):
- details = 'implementation={task.implementation}; ' \
- 'operation_inputs={task.inputs}'\
+ details = 'function={task.function}; ' \
+ 'operation_arguments={task.arguments}'\
.format(task=self.task)
return '{name}({0})'.format(details, name=self.name)
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/f776a399/aria/orchestrator/execution_plugin/instantiation.py
----------------------------------------------------------------------
diff --git a/aria/orchestrator/execution_plugin/instantiation.py b/aria/orchestrator/execution_plugin/instantiation.py
index 26c3913..869127e 100644
--- a/aria/orchestrator/execution_plugin/instantiation.py
+++ b/aria/orchestrator/execution_plugin/instantiation.py
@@ -43,7 +43,7 @@ def configure_operation(operation):
# kwargs in either "run_script_locally" or "run_script_with_ssh"
for key, value in operation.configuration.iteritems():
if key not in ('process', 'ssh'):
- operation.arguments[key] = value.instantiate()
+ operation.arguments[key] = value.instantiate(None)
def _configure_common(operation):
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/f776a399/aria/orchestrator/workflow_runner.py
----------------------------------------------------------------------
diff --git a/aria/orchestrator/workflow_runner.py b/aria/orchestrator/workflow_runner.py
index 0c6321f..944dc31 100644
--- a/aria/orchestrator/workflow_runner.py
+++ b/aria/orchestrator/workflow_runner.py
@@ -119,7 +119,7 @@ class WorkflowRunner(object):
else:
workflow_inputs = self.service.workflows[self._workflow_name].inputs
- execution.inputs = modeling_utils.create_parameters(inputs, workflow_inputs)
+ execution.inputs = modeling_utils.merge_parameter_values(inputs, workflow_inputs)
# TODO: these two following calls should execute atomically
self._validate_no_active_executions(execution)
self._model_storage.execution.put(execution)
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/f776a399/aria/orchestrator/workflows/api/task.py
----------------------------------------------------------------------
diff --git a/aria/orchestrator/workflows/api/task.py b/aria/orchestrator/workflows/api/task.py
index aa6ac45..3c2597e 100644
--- a/aria/orchestrator/workflows/api/task.py
+++ b/aria/orchestrator/workflows/api/task.py
@@ -55,7 +55,28 @@ class BaseTask(object):
class OperationTask(BaseTask):
"""
- Represents an operation task in the task graph
+ Represents an operation task in the task graph.
+
+ :ivar name: formatted name (includes actor type, actor name, and interface/operation names)
+ :vartype name: basestring
+ :ivar actor: node or relationship
+ :vartype actor: :class:`aria.modeling.models.Node`|:class:`aria.modeling.models.Relationship`
+ :ivar interface_name: interface name on actor
+ :vartype interface_name: basestring
+ :ivar operation_name: operation name on interface
+ :vartype operation_name: basestring
+ :ivar plugin: plugin (or None for default plugin)
+ :vartype plugin: :class:`aria.modeling.models.Plugin`
+ :ivar function: path to Python function
+ :vartype function: basestring
+ :ivar arguments: arguments to send to Python function
+ :vartype arguments: {basestring, :class:`aria.modeling.models.Parameter`}
+ :ivar ignore_failure: whether to ignore failures
+ :vartype ignore_failure: bool
+ :ivar max_attempts: maximum number of attempts allowed in case of failure
+ :vartype max_attempts: int
+ :ivar retry_interval: interval between retries (in seconds)
+ :vartype retry_interval: int
"""
NAME_FORMAT = '{interface}:{operation}@{type}:{name}'
@@ -64,31 +85,34 @@ class OperationTask(BaseTask):
actor,
interface_name,
operation_name,
- inputs=None,
+ arguments=None,
+ ignore_failure=None,
max_attempts=None,
- retry_interval=None,
- ignore_failure=None):
+ retry_interval=None):
"""
- Do not call this constructor directly. Instead, use :meth:`for_node` or
- :meth:`for_relationship`.
+ :param actor: node or relationship
+ :type actor: :class:`aria.modeling.models.Node`|:class:`aria.modeling.models.Relationship`
+ :param interface_name: interface name on actor
+ :type interface_name: basestring
+ :param operation_name: operation name on interface
+ :type operation_name: basestring
+ :param arguments: override argument values
+ :type arguments: {basestring, object}
+ :param ignore_failure: override whether to ignore failures
+ :type ignore_failure: bool
+ :param max_attempts: override maximum number of attempts allowed in case of failure
+ :type max_attempts: int
+ :param retry_interval: override interval between retries (in seconds)
+ :type retry_interval: int
+ :raises aria.orchestrator.workflows.exceptions.OperationNotFoundException: if
+ ``interface_name`` and ``operation_name`` to not refer to an operation on the actor
"""
+
assert isinstance(actor, (models.Node, models.Relationship))
- super(OperationTask, self).__init__()
- self.actor = actor
- self.interface_name = interface_name
- self.operation_name = operation_name
- self.max_attempts = max_attempts or self.workflow_context._task_max_attempts
- self.retry_interval = retry_interval or self.workflow_context._task_retry_interval
- self.ignore_failure = \
- self.workflow_context._task_ignore_failure if ignore_failure is None else ignore_failure
- self.name = OperationTask.NAME_FORMAT.format(type=type(actor).__name__.lower(),
- name=actor.name,
- interface=self.interface_name,
- operation=self.operation_name)
+
# Creating OperationTask directly should raise an error when there is no
# interface/operation.
-
- if not has_operation(self.actor, self.interface_name, self.operation_name):
+ if not has_operation(actor, interface_name, operation_name):
raise exceptions.OperationNotFoundException(
'Could not find operation "{self.operation_name}" on interface '
'"{self.interface_name}" for {actor_type} "{actor.name}"'.format(
@@ -97,10 +121,24 @@ class OperationTask(BaseTask):
actor=actor)
)
+ super(OperationTask, self).__init__()
+
+ self.name = OperationTask.NAME_FORMAT.format(type=type(actor).__name__.lower(),
+ name=actor.name,
+ interface=interface_name,
+ operation=operation_name)
+ self.actor = actor
+ self.interface_name = interface_name
+ self.operation_name = operation_name
+ self.ignore_failure = \
+ self.workflow_context._task_ignore_failure if ignore_failure is None else ignore_failure
+ self.max_attempts = max_attempts or self.workflow_context._task_max_attempts
+ self.retry_interval = retry_interval or self.workflow_context._task_retry_interval
+
operation = self.actor.interfaces[self.interface_name].operations[self.operation_name]
self.plugin = operation.plugin
- self.inputs = modeling_utils.create_parameters(inputs or {}, operation.arguments)
- self.implementation = operation.function
+ self.function = operation.function
+ self.arguments = modeling_utils.merge_parameter_values(arguments, operation.arguments)
def __repr__(self):
return self.name
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/f776a399/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 02a654a..437e584 100644
--- a/aria/orchestrator/workflows/builtin/execute_operation.py
+++ b/aria/orchestrator/workflows/builtin/execute_operation.py
@@ -69,7 +69,7 @@ def execute_operation(
node,
interface_name=interface_name,
operation_name=operation_name,
- inputs=operation_kwargs
+ arguments=operation_kwargs
)
)
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/f776a399/aria/orchestrator/workflows/core/task.py
----------------------------------------------------------------------
diff --git a/aria/orchestrator/workflows/core/task.py b/aria/orchestrator/workflows/core/task.py
index 0d6eb11..72d83ea 100644
--- a/aria/orchestrator/workflows/core/task.py
+++ b/aria/orchestrator/workflows/core/task.py
@@ -146,8 +146,8 @@ class OperationTask(BaseTask):
# Only non-stub tasks have these fields
plugin=api_task.plugin,
- implementation=api_task.implementation,
- inputs=api_task.inputs
+ function=api_task.function,
+ arguments=api_task.arguments
)
self._workflow_context.model.task.put(task_model)
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/f776a399/aria/orchestrator/workflows/events_logging.py
----------------------------------------------------------------------
diff --git a/aria/orchestrator/workflows/events_logging.py b/aria/orchestrator/workflows/events_logging.py
index 236a55f..0c93b85 100644
--- a/aria/orchestrator/workflows/events_logging.py
+++ b/aria/orchestrator/workflows/events_logging.py
@@ -35,12 +35,12 @@ def _get_task_name(task):
@events.start_task_signal.connect
def _start_task_handler(task, **kwargs):
- # If the task has not implementation this is an empty task.
- if task.implementation:
+ # If the task has no function this is an empty task.
+ if task.function:
suffix = 'started...'
logger = task.context.logger.info
else:
- suffix = 'has no implementation'
+ suffix = 'has no function'
logger = task.context.logger.debug
logger('{name} {task.interface_name}.{task.operation_name} {suffix}'.format(
@@ -48,7 +48,7 @@ def _start_task_handler(task, **kwargs):
@events.on_success_task_signal.connect
def _success_task_handler(task, **kwargs):
- if not task.implementation:
+ if not task.function:
return
task.context.logger.info('{name} {task.interface_name}.{task.operation_name} successful'
.format(name=_get_task_name(task), task=task))
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/f776a399/aria/orchestrator/workflows/executor/base.py
----------------------------------------------------------------------
diff --git a/aria/orchestrator/workflows/executor/base.py b/aria/orchestrator/workflows/executor/base.py
index c543278..7fece6f 100644
--- a/aria/orchestrator/workflows/executor/base.py
+++ b/aria/orchestrator/workflows/executor/base.py
@@ -33,10 +33,10 @@ class BaseExecutor(logger.LoggerMixin):
Execute a task
:param task: task to execute
"""
- if task.implementation:
+ if task.function:
self._execute(task)
else:
- # In this case the task is missing an implementation. This task still gets to an
+ # In this case the task is missing a function. This task still gets to an
# executor, but since there is nothing to run, we by default simply skip the execution
# itself.
self._task_started(task)
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/f776a399/aria/orchestrator/workflows/executor/celery.py
----------------------------------------------------------------------
diff --git a/aria/orchestrator/workflows/executor/celery.py b/aria/orchestrator/workflows/executor/celery.py
index bbddc25..3935b07 100644
--- a/aria/orchestrator/workflows/executor/celery.py
+++ b/aria/orchestrator/workflows/executor/celery.py
@@ -44,11 +44,11 @@ class CeleryExecutor(BaseExecutor):
def _execute(self, task):
self._tasks[task.id] = task
- inputs = dict(inp.unwrap() for inp in task.inputs.values())
- inputs['ctx'] = task.context
+ arguments = dict(arg.unwrap() for arg in task.arguments.values())
+ arguments['ctx'] = task.context
self._results[task.id] = self._app.send_task(
task.operation_mapping,
- kwargs=inputs,
+ kwargs=arguments,
task_id=task.id,
queue=self._get_queue(task))
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/f776a399/aria/orchestrator/workflows/executor/dry.py
----------------------------------------------------------------------
diff --git a/aria/orchestrator/workflows/executor/dry.py b/aria/orchestrator/workflows/executor/dry.py
index 63ec392..8848df8 100644
--- a/aria/orchestrator/workflows/executor/dry.py
+++ b/aria/orchestrator/workflows/executor/dry.py
@@ -33,7 +33,7 @@ class DryExecutor(BaseExecutor):
task.status = task.STARTED
dry_msg = '<dry> {name} {task.interface_name}.{task.operation_name} {suffix}'
- logger = task.context.logger.info if task.implementation else task.context.logger.debug
+ logger = task.context.logger.info if task.function else task.context.logger.debug
if hasattr(task.actor, 'source_node'):
name = '{source_node.name}->{target_node.name}'.format(
@@ -41,11 +41,11 @@ class DryExecutor(BaseExecutor):
else:
name = task.actor.name
- if task.implementation:
+ if task.function:
logger(dry_msg.format(name=name, task=task, suffix='started...'))
logger(dry_msg.format(name=name, task=task, suffix='successful'))
else:
- logger(dry_msg.format(name=name, task=task, suffix='has no implementation'))
+ logger(dry_msg.format(name=name, task=task, suffix='has no function'))
# updating the task manually instead of calling self._task_succeeded(task),
# to avoid any side effects raising that event might cause
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/f776a399/aria/orchestrator/workflows/executor/process.py
----------------------------------------------------------------------
diff --git a/aria/orchestrator/workflows/executor/process.py b/aria/orchestrator/workflows/executor/process.py
index 824c4e1..9cfbccd 100644
--- a/aria/orchestrator/workflows/executor/process.py
+++ b/aria/orchestrator/workflows/executor/process.py
@@ -143,8 +143,8 @@ class ProcessExecutor(base.BaseExecutor):
def _create_arguments_dict(self, task):
return {
'task_id': task.id,
- 'implementation': task.implementation,
- 'operation_inputs': dict(inp.unwrap() for inp in task.inputs.values()),
+ 'function': task.function,
+ 'operation_arguments': dict(arg.unwrap() for arg in task.arguments.values()),
'port': self._server_port,
'context': task.context.serialization_dict,
}
@@ -365,8 +365,8 @@ def _main():
port = arguments['port']
messenger = _Messenger(task_id=task_id, port=port)
- implementation = arguments['implementation']
- operation_inputs = arguments['operation_inputs']
+ function = arguments['function']
+ operation_arguments = arguments['operation_arguments']
context_dict = arguments['context']
# This is required for the instrumentation work properly.
@@ -382,11 +382,11 @@ def _main():
try:
messenger.started()
_patch_ctx(ctx=ctx, messenger=messenger, instrument=instrument)
- task_func = imports.load_attribute(implementation)
+ task_func = imports.load_attribute(function)
aria.install_aria_extensions()
for decorate in process_executor.decorate():
task_func = decorate(task_func)
- task_func(ctx=ctx, **operation_inputs)
+ task_func(ctx=ctx, **operation_arguments)
messenger.succeeded(tracked_changes=instrument.tracked_changes,
new_instances=instrument.new_instances)
except BaseException as e:
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/f776a399/aria/orchestrator/workflows/executor/thread.py
----------------------------------------------------------------------
diff --git a/aria/orchestrator/workflows/executor/thread.py b/aria/orchestrator/workflows/executor/thread.py
index f53362a..2c5ef16 100644
--- a/aria/orchestrator/workflows/executor/thread.py
+++ b/aria/orchestrator/workflows/executor/thread.py
@@ -60,9 +60,9 @@ class ThreadExecutor(BaseExecutor):
task = self._queue.get(timeout=1)
self._task_started(task)
try:
- task_func = imports.load_attribute(task.implementation)
- inputs = dict(inp.unwrap() for inp in task.inputs.values())
- task_func(ctx=task.context, **inputs)
+ task_func = imports.load_attribute(task.function)
+ arguments = dict(arg.unwrap() for arg in task.arguments.values())
+ task_func(ctx=task.context, **arguments)
self._task_succeeded(task)
except BaseException as e:
self._task_failed(task,
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/f776a399/extensions/aria_extension_tosca/profiles/aria-1.0/aria-1.0.yaml
----------------------------------------------------------------------
diff --git a/extensions/aria_extension_tosca/profiles/aria-1.0/aria-1.0.yaml b/extensions/aria_extension_tosca/profiles/aria-1.0/aria-1.0.yaml
index abac03b..c1dc11d 100644
--- a/extensions/aria_extension_tosca/profiles/aria-1.0/aria-1.0.yaml
+++ b/extensions/aria_extension_tosca/profiles/aria-1.0/aria-1.0.yaml
@@ -52,10 +52,10 @@ policy_types:
should be inherited and extended with additional properties.
derived_from: tosca.policies.Root
properties:
- function:
+ implementation:
description: >-
- The interpretation of the function string depends on the orchestrator. In ARIA it is the
- full path to a Python @workflow function that generates a task graph based on the service
- topology.
+ The interpretation of the implementation string depends on the orchestrator. In ARIA it is
+ the full path to a Python @workflow function that generates a task graph based on the
+ service topology.
type: string
required: true
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/f776a399/extensions/aria_extension_tosca/simple_v1_0/modeling/__init__.py
----------------------------------------------------------------------
diff --git a/extensions/aria_extension_tosca/simple_v1_0/modeling/__init__.py b/extensions/aria_extension_tosca/simple_v1_0/modeling/__init__.py
index 0b04fdc..22a8ef2 100644
--- a/extensions/aria_extension_tosca/simple_v1_0/modeling/__init__.py
+++ b/extensions/aria_extension_tosca/simple_v1_0/modeling/__init__.py
@@ -512,10 +512,8 @@ def create_workflow_operation_template_model(context, service_template, policy):
properties = policy._get_property_values(context)
for prop_name, prop in properties.iteritems():
- if prop_name == 'function':
+ if prop_name == 'implementation':
model.function = prop.value
- elif prop_name == 'dependencies':
- model.dependencies = prop.value
else:
model.configuration[prop_name] = Parameter(name=prop_name, # pylint: disable=unexpected-keyword-arg
type_name=prop.type,
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/f776a399/tests/modeling/test_models.py
----------------------------------------------------------------------
diff --git a/tests/modeling/test_models.py b/tests/modeling/test_models.py
index 61034bd..fa2ce46 100644
--- a/tests/modeling/test_models.py
+++ b/tests/modeling/test_models.py
@@ -759,7 +759,7 @@ class TestTask(object):
@pytest.mark.parametrize(
'is_valid, status, due_at, started_at, ended_at, max_attempts, attempts_count, '
- 'retry_interval, ignore_failure, name, operation_mapping, inputs, plugin_id',
+ 'retry_interval, ignore_failure, name, operation_mapping, arguments, plugin_id',
[
(False, m_cls, now, now, now, 1, 1, 1, True, 'name', 'map', {}, '1'),
(False, Task.STARTED, m_cls, now, now, 1, 1, 1, True, 'name', 'map', {}, '1'),
@@ -788,7 +788,7 @@ class TestTask(object):
)
def test_task_model_creation(self, execution_storage, is_valid, status, due_at, started_at,
ended_at, max_attempts, attempts_count, retry_interval,
- ignore_failure, name, operation_mapping, inputs, plugin_id):
+ ignore_failure, name, operation_mapping, arguments, plugin_id):
task = _test_model(
is_valid=is_valid,
storage=execution_storage,
@@ -804,8 +804,8 @@ class TestTask(object):
retry_interval=retry_interval,
ignore_failure=ignore_failure,
name=name,
- implementation=operation_mapping,
- inputs=inputs,
+ function=operation_mapping,
+ arguments=arguments,
plugin_fk=plugin_id,
))
if is_valid:
@@ -817,8 +817,8 @@ class TestTask(object):
def create_task(max_attempts):
Task(execution_fk='eid',
name='name',
- implementation='',
- inputs={},
+ function='',
+ arguments={},
max_attempts=max_attempts)
create_task(max_attempts=1)
create_task(max_attempts=2)
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/f776a399/tests/orchestrator/context/test_operation.py
----------------------------------------------------------------------
diff --git a/tests/orchestrator/context/test_operation.py b/tests/orchestrator/context/test_operation.py
index 81aa2a2..bdf8886 100644
--- a/tests/orchestrator/context/test_operation.py
+++ b/tests/orchestrator/context/test_operation.py
@@ -97,7 +97,7 @@ def test_node_operation_task_execution(ctx, thread_executor, dataholder):
node,
interface_name=interface_name,
operation_name=operation_name,
- inputs=arguments
+ arguments=arguments
)
)
@@ -115,8 +115,8 @@ def test_node_operation_task_execution(ctx, thread_executor, dataholder):
)
operations = interface.operations
assert len(operations) == 1
- assert dataholder['implementation'] == operations.values()[0].function # pylint: disable=no-member
- assert dataholder['inputs']['putput'] is True
+ assert dataholder['function'] == operations.values()[0].function # pylint: disable=no-member
+ assert dataholder['arguments']['putput'] is True
# Context based attributes (sugaring)
assert dataholder['template_name'] == node.node_template.name
@@ -147,7 +147,7 @@ def test_relationship_operation_task_execution(ctx, thread_executor, dataholder)
relationship,
interface_name=interface_name,
operation_name=operation_name,
- inputs=arguments
+ arguments=arguments
)
)
@@ -159,8 +159,8 @@ def test_relationship_operation_task_execution(ctx, thread_executor, dataholder)
assert dataholder['actor_name'] == relationship.name
assert interface_name in dataholder['task_name']
operations = interface.operations
- assert dataholder['implementation'] == operations.values()[0].function # pylint: disable=no-member
- assert dataholder['inputs']['putput'] is True
+ assert dataholder['function'] == operations.values()[0].function # pylint: disable=no-member
+ assert dataholder['arguments']['putput'] is True
# Context based attributes (sugaring)
dependency_node_template = ctx.model.node_template.get_by_name(
@@ -252,7 +252,7 @@ def test_plugin_workdir(ctx, thread_executor, tmpdir):
node,
interface_name=interface_name,
operation_name=operation_name,
- inputs=arguments))
+ arguments=arguments))
execute(workflow_func=basic_workflow, workflow_context=ctx, executor=thread_executor)
expected_file = tmpdir.join('workdir', 'plugins', str(ctx.service.id),
@@ -301,7 +301,7 @@ def test_node_operation_logging(ctx, executor):
node,
interface_name=interface_name,
operation_name=operation_name,
- inputs=arguments
+ arguments=arguments
)
)
@@ -334,7 +334,7 @@ def test_relationship_operation_logging(ctx, executor):
relationship,
interface_name=interface_name,
operation_name=operation_name,
- inputs=arguments
+ arguments=arguments
)
)
@@ -342,7 +342,7 @@ def test_relationship_operation_logging(ctx, executor):
_assert_loggins(ctx, arguments)
-def _assert_loggins(ctx, inputs):
+def _assert_loggins(ctx, arguments):
# The logs should contain the following: Workflow Start, Operation Start, custom operation
# log string (op_start), custom operation log string (op_end), Operation End, Workflow End.
@@ -363,11 +363,11 @@ def _assert_loggins(ctx, inputs):
assert all(l.execution == execution for l in logs)
assert all(l in logs and l.task == task for l in task.logs)
- op_start_log = [l for l in logs if inputs['op_start'] in l.msg and l.level.lower() == 'info']
+ op_start_log = [l for l in logs if arguments['op_start'] in l.msg and l.level.lower() == 'info']
assert len(op_start_log) == 1
op_start_log = op_start_log[0]
- op_end_log = [l for l in logs if inputs['op_end'] in l.msg and l.level.lower() == 'debug']
+ op_end_log = [l for l in logs if arguments['op_end'] in l.msg and l.level.lower() == 'debug']
assert len(op_end_log) == 1
op_end_log = op_end_log[0]
@@ -376,10 +376,10 @@ def _assert_loggins(ctx, inputs):
@operation
def logged_operation(ctx, **_):
- ctx.logger.info(ctx.task.inputs['op_start'])
+ ctx.logger.info(ctx.task.arguments['op_start'])
# enables to check the relation between the created_at field properly
time.sleep(1)
- ctx.logger.debug(ctx.task.inputs['op_end'])
+ ctx.logger.debug(ctx.task.arguments['op_end'])
@operation
@@ -408,8 +408,8 @@ def operation_common(ctx, holder):
holder['actor_name'] = ctx.task.actor.name
holder['task_name'] = ctx.task.name
- holder['implementation'] = ctx.task.implementation
- holder['inputs'] = dict(i.unwrap() for i in ctx.task.inputs.values())
+ holder['function'] = ctx.task.function
+ holder['arguments'] = dict(i.unwrap() for i in ctx.task.arguments.values())
@operation
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/f776a399/tests/orchestrator/context/test_serialize.py
----------------------------------------------------------------------
diff --git a/tests/orchestrator/context/test_serialize.py b/tests/orchestrator/context/test_serialize.py
index 946b0bd..4db7bf4 100644
--- a/tests/orchestrator/context/test_serialize.py
+++ b/tests/orchestrator/context/test_serialize.py
@@ -60,8 +60,8 @@ def _mock_workflow(ctx, graph):
def _mock_operation(ctx):
# We test several things in this operation
# ctx.task, ctx.node, etc... tell us that the model storage was properly re-created
- # a correct ctx.task.implementation tells us we kept the correct task_id
- assert ctx.task.implementation == _operation_mapping()
+ # a correct ctx.task.function tells us we kept the correct task_id
+ assert ctx.task.function == _operation_mapping()
# a correct ctx.node.name tells us we kept the correct actor_id
assert ctx.node.name == mock.models.DEPENDENCY_NODE_NAME
# a correct ctx.name tells us we kept the correct name
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/f776a399/tests/orchestrator/context/test_toolbelt.py
----------------------------------------------------------------------
diff --git a/tests/orchestrator/context/test_toolbelt.py b/tests/orchestrator/context/test_toolbelt.py
index f4d0c06..f6e70e4 100644
--- a/tests/orchestrator/context/test_toolbelt.py
+++ b/tests/orchestrator/context/test_toolbelt.py
@@ -104,7 +104,7 @@ def test_host_ip(workflow_context, executor, dataholder):
dependency_node,
interface_name=interface_name,
operation_name=operation_name,
- inputs=arguments
+ arguments=arguments
)
)
@@ -135,7 +135,7 @@ def test_relationship_tool_belt(workflow_context, executor, dataholder):
relationship,
interface_name=interface_name,
operation_name=operation_name,
- inputs=arguments
+ arguments=arguments
)
)
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/f776a399/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
index e7b2b03..892cdd7 100644
--- a/tests/orchestrator/execution_plugin/test_local.py
+++ b/tests/orchestrator/execution_plugin/test_local.py
@@ -199,7 +199,7 @@ if __name__ == '__main__':
props = self._run(
executor, workflow_context,
script_path=script_path,
- inputs={'key': 'value'})
+ arguments={'key': 'value'})
assert props['key'] == 'value'
@pytest.mark.parametrize(
@@ -458,10 +458,10 @@ if __name__ == '__main__':
script_path,
process=None,
env_var='value',
- inputs=None):
+ arguments=None):
local_script_path = script_path
script_path = os.path.basename(local_script_path) if local_script_path else ''
- arguments = inputs or {}
+ arguments = arguments or {}
process = process or {}
if script_path:
workflow_context.resource.service.upload(
@@ -493,7 +493,7 @@ if __name__ == '__main__':
node,
interface_name='test',
operation_name='op',
- inputs=arguments))
+ arguments=arguments))
return graph
tasks_graph = mock_workflow(ctx=workflow_context) # pylint: disable=no-value-for-parameter
eng = engine.Engine(
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/f776a399/tests/orchestrator/execution_plugin/test_ssh.py
----------------------------------------------------------------------
diff --git a/tests/orchestrator/execution_plugin/test_ssh.py b/tests/orchestrator/execution_plugin/test_ssh.py
index 7a2787b..799a9d8 100644
--- a/tests/orchestrator/execution_plugin/test_ssh.py
+++ b/tests/orchestrator/execution_plugin/test_ssh.py
@@ -243,13 +243,13 @@ class TestWithActualSSHServer(object):
ops = []
for test_operation in test_operations:
- op_inputs = arguments.copy()
- op_inputs['test_operation'] = test_operation
+ op_arguments = arguments.copy()
+ op_arguments['test_operation'] = test_operation
ops.append(api.task.OperationTask(
node,
interface_name='test',
operation_name='op',
- inputs=op_inputs))
+ arguments=op_arguments))
graph.sequence(*ops)
return graph
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/f776a399/tests/orchestrator/workflows/api/test_task.py
----------------------------------------------------------------------
diff --git a/tests/orchestrator/workflows/api/test_task.py b/tests/orchestrator/workflows/api/test_task.py
index d57e424..9d91b6b 100644
--- a/tests/orchestrator/workflows/api/test_task.py
+++ b/tests/orchestrator/workflows/api/test_task.py
@@ -66,7 +66,7 @@ class TestOperationTask(object):
node,
interface_name=interface_name,
operation_name=operation_name,
- inputs=arguments,
+ arguments=arguments,
max_attempts=max_attempts,
retry_interval=retry_interval,
ignore_failure=ignore_failure)
@@ -77,9 +77,9 @@ class TestOperationTask(object):
interface=interface_name,
operation=operation_name
)
- assert api_task.implementation == 'op_path'
+ assert api_task.function == 'op_path'
assert api_task.actor == node
- assert api_task.inputs['test_input'].value is True
+ assert api_task.arguments['test_input'].value is True
assert api_task.retry_interval == retry_interval
assert api_task.max_attempts == max_attempts
assert api_task.ignore_failure == ignore_failure
@@ -113,7 +113,7 @@ class TestOperationTask(object):
relationship,
interface_name=interface_name,
operation_name=operation_name,
- inputs=arguments,
+ arguments=arguments,
max_attempts=max_attempts,
retry_interval=retry_interval)
@@ -123,9 +123,9 @@ class TestOperationTask(object):
interface=interface_name,
operation=operation_name
)
- assert api_task.implementation == 'op_path'
+ assert api_task.function == 'op_path'
assert api_task.actor == relationship
- assert api_task.inputs['test_input'].value is True
+ assert api_task.arguments['test_input'].value is True
assert api_task.retry_interval == retry_interval
assert api_task.max_attempts == max_attempts
assert api_task.plugin.name == 'test_plugin'
@@ -158,7 +158,7 @@ class TestOperationTask(object):
relationship,
interface_name=interface_name,
operation_name=operation_name,
- inputs=arguments,
+ arguments=arguments,
max_attempts=max_attempts,
retry_interval=retry_interval)
@@ -168,9 +168,9 @@ class TestOperationTask(object):
interface=interface_name,
operation=operation_name
)
- assert api_task.implementation == 'op_path'
+ assert api_task.function == 'op_path'
assert api_task.actor == relationship
- assert api_task.inputs['test_input'].value is True
+ assert api_task.arguments['test_input'].value is True
assert api_task.retry_interval == retry_interval
assert api_task.max_attempts == max_attempts
assert api_task.plugin.name == 'test_plugin'
@@ -198,7 +198,7 @@ class TestOperationTask(object):
interface_name=interface_name,
operation_name=operation_name)
- assert task.inputs == {}
+ assert task.arguments == {}
assert task.retry_interval == ctx._task_retry_interval
assert task.max_attempts == ctx._task_max_attempts
assert task.ignore_failure == ctx._task_ignore_failure
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/f776a399/tests/orchestrator/workflows/core/test_engine.py
----------------------------------------------------------------------
diff --git a/tests/orchestrator/workflows/core/test_engine.py b/tests/orchestrator/workflows/core/test_engine.py
index 43ec9f1..6d2836c 100644
--- a/tests/orchestrator/workflows/core/test_engine.py
+++ b/tests/orchestrator/workflows/core/test_engine.py
@@ -57,7 +57,7 @@ class BaseTest(object):
@staticmethod
def _op(ctx,
func,
- inputs=None,
+ arguments=None,
max_attempts=None,
retry_interval=None,
ignore_failure=None):
@@ -65,9 +65,9 @@ class BaseTest(object):
interface_name = 'aria.interfaces.lifecycle'
operation_kwargs = dict(function='{name}.{func.__name__}'.format(
name=__name__, func=func))
- if inputs:
+ if arguments:
# the operation has to declare the arguments before those may be passed
- operation_kwargs['arguments'] = inputs
+ operation_kwargs['arguments'] = arguments
operation_name = 'create'
interface = mock.models.create_interface(node.service, interface_name, operation_name,
operation_kwargs=operation_kwargs)
@@ -77,7 +77,7 @@ class BaseTest(object):
node,
interface_name='aria.interfaces.lifecycle',
operation_name=operation_name,
- inputs=inputs or {},
+ arguments=arguments,
max_attempts=max_attempts,
retry_interval=retry_interval,
ignore_failure=ignore_failure,
@@ -189,8 +189,8 @@ class TestEngine(BaseTest):
def test_two_tasks_execution_order(self, workflow_context, executor):
@workflow
def mock_workflow(ctx, graph):
- op1 = self._op(ctx, func=mock_ordered_task, inputs={'counter': 1})
- op2 = self._op(ctx, func=mock_ordered_task, inputs={'counter': 2})
+ op1 = self._op(ctx, func=mock_ordered_task, arguments={'counter': 1})
+ op2 = self._op(ctx, func=mock_ordered_task, arguments={'counter': 2})
graph.sequence(op1, op2)
self._execute(
workflow_func=mock_workflow,
@@ -204,9 +204,9 @@ class TestEngine(BaseTest):
def test_stub_and_subworkflow_execution(self, workflow_context, executor):
@workflow
def sub_workflow(ctx, graph):
- op1 = self._op(ctx, func=mock_ordered_task, inputs={'counter': 1})
+ op1 = self._op(ctx, func=mock_ordered_task, arguments={'counter': 1})
op2 = api.task.StubTask()
- op3 = self._op(ctx, func=mock_ordered_task, inputs={'counter': 2})
+ op3 = self._op(ctx, func=mock_ordered_task, arguments={'counter': 2})
graph.sequence(op1, op2, op3)
@workflow
@@ -229,7 +229,7 @@ class TestCancel(BaseTest):
@workflow
def mock_workflow(ctx, graph):
operations = (
- self._op(ctx, func=mock_sleep_task, inputs=dict(seconds=0.1))
+ self._op(ctx, func=mock_sleep_task, arguments=dict(seconds=0.1))
for _ in range(number_of_tasks)
)
return graph.sequence(*operations)
@@ -270,7 +270,7 @@ class TestRetries(BaseTest):
@workflow
def mock_workflow(ctx, graph):
op = self._op(ctx, func=mock_conditional_failure_task,
- inputs={'failure_count': 1},
+ arguments={'failure_count': 1},
max_attempts=2)
graph.add_tasks(op)
self._execute(
@@ -286,7 +286,7 @@ class TestRetries(BaseTest):
@workflow
def mock_workflow(ctx, graph):
op = self._op(ctx, func=mock_conditional_failure_task,
- inputs={'failure_count': 2},
+ arguments={'failure_count': 2},
max_attempts=2)
graph.add_tasks(op)
with pytest.raises(exceptions.ExecutorException):
@@ -303,7 +303,7 @@ class TestRetries(BaseTest):
@workflow
def mock_workflow(ctx, graph):
op = self._op(ctx, func=mock_conditional_failure_task,
- inputs={'failure_count': 1},
+ arguments={'failure_count': 1},
max_attempts=3)
graph.add_tasks(op)
self._execute(
@@ -319,7 +319,7 @@ class TestRetries(BaseTest):
@workflow
def mock_workflow(ctx, graph):
op = self._op(ctx, func=mock_conditional_failure_task,
- inputs={'failure_count': 2},
+ arguments={'failure_count': 2},
max_attempts=3)
graph.add_tasks(op)
self._execute(
@@ -335,7 +335,7 @@ class TestRetries(BaseTest):
@workflow
def mock_workflow(ctx, graph):
op = self._op(ctx, func=mock_conditional_failure_task,
- inputs={'failure_count': 1},
+ arguments={'failure_count': 1},
max_attempts=-1)
graph.add_tasks(op)
self._execute(
@@ -361,7 +361,7 @@ class TestRetries(BaseTest):
@workflow
def mock_workflow(ctx, graph):
op = self._op(ctx, func=mock_conditional_failure_task,
- inputs={'failure_count': 1},
+ arguments={'failure_count': 1},
max_attempts=2,
retry_interval=retry_interval)
graph.add_tasks(op)
@@ -382,7 +382,7 @@ class TestRetries(BaseTest):
def mock_workflow(ctx, graph):
op = self._op(ctx, func=mock_conditional_failure_task,
ignore_failure=True,
- inputs={'failure_count': 100},
+ arguments={'failure_count': 100},
max_attempts=100)
graph.add_tasks(op)
self._execute(
@@ -405,7 +405,7 @@ class TestTaskRetryAndAbort(BaseTest):
@workflow
def mock_workflow(ctx, graph):
op = self._op(ctx, func=mock_task_retry,
- inputs={'message': self.message},
+ arguments={'message': self.message},
retry_interval=default_retry_interval,
max_attempts=2)
graph.add_tasks(op)
@@ -429,8 +429,8 @@ class TestTaskRetryAndAbort(BaseTest):
@workflow
def mock_workflow(ctx, graph):
op = self._op(ctx, func=mock_task_retry,
- inputs={'message': self.message,
- 'retry_interval': custom_retry_interval},
+ arguments={'message': self.message,
+ 'retry_interval': custom_retry_interval},
retry_interval=default_retry_interval,
max_attempts=2)
graph.add_tasks(op)
@@ -452,7 +452,7 @@ class TestTaskRetryAndAbort(BaseTest):
@workflow
def mock_workflow(ctx, graph):
op = self._op(ctx, func=mock_task_abort,
- inputs={'message': self.message},
+ arguments={'message': self.message},
retry_interval=100,
max_attempts=100)
graph.add_tasks(op)
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/f776a399/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 1d0a473..c0d3616 100644
--- a/tests/orchestrator/workflows/core/test_task.py
+++ b/tests/orchestrator/workflows/core/test_task.py
@@ -103,9 +103,9 @@ class TestOperationTask(object):
assert storage_task.actor == core_task.context.node
assert core_task.model_task == storage_task
assert core_task.name == api_task.name
- assert core_task.implementation == api_task.implementation
+ assert core_task.function == api_task.function
assert core_task.actor == api_task.actor == node
- assert core_task.inputs == api_task.inputs == storage_task.inputs
+ assert core_task.arguments == api_task.arguments == storage_task.arguments
assert core_task.plugin == storage_plugin
def test_relationship_operation_task_creation(self, ctx):
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/f776a399/tests/orchestrator/workflows/core/test_task_graph_into_execution_graph.py
----------------------------------------------------------------------
diff --git a/tests/orchestrator/workflows/core/test_task_graph_into_execution_graph.py b/tests/orchestrator/workflows/core/test_task_graph_into_execution_graph.py
index 1633d4a..5dd2855 100644
--- a/tests/orchestrator/workflows/core/test_task_graph_into_execution_graph.py
+++ b/tests/orchestrator/workflows/core/test_task_graph_into_execution_graph.py
@@ -108,9 +108,9 @@ def test_task_graph_into_execution_graph(tmpdir):
def _assert_execution_is_api_task(execution_task, api_task):
assert execution_task.id == api_task.id
assert execution_task.name == api_task.name
- assert execution_task.implementation == api_task.implementation
+ assert execution_task.function == api_task.function
assert execution_task.actor == api_task.actor
- assert execution_task.inputs == api_task.inputs
+ assert execution_task.arguments == api_task.arguments
def _get_task_by_name(task_name, graph):
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/f776a399/tests/orchestrator/workflows/executor/__init__.py
----------------------------------------------------------------------
diff --git a/tests/orchestrator/workflows/executor/__init__.py b/tests/orchestrator/workflows/executor/__init__.py
index 8ad8edb..3174bf7 100644
--- a/tests/orchestrator/workflows/executor/__init__.py
+++ b/tests/orchestrator/workflows/executor/__init__.py
@@ -25,11 +25,11 @@ class MockTask(object):
INFINITE_RETRIES = models.Task.INFINITE_RETRIES
- def __init__(self, implementation, inputs=None, plugin=None, storage=None):
- self.implementation = self.name = implementation
+ def __init__(self, function, arguments=None, plugin=None, storage=None):
+ self.function = self.name = function
self.plugin_fk = plugin.id if plugin else None
self.plugin = plugin or None
- self.inputs = inputs or {}
+ self.arguments = arguments or {}
self.states = []
self.exception = None
self.id = str(uuid.uuid4())
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/f776a399/tests/orchestrator/workflows/executor/test_executor.py
----------------------------------------------------------------------
diff --git a/tests/orchestrator/workflows/executor/test_executor.py b/tests/orchestrator/workflows/executor/test_executor.py
index 29cb0e8..9ddaef4 100644
--- a/tests/orchestrator/workflows/executor/test_executor.py
+++ b/tests/orchestrator/workflows/executor/test_executor.py
@@ -38,16 +38,16 @@ import tests
from . import MockTask
-def _get_implementation(func):
+def _get_function(func):
return '{module}.{func.__name__}'.format(module=__name__, func=func)
def execute_and_assert(executor, storage=None):
expected_value = 'value'
- successful_task = MockTask(_get_implementation(mock_successful_task), storage=storage)
- failing_task = MockTask(_get_implementation(mock_failing_task), storage=storage)
- task_with_inputs = MockTask(_get_implementation(mock_task_with_input),
- inputs={'input': models.Parameter.wrap('input', 'value')},
+ successful_task = MockTask(_get_function(mock_successful_task), storage=storage)
+ failing_task = MockTask(_get_function(mock_failing_task), storage=storage)
+ task_with_inputs = MockTask(_get_function(mock_task_with_input),
+ arguments={'input': models.Parameter.wrap('input', 'value')},
storage=storage)
for task in [successful_task, failing_task, task_with_inputs]:
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/f776a399/tests/orchestrator/workflows/executor/test_process_executor.py
----------------------------------------------------------------------
diff --git a/tests/orchestrator/workflows/executor/test_process_executor.py b/tests/orchestrator/workflows/executor/test_process_executor.py
index e6333e8..058190e 100644
--- a/tests/orchestrator/workflows/executor/test_process_executor.py
+++ b/tests/orchestrator/workflows/executor/test_process_executor.py
@@ -66,7 +66,7 @@ class TestProcessExecutor(object):
def test_closed(self, executor):
executor.close()
with pytest.raises(RuntimeError) as exc_info:
- executor.execute(task=MockTask(implementation='some.implementation'))
+ executor.execute(task=MockTask(function='some.function'))
assert 'closed' in exc_info.value.message
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/f776a399/tests/orchestrator/workflows/executor/test_process_executor_concurrent_modifications.py
----------------------------------------------------------------------
diff --git a/tests/orchestrator/workflows/executor/test_process_executor_concurrent_modifications.py b/tests/orchestrator/workflows/executor/test_process_executor_concurrent_modifications.py
index 6060620..e72ddc8 100644
--- a/tests/orchestrator/workflows/executor/test_process_executor_concurrent_modifications.py
+++ b/tests/orchestrator/workflows/executor/test_process_executor_concurrent_modifications.py
@@ -103,12 +103,12 @@ def _test(context, executor, lock_files, func, expected_failure):
node,
interface_name=interface_name,
operation_name=operation_name,
- inputs=arguments),
+ arguments=arguments),
api.task.OperationTask(
node,
interface_name=interface_name,
operation_name=operation_name,
- inputs=arguments)
+ arguments=arguments)
)
signal = events.on_failure_task_signal
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/f776a399/tests/orchestrator/workflows/executor/test_process_executor_extension.py
----------------------------------------------------------------------
diff --git a/tests/orchestrator/workflows/executor/test_process_executor_extension.py b/tests/orchestrator/workflows/executor/test_process_executor_extension.py
index b5f49ba..f5eb9d6 100644
--- a/tests/orchestrator/workflows/executor/test_process_executor_extension.py
+++ b/tests/orchestrator/workflows/executor/test_process_executor_extension.py
@@ -27,7 +27,7 @@ from tests import storage
def test_decorate_extension(context, executor):
- arguments = {'input1': 1, 'input2': 2}
+ arguments = {'arg1': 1, 'arg2': 2}
def get_node(ctx):
return ctx.model.node.get_by_name(mock.models.DEPENDENCY_NODE_NAME)
@@ -49,15 +49,15 @@ def test_decorate_extension(context, executor):
node,
interface_name=interface_name,
operation_name=operation_name,
- inputs=arguments)
+ arguments=arguments)
graph.add_tasks(task)
return graph
graph = mock_workflow(ctx=context) # pylint: disable=no-value-for-parameter
eng = engine.Engine(executor=executor, workflow_context=context, tasks_graph=graph)
eng.execute()
out = get_node(context).runtime_properties['out']
- assert out['wrapper_inputs'] == arguments
- assert out['function_inputs'] == arguments
+ assert out['wrapper_arguments'] == arguments
+ assert out['function_arguments'] == arguments
@extension.process_executor
@@ -65,16 +65,16 @@ class MockProcessExecutorExtension(object):
def decorate(self):
def decorator(function):
- def wrapper(ctx, **operation_inputs):
- ctx.node.runtime_properties['out'] = {'wrapper_inputs': operation_inputs}
- function(ctx=ctx, **operation_inputs)
+ def wrapper(ctx, **operation_arguments):
+ ctx.node.runtime_properties['out'] = {'wrapper_arguments': operation_arguments}
+ function(ctx=ctx, **operation_arguments)
return wrapper
return decorator
@operation
-def _mock_operation(ctx, **operation_inputs):
- ctx.node.runtime_properties['out']['function_inputs'] = operation_inputs
+def _mock_operation(ctx, **operation_arguments):
+ ctx.node.runtime_properties['out']['function_arguments'] = operation_arguments
@pytest.fixture
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/f776a399/tests/orchestrator/workflows/executor/test_process_executor_tracked_changes.py
----------------------------------------------------------------------
diff --git a/tests/orchestrator/workflows/executor/test_process_executor_tracked_changes.py b/tests/orchestrator/workflows/executor/test_process_executor_tracked_changes.py
index fb9a20d..8ceed6e 100644
--- a/tests/orchestrator/workflows/executor/test_process_executor_tracked_changes.py
+++ b/tests/orchestrator/workflows/executor/test_process_executor_tracked_changes.py
@@ -61,7 +61,7 @@ def test_refresh_state_of_tracked_attributes(context, executor):
def test_apply_tracked_changes_during_an_operation(context, executor):
- inputs = {
+ arguments = {
'committed': {'some': 'new', 'properties': 'right here'},
'changed_but_refreshed': {'some': 'newer', 'properties': 'right there'}
}
@@ -70,12 +70,12 @@ def test_apply_tracked_changes_during_an_operation(context, executor):
mock.models.DEPENDENCY_NODE_NAME).runtime_properties
out = _run_workflow(context=context, executor=executor, op_func=_mock_updating_operation,
- inputs=inputs)
+ arguments=arguments)
expected_after_update = expected_initial.copy()
- expected_after_update.update(inputs['committed']) # pylint: disable=no-member
+ expected_after_update.update(arguments['committed']) # pylint: disable=no-member
expected_after_change = expected_after_update.copy()
- expected_after_change.update(inputs['changed_but_refreshed']) # pylint: disable=no-member
+ expected_after_change.update(arguments['changed_but_refreshed']) # pylint: disable=no-member
expected_after_refresh = expected_after_update
assert out['initial'] == expected_initial
@@ -84,13 +84,13 @@ def test_apply_tracked_changes_during_an_operation(context, executor):
assert out['after_refresh'] == expected_after_refresh
-def _run_workflow(context, executor, op_func, inputs=None):
+def _run_workflow(context, executor, op_func, arguments=None):
@workflow
def mock_workflow(ctx, graph):
node = ctx.model.node.get_by_name(mock.models.DEPENDENCY_NODE_NAME)
interface_name = 'test_interface'
operation_name = 'operation'
- wf_arguments = inputs or {}
+ wf_arguments = arguments or {}
interface = mock.models.create_interface(
ctx.service,
interface_name,
@@ -103,7 +103,7 @@ def _run_workflow(context, executor, op_func, inputs=None):
node,
interface_name=interface_name,
operation_name=operation_name,
- inputs=wf_arguments)
+ arguments=wf_arguments)
graph.add_tasks(task)
return graph
graph = mock_workflow(ctx=context) # pylint: disable=no-value-for-parameter