feat(engine): Graph engine simulation#314
Conversation
Greptile SummaryThis PR introduces a new
Confidence Score: 5/5Safe to merge; the graph engine logic, cache integration, and provider plumbing are all correct. The core engine correctly guards the InstanceProvider call behind a len(missing) > 0 check, validates that every requested instance ID was returned, and propagates errors faithfully. The consolidation of Node types into the topology package is cleanly executed. Two minor JSON-contract observations (missing omitempty on GpuAttribute string fields, nil vs empty-slice for NetworkLayers) are style-level and do not break any current path. pkg/topology/instances.go — JSON serialization behaviour for nodes with no GPU metadata or no switch associations. Important Files Changed
Sequence DiagramsequenceDiagram
participant Client
participant Server as server.processTopologyRequest
participant Provider as providers.Provider
participant GraphEngine as graph.GraphEngine
participant Cache as InstanceCache
participant InstProv as engines.InstanceProvider
Client->>Server: POST /v1/generate (graph engine)
Server->>Provider: GetComputeInstances(ctx)
Provider-->>Server: []ComputeInstances (instanceID→node map)
Server->>Provider: GenerateTopologyConfig(ctx, computeInstances)
Provider-->>Server: "*topology.Graph"
Server->>GraphEngine: GenerateOutput(ctx, graph, computeInstances, params, provider)
GraphEngine->>Cache: Get(ctx, cacheKey) for each instanceID
alt cache hit
Cache-->>GraphEngine: "*topology.Node"
else cache miss
Cache-->>GraphEngine: nil → added to missing[]
end
alt "len(missing) > 0"
GraphEngine->>InstProv: GetInstances(ctx, missing)
InstProv-->>GraphEngine: []topology.Node
GraphEngine->>Cache: Set(ctx, key, node) for each result
GraphEngine->>GraphEngine: verify all missing IDs returned
end
GraphEngine->>GraphEngine: sort instances by ID, marshal JSON
alt outputPath set
GraphEngine->>GraphEngine: files.Validate + files.Create
GraphEngine-->>Server: OK
else no outputPath
GraphEngine-->>Server: JSON bytes
end
Server-->>Client: response
Reviews (7): Last reviewed commit: "feat(engine): Graph Engine simulator" | Re-trigger Greptile |
64556d5 to
3979991
Compare
3979991 to
7029cf2
Compare
6728214 to
16ee88a
Compare
16ee88a to
c1cfde2
Compare
Signed-off-by: Ravi Shankar <ravish@nvidia.com>
c1cfde2 to
f8a9ba3
Compare
Description
Maestro engine simulation.
Checklist
git commit -s).