You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ariatosca.apache.org by ra...@apache.org on 2017/06/29 12:14:49 UTC
[9/9] incubator-ariatosca git commit: rebase fixes
rebase fixes
Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/c0cf01f5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/c0cf01f5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/c0cf01f5
Branch: refs/heads/master
Commit: c0cf01f51fd3c790aa5bbdb138387e4d980376b1
Parents: 8eef8ed
Author: Ran Ziv <ra...@gigaspaces.com>
Authored: Thu Jun 29 11:30:23 2017 +0300
Committer: Ran Ziv <ra...@gigaspaces.com>
Committed: Thu Jun 29 14:52:48 2017 +0300
----------------------------------------------------------------------
aria/modeling/orchestration.py | 2 +-
aria/modeling/relationship.py | 39 ++------
aria/orchestrator/workflows/core/compile.py | 120 -----------------------
docs/aria.orchestrator.workflows.rst | 6 +-
4 files changed, 13 insertions(+), 154 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/c0cf01f5/aria/modeling/orchestration.py
----------------------------------------------------------------------
diff --git a/aria/modeling/orchestration.py b/aria/modeling/orchestration.py
index 55d4c74..7068557 100644
--- a/aria/modeling/orchestration.py
+++ b/aria/modeling/orchestration.py
@@ -91,7 +91,7 @@ class ExecutionBase(mixins.ModelMixin):
@declared_attr
def logs(cls):
"""
- General log messages for the execution (not for its tasks).
+ Log messages for the execution (including log messages for its tasks).
:type: [:class:`Log`]
"""
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/c0cf01f5/aria/modeling/relationship.py
----------------------------------------------------------------------
diff --git a/aria/modeling/relationship.py b/aria/modeling/relationship.py
index 51fbfd6..8b6028f 100644
--- a/aria/modeling/relationship.py
+++ b/aria/modeling/relationship.py
@@ -96,35 +96,6 @@ def one_to_one_self(model_class, fk):
)
-def one_to_many_self(model_class, fk, dict_key=None):
- """
- Declare a one-to-many relationship property. The property value would be a list or dict of
- instances of the same model.
-
- You will need an associated foreign key to our own table.
-
- *This utility method should only be used during class creation.*
-
- :param model_class: class in which this relationship will be declared
- :type model_class: type
- :param fk: Foreign key name
- :type fk: basestring
- :param dict_key: if set the value will be a dict with this key as the dict key; otherwise will
- be a list
- :type dict_key: basestring
- """
- return _relationship(
- model_class,
- model_class.__tablename__,
- relationship_kwargs={
- 'remote_side': '{model_class}.{remote_column}'.format(
- model_class=model_class.__name__, remote_column=fk)
- },
- back_populates=False,
- dict_key=dict_key
- )
-
-
def one_to_one(model_class,
other_table,
fk=None,
@@ -195,8 +166,13 @@ def one_to_many(model_class,
be a list
:type dict_key: basestring
:param back_populates: override name of matching many-to-one property at other table; set to
- ``false`` to disable
+ ``False`` to disable
:type back_populates: basestring or bool
+ :param rel_kwargs: additional relationship kwargs to be used by SQLAlchemy
+ :type rel_kwargs: dict
+ :param self: used for relationships between a table and itself. if set, other_table will
+ become the same as the source table.
+ :type self: bool
"""
relationship_kwargs = rel_kwargs or {}
if self:
@@ -292,6 +268,9 @@ def many_to_many(model_class,
:param other_property: override name of matching many-to-many property at other table; set to
``False`` to disable
:type other_property: basestring or bool
+ :param self: used for relationships between a table and itself. if set, other_table will
+ become the same as the source table.
+ :type self: bool
"""
this_table = model_class.__tablename__
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/c0cf01f5/aria/orchestrator/workflows/core/compile.py
----------------------------------------------------------------------
diff --git a/aria/orchestrator/workflows/core/compile.py b/aria/orchestrator/workflows/core/compile.py
deleted file mode 100644
index e405715..0000000
--- a/aria/orchestrator/workflows/core/compile.py
+++ /dev/null
@@ -1,120 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-"""
-Workflow compilation.
-"""
-
-from ....modeling import models
-from .. import executor, api
-
-
-def create_execution_tasks(ctx, task_graph, default_executor):
- execution = ctx.execution
- _construct_execution_tasks(execution, task_graph, default_executor)
- ctx.model.execution.update(execution)
- return execution.tasks
-
-
-def _construct_execution_tasks(execution,
- task_graph,
- default_executor,
- stub_executor=executor.base.StubTaskExecutor,
- start_stub_type=models.Task.START_WORKFLOW,
- end_stub_type=models.Task.END_WORKFLOW,
- depends_on=()):
- """
- Translates the user graph to the execution graph.
-
- :param task_graph: user graph
- :param start_stub_type: internal use
- :param end_stub_type: internal use
- :param depends_on: internal use
- """
- depends_on = list(depends_on)
-
- # Insert start marker
- start_task = models.Task(execution=execution,
- dependencies=depends_on,
- _api_id=_start_graph_suffix(task_graph.id),
- _stub_type=start_stub_type,
- _executor=stub_executor)
-
- for task in task_graph.topological_order(reverse=True):
- operation_dependencies = _get_tasks_from_dependencies(
- execution, task_graph.get_dependencies(task), [start_task])
-
- if isinstance(task, api.task.OperationTask):
- models.Task.from_api_task(api_task=task,
- executor=default_executor,
- dependencies=operation_dependencies)
-
- elif isinstance(task, api.task.WorkflowTask):
- # Build the graph recursively while adding start and end markers
- _construct_execution_tasks(
- execution=execution,
- task_graph=task,
- default_executor=default_executor,
- stub_executor=stub_executor,
- start_stub_type=models.Task.START_SUBWROFKLOW,
- end_stub_type=models.Task.END_SUBWORKFLOW,
- depends_on=operation_dependencies
- )
- elif isinstance(task, api.task.StubTask):
- models.Task(execution=execution,
- dependencies=operation_dependencies,
- _api_id=task.id,
- _executor=stub_executor,
- _stub_type=models.Task.STUB,
- )
- else:
- raise RuntimeError('Undefined state')
-
- # Insert end marker
- models.Task(dependencies=_get_non_dependent_tasks(execution) or [start_task],
- execution=execution,
- _api_id=_end_graph_suffix(task_graph.id),
- _executor=stub_executor,
- _stub_type=end_stub_type)
-
-
-def _start_graph_suffix(api_id):
- return '{0}-Start'.format(api_id)
-
-
-def _end_graph_suffix(api_id):
- return '{0}-End'.format(api_id)
-
-
-def _get_non_dependent_tasks(execution):
- tasks_with_dependencies = set()
- for task in execution.tasks:
- tasks_with_dependencies.update(task.dependencies)
- return list(set(execution.tasks) - set(tasks_with_dependencies))
-
-
-def _get_tasks_from_dependencies(execution, dependencies, default=()):
- """
- Returns task list from dependencies.
- """
- tasks = []
- for dependency in dependencies:
- if getattr(dependency, 'actor', False):
- # This is
- dependency_name = dependency.id
- else:
- dependency_name = _end_graph_suffix(dependency.id)
- tasks.extend(task for task in execution.tasks if task._api_id == dependency_name)
- return tasks or default
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/c0cf01f5/docs/aria.orchestrator.workflows.rst
----------------------------------------------------------------------
diff --git a/docs/aria.orchestrator.workflows.rst b/docs/aria.orchestrator.workflows.rst
index 12f8d9d..c0bc1c1 100644
--- a/docs/aria.orchestrator.workflows.rst
+++ b/docs/aria.orchestrator.workflows.rst
@@ -35,10 +35,10 @@
.. automodule:: aria.orchestrator.workflows.core
-:mod:`aria.orchestrator.workflows.core.compile`
------------------------------------------------
+:mod:`aria.orchestrator.workflows.core.graph_compiler`
+------------------------------------------------------
-.. automodule:: aria.orchestrator.workflows.core.compile
+.. automodule:: aria.orchestrator.workflows.core.graph_compiler
:mod:`aria.orchestrator.workflows.core.engine`
----------------------------------------------