Github user aviyoop commented on a diff in the pull request:
https://github.com/apache/incubator-ariatosca/pull/208#discussion_r152312803
--- Diff: aria/orchestrator/execution_preparer.py ---
@@ -31,70 +31,79 @@
DEFAULT_TASK_RETRY_INTERVAL = 30
-class ExecutionCompiler(object):
+class ExecutionPreparer(object):
+ """
+ This class manages any execution and tasks related preparation for an
execution of a workflow.
+ """
def __init__(
self,
- model,
- resource,
- plugin,
+ model_storage,
+ resource_storagee,
+ plugin_manager,
service,
workflow_name,
task_max_attempts=None,
task_retry_interval=None
):
- self._model = model
- self._resource = resource
- self._plugin = plugin
+ self._model = model_storage
+ self._resource = resource_storagee
+ self._plugin = plugin_manager
self._service = service
self._workflow_name = workflow_name
- self._workflow_context = None
- self._execution = None
self._task_max_attempts = task_max_attempts or
DEFAULT_TASK_MAX_ATTEMPTS
self._task_retry_interval = task_retry_interval or
DEFAULT_TASK_RETRY_INTERVAL
- @property
- def workflow_ctx(self):
- if self._workflow_context is None:
- self._workflow_context = WorkflowContext(
- name=self.__class__.__name__,
- model_storage=self._model,
- resource_storage=self._resource,
- service_id=self._execution.service.id,
- execution_id=self._execution.id,
- workflow_name=self._execution.workflow_name,
- task_max_attempts=self._task_max_attempts,
- task_retry_interval=self._task_retry_interval,
- )
- return self._workflow_context
-
- def compile(self, execution_inputs=None, executor=None,
execution_id=None):
+ def get_ctx(self, execution):
+ return WorkflowContext(
+ name=self._workflow_name,
+ model_storage=self._model,
+ resource_storage=self._resource,
+ service_id=execution.service.id,
+ execution_id=execution.id,
+ workflow_name=execution.workflow_name,
+ task_max_attempts=self._task_max_attempts,
+ task_retry_interval=self._task_retry_interval,
+ )
+
+ def prepare(self, execution_inputs=None, executor=None,
execution_id=None):
+ """
+ Prepares the execution and return the workflow ctx. If the
execution is new, an execution
+ and tasks models would be created. A workflow context for the
appropriate execution would
+ be created.
+
+ :param execution_inputs: Inputs for the execution.
--- End diff --
Inconsistency with capitalization
---