@pd4castr/cli 0.0.9 → 0.0.11
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.js +39 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -643,6 +643,13 @@ async function getRegistryPushCredentials(modelID, authCtx) {
|
|
|
643
643
|
return result;
|
|
644
644
|
}
|
|
645
645
|
|
|
646
|
+
// src/api/trigger-model-run.ts
|
|
647
|
+
async function triggerModelRun(modelId, authCtx) {
|
|
648
|
+
const headers = { Authorization: `Bearer ${authCtx.accessToken}` };
|
|
649
|
+
const result = await api.post(`model/${modelId}/trigger`, { headers }).json();
|
|
650
|
+
return result;
|
|
651
|
+
}
|
|
652
|
+
|
|
646
653
|
// src/config/update-project-config.ts
|
|
647
654
|
import fs7 from "fs/promises";
|
|
648
655
|
import path8 from "path";
|
|
@@ -999,8 +1006,17 @@ async function handleCreateModelFlow(options, app, spinner, ctx, authCtx) {
|
|
|
999
1006
|
const pushCredentials = await getRegistryPushCredentials(model.id, authCtx);
|
|
1000
1007
|
await loginToDockerRegistry(pushCredentials);
|
|
1001
1008
|
await buildDockerImage(dockerImage, ctx);
|
|
1002
|
-
await pushDockerImage(dockerImage,
|
|
1003
|
-
spinner.succeed("Model image pushed to
|
|
1009
|
+
await pushDockerImage(dockerImage, model.dockerImage);
|
|
1010
|
+
spinner.succeed("Model image pushed to reogistry successfully");
|
|
1011
|
+
spinner.start("Triggering model run...");
|
|
1012
|
+
try {
|
|
1013
|
+
await triggerModelRun(model.id, authCtx);
|
|
1014
|
+
spinner.succeed("Model run triggered successfully");
|
|
1015
|
+
} catch {
|
|
1016
|
+
spinner.warn(`Failed to trigger model run
|
|
1017
|
+
If you use static inputs, make sure you have uploaded it to your input bucket
|
|
1018
|
+
If you use inputs with data fetchers, your model will run when they have fetched new data`);
|
|
1019
|
+
}
|
|
1004
1020
|
spinner.stopAndPersist({
|
|
1005
1021
|
symbol: "\u{1F680} ",
|
|
1006
1022
|
prefixText: "\n",
|
|
@@ -1083,8 +1099,17 @@ async function handleModelRevisionCreateFlow(options, app, spinner, ctx, authCtx
|
|
|
1083
1099
|
const pushCredentials = await getRegistryPushCredentials(model.id, authCtx);
|
|
1084
1100
|
await loginToDockerRegistry(pushCredentials);
|
|
1085
1101
|
await buildDockerImage(dockerImage, ctx);
|
|
1086
|
-
await pushDockerImage(dockerImage,
|
|
1102
|
+
await pushDockerImage(dockerImage, model.dockerImage);
|
|
1087
1103
|
spinner.succeed("New model revision image pushed to registry successfully");
|
|
1104
|
+
spinner.start("Triggering model run...");
|
|
1105
|
+
try {
|
|
1106
|
+
await triggerModelRun(model.id, authCtx);
|
|
1107
|
+
spinner.succeed("Model run triggered successfully");
|
|
1108
|
+
} catch {
|
|
1109
|
+
spinner.warn(`Failed to trigger model run
|
|
1110
|
+
If you use static inputs, make sure you have uploaded it to your input bucket
|
|
1111
|
+
If you use inputs with data fetchers, your model will run when they have fetched new data`);
|
|
1112
|
+
}
|
|
1088
1113
|
spinner.stopAndPersist({
|
|
1089
1114
|
symbol: "\u{1F680} ",
|
|
1090
1115
|
prefixText: "\n",
|
|
@@ -1146,8 +1171,17 @@ async function handleModelRevisionUpdateFlow(options, app, spinner, ctx, authCtx
|
|
|
1146
1171
|
const pushCredentials = await getRegistryPushCredentials(model.id, authCtx);
|
|
1147
1172
|
await loginToDockerRegistry(pushCredentials);
|
|
1148
1173
|
await buildDockerImage(dockerImage, ctx);
|
|
1149
|
-
await pushDockerImage(dockerImage,
|
|
1174
|
+
await pushDockerImage(dockerImage, model.dockerImage);
|
|
1150
1175
|
spinner.succeed("Updated model image pushed to registry successfully");
|
|
1176
|
+
spinner.start("Triggering model run...");
|
|
1177
|
+
try {
|
|
1178
|
+
await triggerModelRun(model.id, authCtx);
|
|
1179
|
+
spinner.succeed("Model run triggered successfully");
|
|
1180
|
+
} catch {
|
|
1181
|
+
spinner.warn(`Failed to trigger model run
|
|
1182
|
+
If you use static inputs, make sure you have uploaded it to your input bucket
|
|
1183
|
+
If you use inputs with data fetchers, your model will run when they have fetched new data`);
|
|
1184
|
+
}
|
|
1151
1185
|
spinner.stopAndPersist({
|
|
1152
1186
|
symbol: "\u{1F680} ",
|
|
1153
1187
|
prefixText: "\n",
|
|
@@ -1333,7 +1367,7 @@ import { Command } from "commander";
|
|
|
1333
1367
|
// package.json
|
|
1334
1368
|
var package_default = {
|
|
1335
1369
|
name: "@pd4castr/cli",
|
|
1336
|
-
version: "0.0.
|
|
1370
|
+
version: "0.0.11",
|
|
1337
1371
|
description: "CLI tool for creating, testing, and publishing pd4castr models",
|
|
1338
1372
|
main: "dist/index.js",
|
|
1339
1373
|
type: "module",
|