-
Notifications
You must be signed in to change notification settings - Fork 42
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomersv0.0.3
Milestone
Description
Summary
Parallelize graph verification to reduce end-to-end validation time in verify_graph.
Target
Run the following in parallel since they are independent:
verify_nodes_names(graph_template.nodes)verify_nodes_namespace(graph_template.nodes, graph_template.namespace)verify_node_exists(graph_template.nodes, database_nodes)verify_node_identifiers(graph_template.nodes)verify_secrets(graph_template, database_nodes)
Run verify_topology(graph_template.nodes) after the above complete.
Plan
- Refactor each verifier to return
list[str]of errors instead of mutating a sharederrorslist. - Aggregate results with
asyncio.gather, then call topology verification only if no blocking errors. - Keep DB calls async. If needed, bound concurrency with a semaphore for lookups.
Sketch
import asyncio
async def verify_graph(graph_template, database_nodes):
tasks = [
verify_nodes_names(graph_template.nodes),
verify_nodes_namespace(graph_template.nodes, graph_template.namespace),
verify_node_exists(graph_template.nodes, database_nodes),
verify_node_identifiers(graph_template.nodes),
verify_secrets(graph_template, database_nodes),
]
results = await asyncio.gather(*tasks, return_exceptions=True)
errors = []
for r in results:
if isinstance(r, Exception):
errors.append(f"Verifier failed: {r}")
else:
errors.extend(r)
dependency_graph = None
if not errors:
dependency_graph = await verify_topology(graph_template.nodes)
return dependency_graph, errorsTests
- Unit tests: each verifier returns errors deterministically, no shared state.
- Integration: simulate slow I/O in one verifier and confirm total time is close to the max of individual times, not the sum.
- Failure path: any verifier raises or returns errors, topology is skipped.
Acceptance criteria
- Verifiers run concurrently and overall verification time decreases.
- No shared mutable
errorsacross tasks. - Topology runs only after basic checks pass.
- CI green with new tests and type hints updated.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomersv0.0.3
Type
Projects
Status
Done