Skip to content

Commit

Permalink
retry nb runs
Browse files Browse the repository at this point in the history
  • Loading branch information
callmephilip committed Jan 3, 2025
1 parent 6040ab9 commit 4c5d319
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 13 deletions.
29 changes: 16 additions & 13 deletions bin/runnbs.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import "@std/dotenv/load";

import { retry } from "jsr:@std/async";
import { getConfig } from "jurassic/config.ts";
import path from "node:path";

Expand All @@ -8,18 +8,21 @@ if (import.meta.main) {
const results = await Promise.all(
config.notebooks.map((nb: string) => {
console.log(`Running ${nb}`);
const command = new Deno.Command("jupyter", {
args: [
"execute",
"--kernel_name=deno",
path.resolve(config.nbsPath, nb),
],
stdin: "piped",
stdout: "piped",
});
const child = command.spawn();
child.stdin.close();
return child.status;
const fn = () => {
const command = new Deno.Command("jupyter", {
args: [
"execute",
"--kernel_name=deno",
path.resolve(config.nbsPath, nb),
],
stdin: "piped",
stdout: "piped",
});
const child = command.spawn();
child.stdin.close();
return child.status;
};
return retry(fn, { maxAttempts: 3, minTimeout: 100 });
}),
);

Expand Down
1 change: 1 addition & 0 deletions deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
},
"imports": {
"@anthropic-ai/sdk": "npm:@anthropic-ai/sdk@^0.33.1",
"@std/async": "jsr:@std/async@^1.0.9",
"@std/dotenv": "jsr:@std/dotenv@^0.225.3",
"@std/fs": "jsr:@std/fs@^1.0.6",
"typescript": "npm:typescript@^5.7.2",
Expand Down
6 changes: 6 additions & 0 deletions deno.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 4c5d319

Please sign in to comment.