Spaces:
Runtime error
Runtime error
Set Playwright timeout
Browse files- bench/README.md +14 -0
- bench/src/web/cli.ts +10 -0
bench/README.md
CHANGED
|
@@ -80,6 +80,20 @@ Then open http://localhost:5173 to use the interactive web interface.
|
|
| 80 |
| `--browser` | Browser type (web only) | `chromium` | `chromium`, `firefox`, `webkit` |
|
| 81 |
| `--headed` | Run browser in headed mode | `false` | `true`, `false` |
|
| 82 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 83 |
## Architecture
|
| 84 |
|
| 85 |
```
|
|
|
|
| 80 |
| `--browser` | Browser type (web only) | `chromium` | `chromium`, `firefox`, `webkit` |
|
| 81 |
| `--headed` | Run browser in headed mode | `false` | `true`, `false` |
|
| 82 |
|
| 83 |
+
## Environment Variables
|
| 84 |
+
|
| 85 |
+
| Variable | Description | Default | Example |
|
| 86 |
+
|----------|-------------|---------|---------|
|
| 87 |
+
| `PLAYWRIGHT_TIMEOUT` | Playwright page timeout (ms) | `300000` (5 min) | `1800000` (30 min) |
|
| 88 |
+
| `NAVIGATION_TIMEOUT` | Page navigation timeout (ms) | `60000` (1 min) | `120000` (2 min) |
|
| 89 |
+
|
| 90 |
+
**Note**: The default Playwright timeout is set to 5 minutes. For large models that require longer download times, you can increase this with environment variables:
|
| 91 |
+
|
| 92 |
+
```bash
|
| 93 |
+
# Set custom timeouts (in milliseconds)
|
| 94 |
+
PLAYWRIGHT_TIMEOUT=3600000 NAVIGATION_TIMEOUT=120000 npm run bench:web -- <model> <task>
|
| 95 |
+
```
|
| 96 |
+
|
| 97 |
## Architecture
|
| 98 |
|
| 99 |
```
|
bench/src/web/cli.ts
CHANGED
|
@@ -29,6 +29,10 @@ const batchSize = Math.max(1, parseInt(getArg("batch-size", "1") || "1", 10));
|
|
| 29 |
const browserType = getArg("browser", "chromium") as "chromium" | "firefox" | "webkit";
|
| 30 |
const headed = getArg("headed") === "true";
|
| 31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
async function main() {
|
| 33 |
console.log(`Model : ${modelId}`);
|
| 34 |
console.log(`Task : ${task}`);
|
|
@@ -39,6 +43,7 @@ async function main() {
|
|
| 39 |
console.log(`Batch Size : ${batchSize}`);
|
| 40 |
console.log(`Browser : ${browserType}`);
|
| 41 |
console.log(`Headed : ${headed}`);
|
|
|
|
| 42 |
|
| 43 |
// Start Vite dev server
|
| 44 |
const server = await createServer({
|
|
@@ -107,6 +112,11 @@ async function main() {
|
|
| 107 |
const context = await browser.newContext();
|
| 108 |
const page = await context.newPage();
|
| 109 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 110 |
// Expose console logs
|
| 111 |
page.on("console", (msg) => {
|
| 112 |
const type = msg.type();
|
|
|
|
| 29 |
const browserType = getArg("browser", "chromium") as "chromium" | "firefox" | "webkit";
|
| 30 |
const headed = getArg("headed") === "true";
|
| 31 |
|
| 32 |
+
// Timeout configuration (in milliseconds)
|
| 33 |
+
const PLAYWRIGHT_TIMEOUT = parseInt(process.env.PLAYWRIGHT_TIMEOUT || String(5 * 60 * 1000), 10); // Default: 5 minutes
|
| 34 |
+
const NAVIGATION_TIMEOUT = parseInt(process.env.NAVIGATION_TIMEOUT || String(60 * 1000), 10); // Default: 1 minute
|
| 35 |
+
|
| 36 |
async function main() {
|
| 37 |
console.log(`Model : ${modelId}`);
|
| 38 |
console.log(`Task : ${task}`);
|
|
|
|
| 43 |
console.log(`Batch Size : ${batchSize}`);
|
| 44 |
console.log(`Browser : ${browserType}`);
|
| 45 |
console.log(`Headed : ${headed}`);
|
| 46 |
+
console.log(`Timeout : ${PLAYWRIGHT_TIMEOUT / 1000}s (navigation: ${NAVIGATION_TIMEOUT / 1000}s)`);
|
| 47 |
|
| 48 |
// Start Vite dev server
|
| 49 |
const server = await createServer({
|
|
|
|
| 112 |
const context = await browser.newContext();
|
| 113 |
const page = await context.newPage();
|
| 114 |
|
| 115 |
+
// Set page timeouts for long-running benchmarks and large model downloads
|
| 116 |
+
// Can be configured via PLAYWRIGHT_TIMEOUT and NAVIGATION_TIMEOUT env vars
|
| 117 |
+
page.setDefaultTimeout(PLAYWRIGHT_TIMEOUT);
|
| 118 |
+
page.setDefaultNavigationTimeout(NAVIGATION_TIMEOUT);
|
| 119 |
+
|
| 120 |
// Expose console logs
|
| 121 |
page.on("console", (msg) => {
|
| 122 |
const type = msg.type();
|