mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-09-06 08:18:39 +00:00
More progress
This commit is contained in:
parent
4ea5f21792
commit
689e104455
2 changed files with 35 additions and 17 deletions
|
|
@ -28,7 +28,6 @@ import {
|
|||
createTaskMetrics,
|
||||
updateTaskMetrics,
|
||||
} from "@benchmark/db"
|
||||
import { inChunksOf } from "@benchmark/lib"
|
||||
import { IpcServer, IpcClient } from "@benchmark/ipc"
|
||||
|
||||
import { __dirname, extensionDevelopmentPath, exercisesPath } from "./paths.js"
|
||||
|
|
@ -108,25 +107,39 @@ const run = async (toolbox: GluegunToolbox) => {
|
|||
// })
|
||||
// })
|
||||
|
||||
const chunks = inChunksOf(tasks, 3)
|
||||
const maxConcurrency = 3
|
||||
const runningPromises: Promise<void>[] = []
|
||||
|
||||
for (const chunk of chunks) {
|
||||
await Promise.all(
|
||||
chunk.map(async (task) => {
|
||||
if (task.finishedAt === null) {
|
||||
await runExercise({ run, task, server })
|
||||
}
|
||||
const processTask = async (task: Task) => {
|
||||
if (task.finishedAt === null) {
|
||||
await runExercise({ run, task, server })
|
||||
}
|
||||
|
||||
if (task.passed === null) {
|
||||
const passed = await runUnitTest({ task })
|
||||
await updateTask(task.id, { passed })
|
||||
}
|
||||
}),
|
||||
)
|
||||
|
||||
break
|
||||
if (task.passed === null) {
|
||||
const passed = await runUnitTest({ task })
|
||||
await updateTask(task.id, { passed })
|
||||
}
|
||||
}
|
||||
|
||||
for (const task of tasks) {
|
||||
const taskPromise = processTask(task)
|
||||
runningPromises.push(taskPromise)
|
||||
|
||||
taskPromise.finally(() => {
|
||||
const index = runningPromises.indexOf(taskPromise)
|
||||
|
||||
if (index > -1) {
|
||||
runningPromises.splice(index, 1)
|
||||
}
|
||||
})
|
||||
|
||||
if (runningPromises.length >= maxConcurrency) {
|
||||
await Promise.race(runningPromises)
|
||||
}
|
||||
}
|
||||
|
||||
await Promise.all(runningPromises)
|
||||
|
||||
const result = await finishRun(run.id)
|
||||
console.log("[cli#run]", result)
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import type { Run, TaskMetrics } from "@benchmark/db"
|
|||
import { formatCurrency, formatDuration } from "@/lib"
|
||||
import { Button, Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui"
|
||||
import { useMemo } from "react"
|
||||
import Link from "next/link"
|
||||
|
||||
export function Home({ runs }: { runs: (Run & { taskMetrics: TaskMetrics | null })[] }) {
|
||||
const router = useRouter()
|
||||
|
|
@ -33,7 +34,11 @@ export function Home({ runs }: { runs: (Run & { taskMetrics: TaskMetrics | null
|
|||
{visibleRuns.length ? (
|
||||
visibleRuns.map(({ taskMetrics, ...run }) => (
|
||||
<TableRow key={run.id}>
|
||||
<TableCell>{run.id}</TableCell>
|
||||
<TableCell>
|
||||
<Button variant="link" asChild>
|
||||
<Link href={`/runs/${run.id}`}>{run.id}</Link>
|
||||
</Button>
|
||||
</TableCell>
|
||||
<TableCell>{run.model}</TableCell>
|
||||
<TableCell>{new Date(run.createdAt).toLocaleString()}</TableCell>
|
||||
<TableCell>{run.passed}</TableCell>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue