@madewithremy/admin 0.1.65 → 0.1.67
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/CHANGELOG.md +16 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +2 -2
- package/dist/ops/infra.d.ts +14 -10
- package/dist/prod.js +21 -26
- package/dist/types/infra.d.ts +20 -14
- package/package.json +1 -1
package/dist/ops/infra.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Provisioned-infrastructure operations: lease,
|
|
2
|
+
* Provisioned-infrastructure operations: lease, hibernate, resume and delete
|
|
3
3
|
* dedicated resources (retrieval capacity for data sources, and database
|
|
4
|
-
* servers for databases past the shared
|
|
4
|
+
* servers for databases past the shared servers' limit).
|
|
5
5
|
*
|
|
6
6
|
* Ops are pure (ctx, params) → typed result. The CLI skin in
|
|
7
7
|
* commands/infra.ts owns flag parsing, progress printing and exit codes.
|
|
@@ -83,9 +83,9 @@ export interface ResourceIdParams {
|
|
|
83
83
|
id: string;
|
|
84
84
|
}
|
|
85
85
|
/**
|
|
86
|
-
*
|
|
87
|
-
* Retrieval: searches on its data sources return
|
|
88
|
-
*
|
|
86
|
+
* Hibernate an active resource. Data is kept and billing stops until it
|
|
87
|
+
* resumes. Retrieval: searches on its data sources return
|
|
88
|
+
* `capacity_hibernating` on the way and `capacity_hibernated` once there. A database server: every
|
|
89
89
|
* database is backed up first, and its queries answer `database_lease_parked`
|
|
90
90
|
* until it resumes.
|
|
91
91
|
*
|
|
@@ -103,7 +103,7 @@ export declare function resume(ctx: AdminContext, params: ResourceIdParams): Pro
|
|
|
103
103
|
* Retrieval: refused while any data source is placed on it; move those to
|
|
104
104
|
* shared capacity (`admin.dataSources.move({ placement: 'shared' })`, data
|
|
105
105
|
* intact) or delete them first. A database server: its databases go back to
|
|
106
|
-
* the shared
|
|
106
|
+
* the shared servers, so it's refused while any is too large for them to
|
|
107
107
|
* take back.
|
|
108
108
|
*
|
|
109
109
|
* @throws AdminApiError `resource_not_found` (404),
|
|
@@ -118,9 +118,9 @@ export interface ResizeParams {
|
|
|
118
118
|
}
|
|
119
119
|
/**
|
|
120
120
|
* Change a resource's size, keeping its data. Either kind passes through
|
|
121
|
-
* `hibernated`: the platform
|
|
122
|
-
* back up. A resource that is already hibernated swaps in place and
|
|
123
|
-
*
|
|
121
|
+
* `hibernated`: the platform hibernates the resource, swaps its spec and
|
|
122
|
+
* brings it back up. A resource that is already hibernated swaps in place and
|
|
123
|
+
* stays hibernated. Growing is gated on a month of credits at the new rate like a
|
|
124
124
|
* provision; shrinking is refused below what the resource holds. The response
|
|
125
125
|
* carries `resizingTo` until the swap has happened; `waitForPhase` with
|
|
126
126
|
* `until: (r) => r.resizingTo === null` blocks on the whole thing.
|
|
@@ -172,7 +172,11 @@ export type WaitForPhaseResult = {
|
|
|
172
172
|
};
|
|
173
173
|
/**
|
|
174
174
|
* Poll a resource until it reaches one of `phases`, fails, or the timeout
|
|
175
|
-
* elapses. A
|
|
175
|
+
* elapses. A failure the platform is still retrying is waited through
|
|
176
|
+
* (`retrying`): a resume or hibernate asked of a failed resource reads
|
|
177
|
+
* `failed` until the platform takes its first step, and a transition that
|
|
178
|
+
* timed out once is tried again. One it has given up on returns with the
|
|
179
|
+
* platform's error.
|
|
176
180
|
*
|
|
177
181
|
* @example
|
|
178
182
|
* const result = await admin.infra.waitForPhase({ id, phases: ['active'] });
|
package/dist/prod.js
CHANGED
|
@@ -1345,7 +1345,8 @@ async function releasesWait(ctx, a) {
|
|
|
1345
1345
|
);
|
|
1346
1346
|
}
|
|
1347
1347
|
const commit = expandCommitSha(rawCommit);
|
|
1348
|
-
const
|
|
1348
|
+
const timeoutSeconds = a.num("timeout");
|
|
1349
|
+
const timeoutMs = timeoutSeconds === void 0 ? void 0 : timeoutSeconds * 1e3;
|
|
1349
1350
|
const result = await waitForCommit(ctx, {
|
|
1350
1351
|
commitSha: commit,
|
|
1351
1352
|
timeoutMs,
|
|
@@ -8473,7 +8474,6 @@ async function jewelsDryrun(ctx, a) {
|
|
|
8473
8474
|
);
|
|
8474
8475
|
}
|
|
8475
8476
|
var TRAIN_POLL_MS = 15e3;
|
|
8476
|
-
var TRAIN_WAIT_LIMIT_MS = 45 * 6e4;
|
|
8477
8477
|
async function jewelsTrain(ctx, a) {
|
|
8478
8478
|
const started = await train(ctx, { methodId: a.required("methodId") });
|
|
8479
8479
|
if (!a.bool("wait")) {
|
|
@@ -8482,9 +8482,8 @@ async function jewelsTrain(ctx, a) {
|
|
|
8482
8482
|
}
|
|
8483
8483
|
printJson({ runId: started.run?.id, summary: started.summary });
|
|
8484
8484
|
const runId = started.run?.id;
|
|
8485
|
-
const deadline = Date.now() + TRAIN_WAIT_LIMIT_MS;
|
|
8486
8485
|
let lastLogLen = 0;
|
|
8487
|
-
while (
|
|
8486
|
+
while (true) {
|
|
8488
8487
|
await sleep(TRAIN_POLL_MS);
|
|
8489
8488
|
const { run: run3 } = await getRun2(ctx, runId);
|
|
8490
8489
|
const log = Array.isArray(run3.log) ? run3.log : [];
|
|
@@ -8513,9 +8512,6 @@ async function jewelsTrain(ctx, a) {
|
|
|
8513
8512
|
return;
|
|
8514
8513
|
}
|
|
8515
8514
|
}
|
|
8516
|
-
fatal(
|
|
8517
|
-
`Timed out waiting for run ${runId} (still in flight; check 'jewels run ${runId}').`
|
|
8518
|
-
);
|
|
8519
8515
|
}
|
|
8520
8516
|
function compactRunLog(run3) {
|
|
8521
8517
|
let out = { ...run3 };
|
|
@@ -9608,7 +9604,7 @@ async function waitForPhase(ctx, params) {
|
|
|
9608
9604
|
const arrived = (resource2) => wanted.has(resource2.phase) && (params.until?.(resource2) ?? true);
|
|
9609
9605
|
const outcome = await pollUntil(
|
|
9610
9606
|
async () => (await get11(ctx, { id: params.id })).resource,
|
|
9611
|
-
(resource2) => arrived(resource2) || resource2.phase === "failed",
|
|
9607
|
+
(resource2) => arrived(resource2) || resource2.phase === "failed" && !resource2.retrying,
|
|
9612
9608
|
{
|
|
9613
9609
|
timeoutMs,
|
|
9614
9610
|
pollMs: POLL_MS5,
|
|
@@ -9760,8 +9756,7 @@ function pricingOf(resource) {
|
|
|
9760
9756
|
return {
|
|
9761
9757
|
offering: offering.id,
|
|
9762
9758
|
activeMonthlyDollars: offering.monthlyPriceDollars,
|
|
9763
|
-
|
|
9764
|
-
note: "Bills hourly from activation. A month's credits were verified before the lease was accepted."
|
|
9759
|
+
note: "Bills hourly while active, and nothing while hibernated. A month's credits were verified before the lease was accepted."
|
|
9765
9760
|
};
|
|
9766
9761
|
}
|
|
9767
9762
|
async function infraProvision(ctx, a) {
|
|
@@ -9822,10 +9817,8 @@ async function infraRename(ctx, a) {
|
|
|
9822
9817
|
}
|
|
9823
9818
|
async function infraResize(ctx, a) {
|
|
9824
9819
|
const id = a.required("id");
|
|
9825
|
-
const
|
|
9826
|
-
|
|
9827
|
-
offeringId: a.str("offering")
|
|
9828
|
-
});
|
|
9820
|
+
const offeringId = a.str("offering");
|
|
9821
|
+
const { resource } = await resize(ctx, { id, offeringId });
|
|
9829
9822
|
const pricing = pricingOf({
|
|
9830
9823
|
...resource,
|
|
9831
9824
|
offering: resource.resizingTo ?? resource.offering
|
|
@@ -9834,7 +9827,7 @@ async function infraResize(ctx, a) {
|
|
|
9834
9827
|
printJson({
|
|
9835
9828
|
resource,
|
|
9836
9829
|
pricing,
|
|
9837
|
-
note: `Resizing; ${resource.kind === "database" ? "the app's queries pause" : "searches on its sources pause"} while it is
|
|
9830
|
+
note: `Resizing; ${resource.kind === "database" ? "the app's queries pause" : "searches on its sources pause"} while it is hibernated and restored. Poll \`infra get <id>\` or re-run with --wait.`
|
|
9838
9831
|
});
|
|
9839
9832
|
return;
|
|
9840
9833
|
}
|
|
@@ -9844,7 +9837,9 @@ async function infraResize(ctx, a) {
|
|
|
9844
9837
|
id,
|
|
9845
9838
|
[resource.phase],
|
|
9846
9839
|
{ action: "resize", pricing },
|
|
9847
|
-
|
|
9840
|
+
// On the size asked for, not only settled: a resize the platform gave up
|
|
9841
|
+
// on also clears, back at the old size.
|
|
9842
|
+
(r) => r.resizingTo === null && r.offeringId === offeringId
|
|
9848
9843
|
);
|
|
9849
9844
|
}
|
|
9850
9845
|
var infraHandlers = {
|
|
@@ -9860,9 +9855,9 @@ var infraHandlers = {
|
|
|
9860
9855
|
};
|
|
9861
9856
|
var infraHelp = `remy-admin infra \u2014 Dedicated infrastructure your app leases from the platform.
|
|
9862
9857
|
|
|
9863
|
-
Two kinds, each
|
|
9864
|
-
|
|
9865
|
-
|
|
9858
|
+
Two kinds, each the app's own: \`retrieval\`, vector-store capacity for its
|
|
9859
|
+
data sources in place of the shared pool, and \`database\`, a database server
|
|
9860
|
+
for databases past the shared servers' limit. Sizes and prices come
|
|
9866
9861
|
from the platform catalog (\`infra list\` prints them, by kind); nothing is
|
|
9867
9862
|
priced client-side.
|
|
9868
9863
|
|
|
@@ -9880,11 +9875,11 @@ Subcommands:
|
|
|
9880
9875
|
logs The platform's log for a resource (--follow to keep reading)
|
|
9881
9876
|
provision Lease a new resource (needs a month's credits; prints the price;
|
|
9882
9877
|
one database server an app)
|
|
9883
|
-
hibernate
|
|
9878
|
+
hibernate Hibernate it: data kept, its searches or queries paused, the charge stops
|
|
9884
9879
|
resume Bring a hibernated resource back (needs a month's credits)
|
|
9885
9880
|
resize Change its size, data intact (passes through hibernated)
|
|
9886
9881
|
destroy Delete it (retrieval: refused while data sources are placed on it;
|
|
9887
|
-
database: while a database is too large for the shared
|
|
9882
|
+
database: while a database is too large for the shared servers)
|
|
9888
9883
|
rename Change the display name
|
|
9889
9884
|
|
|
9890
9885
|
Usage:
|
|
@@ -9911,7 +9906,7 @@ Placing a data source on a resource:
|
|
|
9911
9906
|
leaves a resource you mean to destroy. See \`datasources --help\`.
|
|
9912
9907
|
|
|
9913
9908
|
Searches on a source whose resource is not active fail with
|
|
9914
|
-
capacity_<phase>: capacity_hibernated once
|
|
9909
|
+
capacity_<phase>: capacity_hibernated once hibernated, capacity_hibernating /
|
|
9915
9910
|
capacity_resuming while it moves. Once active, a source whose index is being
|
|
9916
9911
|
rebuilt from durable storage (after a resume, a resize or a lost node)
|
|
9917
9912
|
answers index_warming with the rebuild's progress and ETA until it lands;
|
|
@@ -9919,11 +9914,11 @@ Placing a data source on a resource:
|
|
|
9919
9914
|
progress. The messages are written for the app's end user; the stable code
|
|
9920
9915
|
is what to act on.
|
|
9921
9916
|
|
|
9922
|
-
|
|
9917
|
+
Database servers:
|
|
9923
9918
|
A database server takes the app's live databases as it first becomes active,
|
|
9924
|
-
each one let go by the shared
|
|
9925
|
-
size's own limit (\`maxDatabaseGiB\` on the offering) in place of
|
|
9926
|
-
|
|
9919
|
+
each one let go by the shared servers and served there from then on, under
|
|
9920
|
+
the size's own limit (\`maxDatabaseGiB\` on the offering, in GB) in place of
|
|
9921
|
+
the shared servers'. A release the app deploys keeps its databases there. Nothing in the
|
|
9927
9922
|
app changes: the same queries, routed to it by the platform. An app has one:
|
|
9928
9923
|
a second is refused with database_server_exists (422); resize the one it has.
|
|
9929
9924
|
|
package/dist/types/infra.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ export type InfraHealth = 'ready' | 'not-ready' | 'missing' | 'rebuilding'
|
|
|
23
23
|
/**
|
|
24
24
|
* What a resource is: `retrieval`, vector-store capacity of the app's own for
|
|
25
25
|
* its data sources, or `database`, a database server of the app's own for
|
|
26
|
-
* databases past the shared
|
|
26
|
+
* databases past the shared servers' limit.
|
|
27
27
|
*/
|
|
28
28
|
export type InfraKind = 'retrieval' | 'database';
|
|
29
29
|
/** What a retrieval size holds. */
|
|
@@ -53,20 +53,15 @@ export interface InfraOffering {
|
|
|
53
53
|
/** User-facing capacity, e.g. "Up to ~34M chunks at 2560 dimensions (~48M at 1024, ~26M at 4096)". */
|
|
54
54
|
description: string;
|
|
55
55
|
hourlyPriceDollars: number;
|
|
56
|
-
/** Hourly × 730. */
|
|
57
|
-
monthlyPriceDollars: number;
|
|
58
56
|
/**
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
57
|
+
* Hourly × 730. Only an active resource bills: hibernated, it holds nothing
|
|
58
|
+
* and costs nothing. A retrieval resource's sources' documents stay in the
|
|
59
|
+
* platform's own store, and a database server's databases are backed up
|
|
60
|
+
* there as it hibernates.
|
|
62
61
|
*/
|
|
63
|
-
|
|
64
|
-
hibernatedMonthlyPriceDollars: number;
|
|
62
|
+
monthlyPriceDollars: number;
|
|
65
63
|
/** What the size holds, by kind. */
|
|
66
64
|
capacity: InfraRetrievalCapacity | InfraDatabaseCapacity;
|
|
67
|
-
capabilities: {
|
|
68
|
-
hibernate: boolean;
|
|
69
|
-
};
|
|
70
65
|
retired: boolean;
|
|
71
66
|
}
|
|
72
67
|
export interface InfraResource {
|
|
@@ -81,6 +76,13 @@ export interface InfraResource {
|
|
|
81
76
|
/** Data sources placed on this resource (retrieval). Destroy is refused while > 0. */
|
|
82
77
|
attachedSources: number;
|
|
83
78
|
lastError: string | null;
|
|
79
|
+
/** A failed resource: the phase it failed in. Null otherwise. */
|
|
80
|
+
failedIn: InfraPhase | null;
|
|
81
|
+
/**
|
|
82
|
+
* A failed resource: whether the platform is still retrying it. False once
|
|
83
|
+
* it waits to be resumed, hibernated or destroyed.
|
|
84
|
+
*/
|
|
85
|
+
retrying: boolean;
|
|
84
86
|
/** Null until the instance exists (requested, hibernated, destroyed). */
|
|
85
87
|
health: InfraHealth | null;
|
|
86
88
|
/**
|
|
@@ -142,11 +144,10 @@ export interface InfraResource {
|
|
|
142
144
|
resizingTo: InfraOffering | null;
|
|
143
145
|
/**
|
|
144
146
|
* What this resource has actually been charged, from the ledger's own
|
|
145
|
-
* writes, with the hours
|
|
147
|
+
* writes, with the hours it was active for. Its rate is on `offering`.
|
|
146
148
|
*/
|
|
147
149
|
billing: {
|
|
148
150
|
activeHours: number;
|
|
149
|
-
hibernatedHours: number;
|
|
150
151
|
billedDollars: number;
|
|
151
152
|
lastBilledAt: string | null;
|
|
152
153
|
};
|
|
@@ -157,7 +158,12 @@ export interface InfraResource {
|
|
|
157
158
|
createdAt: string;
|
|
158
159
|
updatedAt: string;
|
|
159
160
|
}
|
|
160
|
-
/**
|
|
161
|
+
/**
|
|
162
|
+
* One of a database server's databases, as its pod last reported it. Every
|
|
163
|
+
* database on the server is listed; one the server hasn't opened yet (it
|
|
164
|
+
* downloads on its first query after a provision or a resume) has null sizes
|
|
165
|
+
* and no backup time.
|
|
166
|
+
*/
|
|
161
167
|
export interface InfraLeasedDatabase {
|
|
162
168
|
databaseId: string;
|
|
163
169
|
name: string;
|