Skip to content

Commit

Permalink
build relation dep edges
Browse files Browse the repository at this point in the history
  • Loading branch information
kwannoel committed Sep 17, 2024
1 parent f17a4e3 commit b5a6704
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
5 changes: 3 additions & 2 deletions dashboard/lib/api/streaming.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ export async function getRelations() {
return relations
}

export async function getRelationDependencies() {
export async function getRelationDependencies(): Map<number, number[]> {
return await getObjectDependencies()
}

Expand Down Expand Up @@ -200,7 +200,8 @@ export async function getSchemas() {
return schemas
}

export async function getObjectDependencies() {
// Returns a map of object id to a list of object ids that it depends on
export async function getObjectDependencies(): Map<number, number[]> {
let objDependencies: ObjectDependencies[] = (
await api.get("/object_dependencies")
).map(ObjectDependencies.fromJSON)
Expand Down
24 changes: 22 additions & 2 deletions dashboard/pages/ddl_graph.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ import {
import {
getFragmentsByJobId, getRelationDependencies,
getRelationIdInfos,
getStreamingJobs,
getStreamingJobs, Relation,
} from "../lib/api/streaming"
import {DdlBox, FragmentBox} from "../lib/layout"
import { TableFragments, TableFragments_Fragment } from "../proto/gen/meta"
Expand Down Expand Up @@ -225,6 +225,26 @@ function buildFragmentDependencyAsEdges(
return nodes
}

function buildDdlDependencyAsEdges(
relations: Relation[],
dependencies: Map<number, number[]>,
): DdlBox[] {
const nodes: DdlBox[] = []
for (const relation of relations) {
let parentIds = dependencies.get(relation.id) || []
nodes.push({
id: relation.id.toString(),
order: relation.id,
width: 0,
height: 0,
parentIds: parentIds.map((x) => x.toString()),
ddl_name: relation.name,
schema_name: relation.schemaName
})
}
return nodes
}

const SIDEBAR_WIDTH = 200

type BackPressureDataSource = "Embedded" | "Prometheus"
Expand All @@ -246,7 +266,7 @@ export default function Streaming() {
const { response: relationList } = useFetch(getStreamingJobs)
const { response: relationIdInfos } = useFetch(getRelationIdInfos)
// 1. Get the relation dependendencies.
// const { response: relationDeps } = useFetch(getRelationDependencies)
const { response: relationDeps } = useFetch(getRelationDependencies)
// 2. Get the relation -> input fragment_id mapping.
// 3. Get the relation -> output fragment_id mapping.
// 4. Construct the BP graph for relation ids using 1-3.
Expand Down

0 comments on commit b5a6704

Please sign in to comment.