MCPcopy Create free account
hub / github.com/deepnote/deepnote / saveExecutionSnapshotBestEffort

Function saveExecutionSnapshotBestEffort

packages/cli/src/commands/run.ts:1209–1243  ·  view source on GitHub ↗
({
  absolutePath,
  convertedFile,
  file,
  blockResults,
  executionStartedAt,
  isMachineOutput,
}: {
  absolutePath: string
  convertedFile: LoadedRunnableFile
  file: DeepnoteFile
  blockResults: BlockResult[]
  executionStartedAt: string
  isMachineOutput: boolean
})

Source from the content-addressed store, hash-verified

1207}
1208
1209async function saveExecutionSnapshotBestEffort({
1210 absolutePath,
1211 convertedFile,
1212 file,
1213 blockResults,
1214 executionStartedAt,
1215 isMachineOutput,
1216}: {
1217 absolutePath: string
1218 convertedFile: LoadedRunnableFile
1219 file: DeepnoteFile
1220 blockResults: BlockResult[]
1221 executionStartedAt: string
1222 isMachineOutput: boolean
1223}): Promise<void> {
1224 const executionFinishedAt = new Date().toISOString()
1225
1226 try {
1227 const snapshotSourcePath = convertedFile.wasConverted
1228 ? absolutePath.replace(/\.(ipynb|py|qmd)$/, '.deepnote')
1229 : absolutePath
1230
1231 const { snapshotPath } = await saveExecutionSnapshot(snapshotSourcePath, file, blockResults, {
1232 startedAt: executionStartedAt,
1233 finishedAt: executionFinishedAt,
1234 })
1235
1236 if (!isMachineOutput) {
1237 debug(`Snapshot saved to: ${snapshotPath}`)
1238 }
1239 } catch (snapshotError) {
1240 // Snapshot saving is best-effort; don't fail the run if it fails
1241 debug(`Failed to save snapshot: ${snapshotError instanceof Error ? snapshotError.message : String(snapshotError)}`)
1242 }
1243}
1244
1245async function buildMachineRunResult({
1246 absolutePath,

Callers 1

runDeepnoteProjectFunction · 0.85

Calls 2

saveExecutionSnapshotFunction · 0.90
debugFunction · 0.90

Tested by

no test coverage detected