trainfabric 0.1.16 → 0.1.18
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/dist/index.cjs +31 -12
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -8113,8 +8113,16 @@ var BillingClient = class extends ResourceClient {
|
|
|
8113
8113
|
getSummary() {
|
|
8114
8114
|
return this.requestGet("/v1/billing/summary");
|
|
8115
8115
|
}
|
|
8116
|
-
getUsage(unit) {
|
|
8117
|
-
|
|
8116
|
+
getUsage(unit, runId) {
|
|
8117
|
+
const params = new URLSearchParams();
|
|
8118
|
+
if (unit) {
|
|
8119
|
+
params.set("unit", unit);
|
|
8120
|
+
}
|
|
8121
|
+
if (runId) {
|
|
8122
|
+
params.set("runId", runId);
|
|
8123
|
+
}
|
|
8124
|
+
const query = params.toString();
|
|
8125
|
+
return this.requestGet(`/v1/billing/usage${query ? `?${query}` : ""}`);
|
|
8118
8126
|
}
|
|
8119
8127
|
listInvoices() {
|
|
8120
8128
|
return this.requestGet("/v1/billing/invoices");
|
|
@@ -8214,6 +8222,9 @@ var DeploymentsClient = class extends ResourceClient {
|
|
|
8214
8222
|
get(id) {
|
|
8215
8223
|
return this.requestGet(`/v1/deployments/${id}`);
|
|
8216
8224
|
}
|
|
8225
|
+
delete(id) {
|
|
8226
|
+
return this.requestDelete(`/v1/deployments/${id}`);
|
|
8227
|
+
}
|
|
8217
8228
|
};
|
|
8218
8229
|
|
|
8219
8230
|
// ../sdk/dist/client/models.js
|
|
@@ -8379,6 +8390,9 @@ var RunHandle = class {
|
|
|
8379
8390
|
this.client = client;
|
|
8380
8391
|
this.snapshot = snapshot;
|
|
8381
8392
|
}
|
|
8393
|
+
isTerminal() {
|
|
8394
|
+
return ["completed", "failed", "canceled", "terminated"].includes(this.snapshot.status);
|
|
8395
|
+
}
|
|
8382
8396
|
on(event, listener) {
|
|
8383
8397
|
if (!this.listeners.has(event)) {
|
|
8384
8398
|
this.listeners.set(event, /* @__PURE__ */ new Set());
|
|
@@ -8422,7 +8436,7 @@ var RunHandle = class {
|
|
|
8422
8436
|
this.abortController.abort();
|
|
8423
8437
|
}
|
|
8424
8438
|
ensureStreaming() {
|
|
8425
|
-
if (this.streaming || !this.shouldStream) {
|
|
8439
|
+
if (this.streaming || !this.shouldStream || this.isTerminal()) {
|
|
8426
8440
|
return;
|
|
8427
8441
|
}
|
|
8428
8442
|
this.streaming = true;
|
|
@@ -8458,7 +8472,7 @@ var RunHandle = class {
|
|
|
8458
8472
|
}
|
|
8459
8473
|
await new Promise((resolve) => setTimeout(resolve, 1e3));
|
|
8460
8474
|
}
|
|
8461
|
-
if (
|
|
8475
|
+
if (this.isTerminal()) {
|
|
8462
8476
|
break;
|
|
8463
8477
|
}
|
|
8464
8478
|
}
|
|
@@ -8927,7 +8941,7 @@ function buildComputeSpec(options) {
|
|
|
8927
8941
|
|
|
8928
8942
|
// src/index.ts
|
|
8929
8943
|
var DEFAULT_TRAINFABRIC_API_URL2 = "https://api.trainfabric.com";
|
|
8930
|
-
var CLI_VERSION = "0.1.
|
|
8944
|
+
var CLI_VERSION = "0.1.18";
|
|
8931
8945
|
var CONFIG_DIR = import_node_path3.default.join(import_node_os2.default.homedir(), ".trainfabric");
|
|
8932
8946
|
var CONFIG_PATH = import_node_path3.default.join(CONFIG_DIR, "config.json");
|
|
8933
8947
|
var FALLBACK_SECRET_PATH = import_node_path3.default.join(CONFIG_DIR, "session.enc");
|
|
@@ -9345,16 +9359,17 @@ async function watchRun(runId, json = false, timeoutMs, pollMs) {
|
|
|
9345
9359
|
});
|
|
9346
9360
|
handle.on("metric", (event) => {
|
|
9347
9361
|
const payload = event.payload;
|
|
9348
|
-
|
|
9349
|
-
|
|
9350
|
-
);
|
|
9362
|
+
const evalLoss = payload.evalLoss === void 0 ? "" : ` evalLoss=${payload.evalLoss}`;
|
|
9363
|
+
console.log(`[metric] step=${payload.step ?? "?"} loss=${payload.loss ?? "?"}${evalLoss}`);
|
|
9351
9364
|
});
|
|
9352
9365
|
handle.on("checkpoint", (event) => {
|
|
9353
9366
|
const payload = event.payload;
|
|
9354
9367
|
console.log(`[checkpoint] count=${payload.checkpointCount ?? "?"} path=${payload.checkpointPath ?? ""}`);
|
|
9355
9368
|
});
|
|
9356
|
-
handle.on("completed", () => {
|
|
9357
|
-
|
|
9369
|
+
handle.on("completed", (event) => {
|
|
9370
|
+
const payload = event.payload;
|
|
9371
|
+
const metrics = payload.metrics ? ` finalLoss=${payload.metrics.finalLoss ?? "?"} evalLoss=${payload.metrics.evalLoss ?? "?"}` : "";
|
|
9372
|
+
console.log(`[completed]${metrics}`);
|
|
9358
9373
|
});
|
|
9359
9374
|
handle.on("failed", (event) => {
|
|
9360
9375
|
const payload = event.payload;
|
|
@@ -9624,11 +9639,15 @@ program2.command("deployments:create").requiredOption("--model <modelId>").optio
|
|
|
9624
9639
|
program2.command("deployments:get").argument("<deploymentId>").description("Fetch a deployment").action(async (deploymentId) => {
|
|
9625
9640
|
printJson(await createClient(loadConfig()).deployments.get(String(deploymentId)));
|
|
9626
9641
|
});
|
|
9642
|
+
program2.command("deployments:delete").argument("<deploymentId>").description("Delete a pending or cataloged deployment").action(async (deploymentId) => {
|
|
9643
|
+
await createClient(loadConfig()).deployments.delete(String(deploymentId));
|
|
9644
|
+
printJson({ deleted: true, id: String(deploymentId) });
|
|
9645
|
+
});
|
|
9627
9646
|
program2.command("billing:summary").description("Fetch billing summary").action(async () => {
|
|
9628
9647
|
printJson(await createClient(loadConfig()).billing.getSummary());
|
|
9629
9648
|
});
|
|
9630
|
-
program2.command("billing:usage").option("--unit <unit>", "normalized_tflop_seconds, reserved_gpu_seconds, or usd").description("List billing usage records").action(async (options) => {
|
|
9631
|
-
printJson(await createClient(loadConfig()).billing.getUsage(options.unit));
|
|
9649
|
+
program2.command("billing:usage").option("--unit <unit>", "normalized_tflop_seconds, reserved_gpu_seconds, or usd").option("--run <runId>", "filter usage records to one run").description("List billing usage records").action(async (options) => {
|
|
9650
|
+
printJson(await createClient(loadConfig()).billing.getUsage(options.unit, options.run));
|
|
9632
9651
|
});
|
|
9633
9652
|
program2.command("billing:invoices").description("List invoices").action(async () => {
|
|
9634
9653
|
printJson(await createClient(loadConfig()).billing.listInvoices());
|