badgr-cli 1.0.16 → 1.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/HOW_IT_WORKS.md +4 -4
- package/package.json +1 -1
- package/src/commands/run.js +14 -2
- package/src/commands/serve.js +14 -2
- package/src/store.js +1 -1
package/HOW_IT_WORKS.md
CHANGED
|
@@ -11,7 +11,7 @@ npm install -g badgr-cli
|
|
|
11
11
|
badgr login
|
|
12
12
|
```
|
|
13
13
|
|
|
14
|
-
`badgr login` prompts for your API key and base URL, then writes them to `~/.
|
|
14
|
+
`badgr login` prompts for your API key and base URL, then writes them to `~/.badgr/config.json`. Every subsequent command reads that file — no env vars required.
|
|
15
15
|
|
|
16
16
|
---
|
|
17
17
|
|
|
@@ -142,7 +142,7 @@ badgr receipts [n] # default: last 10
|
|
|
142
142
|
|
|
143
143
|
Shows two sets of receipts:
|
|
144
144
|
|
|
145
|
-
1. **CLI action receipts** — every `badgr serve` / `badgr down` recorded locally in `~/.
|
|
145
|
+
1. **CLI action receipts** — every `badgr serve` / `badgr down` recorded locally in `~/.badgr/deployments.json`, with provider, retries, latency, and cost.
|
|
146
146
|
2. **Inference receipts** — per-request records fetched from `GET /v1/receipts` on the API (requires `badgr login`).
|
|
147
147
|
|
|
148
148
|
Every action — including failures — generates a receipt. Receipt IDs are printed on every command output so you can look them up later.
|
|
@@ -202,10 +202,10 @@ GPU type aliases are normalized automatically: `rtx-4090`, `rtx4090`, `4090`, `R
|
|
|
202
202
|
|
|
203
203
|
## Local State
|
|
204
204
|
|
|
205
|
-
All CLI state lives in `~/.
|
|
205
|
+
All CLI state lives in `~/.badgr/`:
|
|
206
206
|
|
|
207
207
|
```
|
|
208
|
-
~/.
|
|
208
|
+
~/.badgr/
|
|
209
209
|
config.json API key + base URL
|
|
210
210
|
deployments.json Active deployments + receipt log (last 200)
|
|
211
211
|
```
|
package/package.json
CHANGED
package/src/commands/run.js
CHANGED
|
@@ -308,7 +308,11 @@ export async function runCommand(config, args, chalk) {
|
|
|
308
308
|
} catch (err2) {
|
|
309
309
|
const d2 = err2.errorData;
|
|
310
310
|
if (d2?.code === 'PROVISIONING_FAILED' || d2?.code === 'PROVIDER_ADAPTER_ERROR') {
|
|
311
|
-
|
|
311
|
+
if (d2?.low_cost_provider_failed) {
|
|
312
|
+
console.error(chalk.red(`\n ✗ Low-cost provider failed. Primary provider also unavailable.\n`));
|
|
313
|
+
} else {
|
|
314
|
+
console.error(chalk.red(`\n ✗ Badgr found ${chosen.gpu} capacity but could not start the machine. Please try again.\n`));
|
|
315
|
+
}
|
|
312
316
|
if (process.env.BADGR_DEBUG === '1' || process.env.BADGR_DEBUG === 'true') {
|
|
313
317
|
if (d2?.debug_error) console.error(chalk.dim(` Provider detail: ${d2.debug_error}`));
|
|
314
318
|
}
|
|
@@ -321,7 +325,11 @@ export async function runCommand(config, args, chalk) {
|
|
|
321
325
|
process.exit(1);
|
|
322
326
|
}
|
|
323
327
|
} else if (d?.code === 'PROVISIONING_FAILED' || d?.code === 'PROVIDER_ADAPTER_ERROR') {
|
|
324
|
-
|
|
328
|
+
if (d?.low_cost_provider_failed) {
|
|
329
|
+
console.error(chalk.red(`\n ✗ Low-cost provider failed. Primary provider also unavailable.\n`));
|
|
330
|
+
} else {
|
|
331
|
+
console.error(chalk.red(`\n ✗ Badgr found ${gpu} capacity but could not start the machine. Please try again.\n`));
|
|
332
|
+
}
|
|
325
333
|
if (process.env.BADGR_DEBUG === '1' || process.env.BADGR_DEBUG === 'true') {
|
|
326
334
|
if (d?.debug_error) console.error(chalk.dim(` Provider detail: ${d.debug_error}`));
|
|
327
335
|
} else {
|
|
@@ -336,6 +344,10 @@ export async function runCommand(config, args, chalk) {
|
|
|
336
344
|
}
|
|
337
345
|
}
|
|
338
346
|
|
|
347
|
+
if (dep.provider_fallback_note === 'low_cost_provider_failed') {
|
|
348
|
+
console.log(chalk.yellow(' ℹ Low-cost provider failed. Using primary provider instead.\n'));
|
|
349
|
+
}
|
|
350
|
+
|
|
339
351
|
const rcptId = dep.receipt_id || generateReceiptId();
|
|
340
352
|
addReceipt({
|
|
341
353
|
receiptId: rcptId,
|
package/src/commands/serve.js
CHANGED
|
@@ -124,7 +124,11 @@ export async function serveCommand(config, args, chalk) {
|
|
|
124
124
|
} catch (err2) {
|
|
125
125
|
const d2 = err2.errorData;
|
|
126
126
|
if (d2?.code === 'PROVISIONING_FAILED' || d2?.code === 'PROVIDER_ADAPTER_ERROR') {
|
|
127
|
-
|
|
127
|
+
if (d2?.low_cost_provider_failed) {
|
|
128
|
+
console.error(chalk.red(`\n ✗ Low-cost provider failed. Primary provider also unavailable.\n`));
|
|
129
|
+
} else {
|
|
130
|
+
console.error(chalk.red(`\n ✗ Badgr found ${chosen.gpu} capacity but could not start the endpoint. Please try again.\n`));
|
|
131
|
+
}
|
|
128
132
|
} else {
|
|
129
133
|
console.error(chalk.red(`\n ✗ Failed to start endpoint on ${chosen.gpu}: ${err2.message}\n`));
|
|
130
134
|
}
|
|
@@ -132,7 +136,11 @@ export async function serveCommand(config, args, chalk) {
|
|
|
132
136
|
process.exit(1);
|
|
133
137
|
}
|
|
134
138
|
} else if (d?.code === 'PROVISIONING_FAILED' || d?.code === 'PROVIDER_ADAPTER_ERROR') {
|
|
135
|
-
|
|
139
|
+
if (d?.low_cost_provider_failed) {
|
|
140
|
+
console.error(chalk.red(`\n ✗ Low-cost provider failed. Primary provider also unavailable.\n`));
|
|
141
|
+
} else {
|
|
142
|
+
console.error(chalk.red(`\n ✗ Badgr found capacity but could not start the endpoint. Please try again.\n`));
|
|
143
|
+
}
|
|
136
144
|
console.error(chalk.dim(` Run BADGR_DEBUG=1 badgr serve … for a full trace.\n`));
|
|
137
145
|
process.exit(1);
|
|
138
146
|
} else {
|
|
@@ -153,6 +161,10 @@ export async function serveCommand(config, args, chalk) {
|
|
|
153
161
|
}
|
|
154
162
|
}
|
|
155
163
|
|
|
164
|
+
if (dep.provider_fallback_note === 'low_cost_provider_failed') {
|
|
165
|
+
console.log(chalk.yellow(' ℹ Low-cost provider failed. Using primary provider instead.\n'));
|
|
166
|
+
}
|
|
167
|
+
|
|
156
168
|
addDeployment({
|
|
157
169
|
id: dep.deployment_id,
|
|
158
170
|
name: dep.name,
|
package/src/store.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Local deployment state — persisted to ~/.
|
|
2
|
+
* Local deployment state — persisted to ~/.badgr/deployments.json.
|
|
3
3
|
*
|
|
4
4
|
* Tracks what `gpu up` has provisioned so `gpu down/status/logs/receipts`
|
|
5
5
|
* have something to work with before a backend deployments API exists.
|