Skip to content

Commit

Permalink
keep trying to abort until kernel becomes idle
Browse files Browse the repository at this point in the history
  • Loading branch information
vieiralucas committed Jan 30, 2025
1 parent 02ef5d0 commit 5a30bb3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions apps/api/src/python/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export async function executeCode(

if (executing) {
const { kernel } = await getSession(workspaceId, sessionId)
await kernel.interrupt()
await waitForKernelToBecomeIdle(workspaceId, sessionId, kernel)
return
}
},
Expand Down Expand Up @@ -601,9 +601,9 @@ async function waitForKernelToBecomeIdle(
sessionId,
kernelStatus: kernel.status,
},
'Spent more than 1 minute trying to get an idle kernel to execute code. Crashing.'
'Spent more than 1 minute attempting to make the kernel be idle. Crashing.'
)
throw new Error('Failed to get an idle kernel to execute code')
throw new Error('Failed to get an idle kernel')
}

// stuck trying to interrupt a non idle kernel for more than 10 seconds
Expand All @@ -615,7 +615,7 @@ async function waitForKernelToBecomeIdle(
sessionId,
kernelStatus: kernel.status,
},
'Spent more than 10 seconds trying to interrupt a non idle kernel before code execution. Restarting kernel instead.'
'Spent more than 10 seconds trying to interrupt a non idle kernel. Restarting kernel instead.'
)
await kernel.restart()
await new Promise((resolve) => setTimeout(resolve, 500))
Expand Down

0 comments on commit 5a30bb3

Please sign in to comment.