Skip to content

Commit

Permalink
fix: use api for latest runs instead of local filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
jfrer committed Jun 14, 2024
1 parent cc76ffc commit 4c228f3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
6 changes: 6 additions & 0 deletions src/components/Workflows.vue
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
}
workflowsStore.runs = await api.getRuns()
workflowsStore.latestRuns = await api.getLatestRuns()
workflowsStore.gt = await api.getGroundTruth()
workflowsStore.workflows = await api.getWorkflows()
Expand All @@ -58,6 +59,11 @@
if (!workflowsStore.gt.find(gt => gt.id === gtId)) console.log(gtId)
})
workflowsStore.latestRuns.forEach(run => {
const gtId = mapGtId(run.metadata.gt_workspace.id)
if (!workflowsStore.gt.find(gt => gt.id === gtId)) console.log(gtId)
})
const releasesObj = workflowsStore.runs.reduce((acc, cur) => {
acc[cur.metadata.release_info.tag_name] = cur.metadata.release_info
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ async function getLatestRuns(gtId?: string, workflowId?: string): Promise<Evalua

path += '/latest'

return await request(path)
return (await request(path)).flat(1)
}

async function request (url: string) {
Expand Down
9 changes: 3 additions & 6 deletions src/store/workflows-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export default reactive<{
gt: GroundTruth[],
workflows: Workflow[],
runs: EvaluationRun[],
latestRuns: EvaluationRun[],
releases: ReleaseInfo[],
getRuns: (gtId: string, workflowId?: string) => EvaluationRun[]
getLatestRuns: () => EvaluationRun[],
Expand All @@ -19,6 +20,7 @@ export default reactive<{
gt: [],
workflows: [],
runs: [],
latestRuns: [],
releases: [],
getRuns(gtId: string, workflowId?: string) {
return this.runs
Expand All @@ -32,12 +34,7 @@ export default reactive<{
)
},
getLatestRuns() {
const dates = Object.keys(this.runs.reduce((acc, cur) => {
acc[normalizeDate(cur.metadata.timestamp)] = null
return acc
}, <{ [key: string]: null}>{}))

return this.runs.filter(({ metadata }) => normalizeDate(metadata.timestamp) === dates[dates.length - 1])
return this.latestRuns
},
getGtById(id: string): GroundTruth | null {
return this.gt.find((item) => item.id === id) ?? null
Expand Down

0 comments on commit 4c228f3

Please sign in to comment.