graflo.architecture.evolution.ordering¶
Order resources so that each runs after the resources it depends on.
Attributes¶
__all__ = ['order_resources']
module-attribute
¶
Functions:¶
order_resources(declared, constraints)
¶
The declared order, moved only as far as constraints require.
Each constraint (before, after) asks that before run first. A stable
topological sort over the strongly connected components of the
constraints: at each step the first component, in declared order of its
earliest member, whose predecessors outside it are all placed comes next,
its members in declared order. Resources no constraint names keep their
relative order. A name declared does not list is ignored, as is a
resource constrained against itself.
Returns:
| Type | Description |
|---|---|
list[str]
|
The order, and the constraints it leaves unsatisfied. Those are empty |
list[tuple[str, str]]
|
unless the constraints form a cycle; then only the resources in the |
tuple[list[str], list[tuple[str, str]]]
|
cycle keep their declared order among themselves, and each constraint |
tuple[list[str], list[tuple[str, str]]]
|
between two of them that this order violates is returned, in declared |
tuple[list[str], list[tuple[str, str]]]
|
order of their |