Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions evals/apps/web/src/app/runs/new/settings-diff.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export function SettingsDiff({
const isDefault = JSON.stringify(defaultValue) === JSON.stringify(customValue)

return isDefault ? null : (
<SetttingDiff
<SettingDiff
key={key}
name={key}
defaultValue={JSON.stringify(defaultValue, null, 2)}
Expand All @@ -46,7 +46,7 @@ type SettingDiffProps = HTMLAttributes<HTMLDivElement> & {
customValue?: string
}

export function SetttingDiff({ name, defaultValue, customValue, ...props }: SettingDiffProps) {
export function SettingDiff({ name, defaultValue, customValue, ...props }: SettingDiffProps) {
return (
<Fragment {...props}>
<div className="overflow-hidden font-mono">{name}</div>
Expand Down
49 changes: 29 additions & 20 deletions evals/apps/web/src/lib/server/processes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,33 @@
import psTree from "ps-tree"
import { exec } from "child_process"

export const getProcessList = async (pid: number) => {
const promise = new Promise<string>((resolve, reject) => {
exec(`ps -p ${pid} -o pid=`, (err, stdout, stderr) => {
if (err) {
reject(stderr)
const asyncExec = (command: string): Promise<{ stdout: string; stderr: string }> =>
new Promise((resolve, reject) => {
exec(command, (error, stdout, stderr) => {
if (error) {
reject(error)
} else {
resolve({ stdout, stderr })
}

resolve(stdout)
})
})

export const getProcessList = async (pid: number) => {
try {
await promise
} catch (_) {
return null
}
await asyncExec(`ps -p ${pid} -o pid=`)

return new Promise<number[]>((resolve, reject) => {
psTree(pid, (err, children) => {
if (err) {
reject(err)
}
return new Promise<number[]>((resolve, reject) => {
psTree(pid, (err, children) => {
if (err) {
reject(err)
}

resolve(children.map((p) => parseInt(p.PID)))
resolve(children.map((p) => parseInt(p.PID)))
})
})
})
} catch (_) {
return null
}
}

export const killProcessTree = async (pid: number) => {
Expand All @@ -39,8 +40,16 @@ export const killProcessTree = async (pid: number) => {
}

if (descendants.length > 0) {
await exec(`kill -9 ${descendants.join(" ")}`)
try {
await asyncExec(`kill -9 ${descendants.join(" ")}`)
} catch (error) {
console.error("Error killing descendant processes:", error)
}
}

await exec(`kill -9 ${pid}`)
try {
await asyncExec(`kill -9 ${pid}`)
} catch (error) {
console.error("Error killing main process:", error)
}
}
2 changes: 1 addition & 1 deletion evals/packages/db/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Update `src/schema.ts` as needed, and then run:
pnpm db:generate
```

Inspect the generated sql in the migration filed added to `drizzle/`.
Inspect the sql in the migration file added to `drizzle/`.

If it looks okay, then run:

Expand Down