Repository: incubator-ariatosca Updated Branches: refs/heads/ARIA-294-Workflow-tasks-execution-is-not-in-order d7d5051d8 -> 9820e1b7f
removed other_table name Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/9820e1b7 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/9820e1b7 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/9820e1b7 Branch: refs/heads/ARIA-294-Workflow-tasks-execution-is-not-in-order Commit: 9820e1b7f9cfda782cc0cfb9ba8c0fbb50b189b5 Parents: d7d5051 Author: max-orlov <[email protected]> Authored: Wed Jun 28 11:53:42 2017 +0300 Committer: max-orlov <[email protected]> Committed: Wed Jun 28 11:53:42 2017 +0300 ---------------------------------------------------------------------- aria/modeling/orchestration.py | 2 +- aria/modeling/relationship.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/9820e1b7/aria/modeling/orchestration.py ---------------------------------------------------------------------- diff --git a/aria/modeling/orchestration.py b/aria/modeling/orchestration.py index ab389d3..829c305 100644 --- a/aria/modeling/orchestration.py +++ b/aria/modeling/orchestration.py @@ -398,7 +398,7 @@ class TaskBase(mixins.ModelMixin): @declared_attr def dependencies(cls): - return relationship.many_to_many(cls, 'task', self=True) + return relationship.many_to_many(cls, self=True) def has_ended(self): return self.status in (self.SUCCESS, self.FAILED) http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/9820e1b7/aria/modeling/relationship.py ---------------------------------------------------------------------- diff --git a/aria/modeling/relationship.py b/aria/modeling/relationship.py index 30d174f..76ac316 100644 --- a/aria/modeling/relationship.py +++ b/aria/modeling/relationship.py @@ -226,7 +226,7 @@ def many_to_one(model_class, def many_to_many(model_class, - other_table, + other_table=None, prefix=None, dict_key=None, other_property=None, @@ -263,6 +263,9 @@ def many_to_many(model_class, this_column_name = '{0}_id'.format(this_table) this_foreign_key = '{0}.id'.format(this_table) + if self: + other_table = this_table + other_column_name = '{0}_{1}'.format(other_table, 'self_ref_id' if self else 'id') other_foreign_key = '{0}.{1}'.format(other_table, 'id')
