依赖图与局部重算
原能力
记录实际依赖及失效传播,按影响范围局部重算,不凭相似度复用。(合同附件 R7 22.7)
首选项目
NetworkX(BSD-3-Clause)。 NetworkX
匹配范围
拓扑遍历和数据血缘确定依赖及受影响子图。
源码
NetworkX · def descendants(
networkx/algorithms/dag.py · 36–49 行。 在 GitHub 查看源码 · 许可证与声明
源码片段
def descendants(G, source):
"""Returns all nodes reachable from `source` in `G`.
Parameters
----------
G : NetworkX Graph
source : node in `G`
Returns
-------
set()
The descendants of `source` in `G`
Raises
NetworkX · def topological_sort(
networkx/algorithms/dag.py · 312–325 行。 在 GitHub 查看源码 · 许可证与声明
源码片段
def topological_sort(G):
"""Returns a generator of nodes in topologically sorted order.
A topological sort is a nonunique permutation of the nodes of a
directed graph such that an edge from u to v implies that u
appears before v in the topological sort order. This ordering is
valid only if the graph has no directed cycles.
Parameters
----------
G : NetworkX digraph
A directed acyclic graph (DAG)
Yields
OpenLineage · class RunEvent
client/python/src/openlineage/client/run.py · 102–115 行。 在 GitHub 查看源码 · 许可证与声明
源码片段
class RunEvent(RedactMixin):
eventType: RunState = attr.ib(validator=attr.validators.in_(list(RunState))) # noqa: N815
eventTime: str = attr.ib() # noqa: N815
run: Run = attr.ib()
job: Job = attr.ib()
producer: str = attr.ib()
inputs: list[Dataset] | None = attr.ib(factory=list)
outputs: list[Dataset] | None = attr.ib(factory=list)
schemaURL: str = attr.ib(default=SCHEMA_URL) # noqa: N815
_skip_redact: ClassVar[list[str]] = ["eventType", "eventTime", "producer", "schemaURL"]
@eventTime.validator
def check(self, attribute: str, value: str) -> None: # noqa: ARG002
- # Copyright 2018-2026 contributors to the OpenLineage project
- # SPDX-License-Identifier: Apache-2.0
接口用法示意
affected = nx.descendants(graph, changed_node); ordered = list(nx.topological_sort(graph.subgraph(affected)))
实现与验收要点
动态依赖、局部重算、原状态和并发更新。