badgr-cli 1.0.34 → 1.0.35
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/package.json +1 -1
- package/src/api.js +2 -2
- package/src/fallback.js +5 -6
- package/tests/serve-lifecycle.test.js +1 -1
package/package.json
CHANGED
package/src/api.js
CHANGED
|
@@ -105,7 +105,7 @@ export function runJob(config, body) {
|
|
|
105
105
|
apiKey: config.apiKey,
|
|
106
106
|
baseUrl: config.baseUrl,
|
|
107
107
|
body,
|
|
108
|
-
timeoutMs:
|
|
108
|
+
timeoutMs: 130_000,
|
|
109
109
|
});
|
|
110
110
|
}
|
|
111
111
|
|
|
@@ -115,7 +115,7 @@ export function serveModel(config, body) {
|
|
|
115
115
|
apiKey: config.apiKey,
|
|
116
116
|
baseUrl: config.baseUrl,
|
|
117
117
|
body,
|
|
118
|
-
timeoutMs:
|
|
118
|
+
timeoutMs: 130_000,
|
|
119
119
|
});
|
|
120
120
|
}
|
|
121
121
|
|
package/src/fallback.js
CHANGED
|
@@ -24,7 +24,7 @@ export class CapacityError extends Error {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
|
-
* Call an API endpoint with automatic tier-2 expansion
|
|
27
|
+
* Call an API endpoint with automatic tier-2 expansion when tier-1 fails.
|
|
28
28
|
* Returns the deployment object on success.
|
|
29
29
|
* Throws CapacityError (pre-formatted for display) on unrecoverable failure.
|
|
30
30
|
* Re-throws payment errors (err.isPaymentRequired) for callers to handle.
|
|
@@ -44,10 +44,9 @@ export async function callWithFallback(endpoint, callOpts, buildBody, effectiveT
|
|
|
44
44
|
const cmd = labels?.cmd ?? 'badgr run';
|
|
45
45
|
const allowTier2Fallback = opts.allowTier2Fallback !== false; // default true
|
|
46
46
|
|
|
47
|
-
//
|
|
48
|
-
// the extra headroom ensures the CLI always sees the real response.
|
|
47
|
+
// 130s: backend provisioning runs up to BADGR_PROVISION_TIMEOUT_SECONDS (default 120s).
|
|
49
48
|
async function attempt(body) {
|
|
50
|
-
return callApi(endpoint, { method: 'POST', ...callOpts, body, timeoutMs:
|
|
49
|
+
return callApi(endpoint, { method: 'POST', ...callOpts, body, timeoutMs: 130_000 });
|
|
51
50
|
}
|
|
52
51
|
|
|
53
52
|
// Map server error codes → catalog keys and extract context for templates.
|
|
@@ -118,8 +117,8 @@ export async function callWithFallback(endpoint, callOpts, buildBody, effectiveT
|
|
|
118
117
|
}
|
|
119
118
|
}
|
|
120
119
|
|
|
121
|
-
// Tier-2 expansion: try budget-tier providers
|
|
122
|
-
if (
|
|
120
|
+
// Tier-2 expansion: try budget-tier providers whenever tier-1 fails
|
|
121
|
+
if (effectiveTier !== '2' && allowTier2Fallback) {
|
|
123
122
|
console.log(chalk.dim('\n Primary capacity unavailable — expanding search...\n'));
|
|
124
123
|
try {
|
|
125
124
|
return await attempt(buildBody('2'));
|
|
@@ -270,7 +270,7 @@ describe('invalid model ID or no capacity', () => {
|
|
|
270
270
|
errorData: { code: 'PROVISIONING_FAILED', debug_error: 'HF_TOKEN missing, repo is private' },
|
|
271
271
|
httpStatus: 503,
|
|
272
272
|
});
|
|
273
|
-
// tier-1 provisioning fails; tier-2
|
|
273
|
+
// tier-1 provisioning fails; tier-2 is also tried and fails
|
|
274
274
|
api.callApi.mockRejectedValue(provErr);
|
|
275
275
|
|
|
276
276
|
const errLines = [];
|