Repository: incubator-ariatosca Updated Branches: refs/heads/ARIA-408-Remove-execution-creation-from-WorkflowRunner 3dbe5b3cf -> 46cbc7e81 (forced update)
linting Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/46cbc7e8 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/46cbc7e8 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/46cbc7e8 Branch: refs/heads/ARIA-408-Remove-execution-creation-from-WorkflowRunner Commit: 46cbc7e816a948d2dc99cf8c27e50ff19d82108a Parents: 9e844fc Author: max-orlov <[email protected]> Authored: Mon Nov 20 16:55:14 2017 +0200 Committer: max-orlov <[email protected]> Committed: Mon Nov 20 17:35:42 2017 +0200 ---------------------------------------------------------------------- aria/cli/commands/executions.py | 10 ++++++---- aria/orchestrator/execution_compiler.py | 8 ++++---- docs/aria.orchestrator.rst | 2 +- tests/end2end/testenv.py | 1 + tests/orchestrator/execution/test_execution_compiler.py | 3 ++- .../core/test_task_graph_into_execution_graph.py | 2 +- 6 files changed, 15 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/46cbc7e8/aria/cli/commands/executions.py ---------------------------------------------------------------------- diff --git a/aria/cli/commands/executions.py b/aria/cli/commands/executions.py index f2e9145..de030c6 100644 --- a/aria/cli/commands/executions.py +++ b/aria/cli/commands/executions.py @@ -146,10 +146,10 @@ def start(workflow_name, executor = DryExecutor() if dry else ProcessExecutor(plugin_manager=plugin_manager) compiler = execution_compiler.ExecutionCompiler( - model_storage, - resource_storage, - plugin_manager, - service, + model_storage, + resource_storage, + plugin_manager, + service, workflow_name ) workflow_ctx = compiler.compile(inputs, executor=executor) @@ -238,6 +238,8 @@ def _run_execution( except KeyboardInterrupt: _cancel_execution(engine, ctx, execution_thread, logger, log_iterator) + model_storage.execution.refresh(ctx.execution) + # It might be the case where some logs were written and the execution was terminated, thus we # need to drain the remaining logs. execution_logging.log_list(log_iterator, mark_pattern=mark_pattern) http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/46cbc7e8/aria/orchestrator/execution_compiler.py ---------------------------------------------------------------------- diff --git a/aria/orchestrator/execution_compiler.py b/aria/orchestrator/execution_compiler.py index 01e35c1..f86e6b3 100644 --- a/aria/orchestrator/execution_compiler.py +++ b/aria/orchestrator/execution_compiler.py @@ -92,9 +92,9 @@ class ExecutionCompiler(object): if len(self._execution.tasks) == 0: workflow_fn = self._get_workflow_fn(self._execution.workflow_name) - self._tasks_graph = workflow_fn(ctx=self.workflow_ctx, **execution_inputs_dict) + tasks_graph = workflow_fn(ctx=self.workflow_ctx, **execution_inputs_dict) compiler = graph_compiler.GraphCompiler(self.workflow_ctx, executor.__class__) - compiler.compile(self._tasks_graph) + compiler.compile(tasks_graph) def _create_execution_model(self, inputs=None): self._validate_workflow_exists_for_service() @@ -126,14 +126,14 @@ class ExecutionCompiler(object): if active_executions: raise exceptions.ActiveExecutionsError( "Can't start execution; Service {0} has an active execution with ID {1}" - .format(self._service.name, active_executions[0].id)) + .format(self._service.name, active_executions[0].id)) def _validate_workflow_exists_for_service(self): if self._workflow_name not in self._service.workflows and \ self._workflow_name not in builtin.BUILTIN_WORKFLOWS: raise exceptions.UndeclaredWorkflowError( 'No workflow policy {0} declared in service {1}' - .format(self._workflow_name, self._service.name)) + .format(self._workflow_name, self._service.name)) def _get_workflow_fn(self, workflow_name): if workflow_name in builtin.BUILTIN_WORKFLOWS: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/46cbc7e8/docs/aria.orchestrator.rst ---------------------------------------------------------------------- diff --git a/docs/aria.orchestrator.rst b/docs/aria.orchestrator.rst index 8c1c938..5d7eda6 100644 --- a/docs/aria.orchestrator.rst +++ b/docs/aria.orchestrator.rst @@ -41,6 +41,6 @@ .. automodule:: aria.orchestrator.plugin :mod:`aria.orchestrator.execution_compiler` ----------------------------------------- +------------------------------------------- .. automodule:: aria.orchestrator.execution_compiler http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/46cbc7e8/tests/end2end/testenv.py ---------------------------------------------------------------------- diff --git a/tests/end2end/testenv.py b/tests/end2end/testenv.py index 43ec274..c3d055d 100644 --- a/tests/end2end/testenv.py +++ b/tests/end2end/testenv.py @@ -68,6 +68,7 @@ class TestEnvironment(object): assert len(self.model_storage.node_template.list()) == 0 assert len(self.model_storage.node.list()) == 0 assert len(self.model_storage.log.list()) == 0 + assert len(self.model_storage.task.list()) == 0 def _get_cli(self): cli = sh.aria.bake('-vvv', _out=sys.stdout, _err=sys.stderr) http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/46cbc7e8/tests/orchestrator/execution/test_execution_compiler.py ---------------------------------------------------------------------- diff --git a/tests/orchestrator/execution/test_execution_compiler.py b/tests/orchestrator/execution/test_execution_compiler.py index 14332db..6062686 100644 --- a/tests/orchestrator/execution/test_execution_compiler.py +++ b/tests/orchestrator/execution/test_execution_compiler.py @@ -91,7 +91,8 @@ def test_custom_workflow_instantiation(request): # (expecting no errors to be raised on undeclared workflow or missing workflow implementation) mock_workflow = _setup_mock_workflow_in_service(request) workflow_ctx = _get_compiler(request, mock_workflow).compile() - assert len(workflow_ctx.execution.tasks) == 2 # mock workflow creates only start workflow and end workflow task + assert len(workflow_ctx.execution.tasks) == 2 # mock workflow creates only start workflow + # and end workflow task def test_existing_active_executions(request, service, model): http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/46cbc7e8/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 7f2b7c6..9f072f6 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 @@ -99,7 +99,7 @@ def test_task_graph_into_execution_graph(tmpdir): '{0}-End'.format(test_task_graph.id) ] - # assert expected_tasks_names == [compiler._model_to_api_id[t.id] for t in execution_tasks] + assert expected_tasks_names == [compiler._model_to_api_id[t.id] for t in execution_tasks] assert all(isinstance(task, models.Task) for task in execution_tasks) execution_tasks = iter(execution_tasks)
