@dreamlake/dreamlake-cli 0.123.0 → 0.125.0

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.
@@ -91,8 +91,10 @@ export interface CictRun {
91
91
  reason: string;
92
92
  };
93
93
  /** A DreamLake GPU job waiting for a slot: 1 is next. */
94
+ /** A waiting DreamLake GPU job; `held` says why it cannot start yet. */
94
95
  queue?: {
95
96
  position: number;
97
+ held?: string;
96
98
  } | null;
97
99
  /** GPU time a finished DreamLake GPU run used. */
98
100
  usage?: {
@@ -192,14 +194,35 @@ export interface CictPlatformAccess {
192
194
  } | null;
193
195
  authorizedByUserId: string | null;
194
196
  }
197
+ /** Whose edit right admits evidence writes; jobs wait while `writable` is false. */
198
+ export interface CictAuthorizer {
199
+ userId: string;
200
+ name: string | null;
201
+ writable: boolean;
202
+ }
195
203
  export interface CictPlatformStatus {
196
204
  available: boolean;
197
205
  machines: CictPlatformMachine[];
198
206
  access: CictPlatformAccess | null;
207
+ /** Absent from older servers. */
208
+ authorizer?: CictAuthorizer | null;
199
209
  running: number;
200
210
  waiting: number;
201
211
  monthGpuSeconds: number;
202
212
  }
213
+ /** One DreamLake GPU job's GPU time. */
214
+ export interface CictUsageRun {
215
+ runId: string | null;
216
+ repository: string;
217
+ workflowName: string | null;
218
+ name: string | null;
219
+ /** The GitHub user who triggered the job. */
220
+ sender: string | null;
221
+ headBranch: string | null;
222
+ headSha: string | null;
223
+ gpuSeconds: number;
224
+ completedAt: string;
225
+ }
203
226
  export interface CictUsage {
204
227
  month: string;
205
228
  gpuSeconds: number;
@@ -210,6 +233,15 @@ export interface CictUsage {
210
233
  gpuSeconds: number;
211
234
  jobs: number;
212
235
  }>;
236
+ /** Absent from older servers. */
237
+ bySender?: Array<{
238
+ sender: string | null;
239
+ gpuSeconds: number;
240
+ jobs: number;
241
+ }>;
242
+ /** Newest first; narrowed by `sender` when asked. */
243
+ runs?: CictUsageRun[];
244
+ runsTotal?: number;
213
245
  }
214
246
  /**
215
247
  * CI/CT through GitHub Actions (channel A): connect a GitHub App installation,
@@ -266,8 +298,15 @@ export declare function cictApi(t: Transport, namespace: string, fetchImpl?: typ
266
298
  };
267
299
  }>;
268
300
  };
269
- /** DreamLake GPU time in a month (default: this month), by repository and workflow. */
270
- usage: (month?: string) => Promise<CictUsage>;
301
+ /**
302
+ * DreamLake GPU time in a month (default: this month): by repository and
303
+ * workflow, by the GitHub user who triggered each job, and the jobs
304
+ * (newest first; `sender` narrows the job list, `limit` caps it at 1-500).
305
+ */
306
+ usage: (month?: string, options?: {
307
+ sender?: string;
308
+ limit?: number;
309
+ }) => Promise<CictUsage>;
271
310
  github: {
272
311
  /** GitHub App installations bound to this namespace. */
273
312
  installations: () => Promise<CictInstallation[]>;
@@ -286,7 +325,13 @@ export declare function cictApi(t: Transport, namespace: string, fetchImpl?: typ
286
325
  * which namespaces may use it, their limits, and the machine types.
287
326
  */
288
327
  export declare function cictPlatformAdminApi(t: Transport): {
289
- overview: () => Promise<{
328
+ overview: (month?: string) => Promise<{
329
+ platformNamespace?: string | null;
330
+ month?: string;
331
+ total?: {
332
+ gpuSeconds: number;
333
+ jobs: number;
334
+ };
290
335
  machines: Array<CictPlatformMachine & {
291
336
  providerId: string;
292
337
  env: Record<string, string>;
@@ -295,9 +340,11 @@ export declare function cictPlatformAdminApi(t: Transport): {
295
340
  namespaces: Array<CictPlatformAccess & {
296
341
  namespaceId: string;
297
342
  slug: string | null;
343
+ authorizer?: CictAuthorizer | null;
298
344
  running: number;
299
345
  waiting: number;
300
346
  monthGpuSeconds: number;
347
+ monthJobs?: number;
301
348
  }>;
302
349
  }>;
303
350
  /** Allow (`allowed`), pause (`suspended`) or set the concurrency limit of a namespace. */
@@ -308,6 +355,15 @@ export declare function cictPlatformAdminApi(t: Transport): {
308
355
  namespaceId: string;
309
356
  }>;
310
357
  /** Create or change a machine type; the provider must be in the platform namespace. */
358
+ /** Slurm providers in the platform namespace, with what one job gets on each (from its launch layer). */
359
+ providers: () => Promise<{
360
+ id: string;
361
+ name: string;
362
+ usable: boolean;
363
+ reason: string | null;
364
+ spec: CictPlatformMachine["spec"] | null;
365
+ }[]>;
366
+ /** Create or change a machine type. What one job gets is read from the provider's launch layer. */
311
367
  putMachine: (id: string, body: {
312
368
  label?: string;
313
369
  title?: string;
@@ -315,7 +371,6 @@ export declare function cictPlatformAdminApi(t: Transport): {
315
371
  enabled?: boolean;
316
372
  maxConcurrent?: number;
317
373
  env?: Record<string, string>;
318
- spec?: CictPlatformMachine["spec"];
319
374
  }) => Promise<CictPlatformMachine & {
320
375
  providerId: string;
321
376
  maxConcurrent: number;
package/dist/api/cict.js CHANGED
@@ -71,11 +71,21 @@ export function cictApi(t, namespace, fetchImpl) {
71
71
  /** Change where DreamLake GPU runs save results. */
72
72
  setSource: (sourceId) => call(t, "PATCH", ns + "/cict/platform", { sourceId }),
73
73
  },
74
- /** DreamLake GPU time in a month (default: this month), by repository and workflow. */
75
- usage: (month) => {
74
+ /**
75
+ * DreamLake GPU time in a month (default: this month): by repository and
76
+ * workflow, by the GitHub user who triggered each job, and the jobs
77
+ * (newest first; `sender` narrows the job list, `limit` caps it at 1-500).
78
+ */
79
+ usage: (month, options = {}) => {
76
80
  if (month !== undefined && !MONTH.test(month))
77
81
  throw new Error("Use a month as YYYY-MM");
78
- return call(t, "GET", ns + "/cict/usage", undefined, month ? { month } : {});
82
+ if (options.sender !== undefined && !/^[A-Za-z0-9][A-Za-z0-9_.[\]-]{0,99}$/.test(options.sender))
83
+ throw new Error("Use a GitHub login as the sender");
84
+ if (options.limit !== undefined && (!Number.isSafeInteger(options.limit) || options.limit < 1 || options.limit > 500))
85
+ throw new Error("Use a limit from 1 to 500");
86
+ return call(t, "GET", ns + "/cict/usage", undefined, {
87
+ ...(month ? { month } : {}), ...(options.sender ? { sender: options.sender } : {}), ...(options.limit ? { limit: String(options.limit) } : {}),
88
+ });
79
89
  },
80
90
  github: {
81
91
  /** GitHub App installations bound to this namespace. */
@@ -95,10 +105,17 @@ export function cictApi(t, namespace, fetchImpl) {
95
105
  */
96
106
  export function cictPlatformAdminApi(t) {
97
107
  return {
98
- overview: () => call(t, "GET", "/cict/platform/admin"),
108
+ overview: (month) => {
109
+ if (month !== undefined && !MONTH.test(month))
110
+ throw new Error("Use a month as YYYY-MM");
111
+ return call(t, "GET", "/cict/platform/admin", undefined, month ? { month } : {});
112
+ },
99
113
  /** Allow (`allowed`), pause (`suspended`) or set the concurrency limit of a namespace. */
100
114
  setNamespace: (slug, body) => call(t, "PUT", "/cict/platform/admin/namespaces/" + seg(slug), body),
101
115
  /** Create or change a machine type; the provider must be in the platform namespace. */
116
+ /** Slurm providers in the platform namespace, with what one job gets on each (from its launch layer). */
117
+ providers: async () => (await call(t, "GET", "/cict/platform/admin/providers")).providers,
118
+ /** Create or change a machine type. What one job gets is read from the provider's launch layer. */
102
119
  putMachine: (id, body) => call(t, "PUT", "/cict/platform/admin/machines/" + seg(id), body),
103
120
  };
104
121
  }
@@ -1312,7 +1312,10 @@ export declare function createApi(transport: Transport, storageFetch?: typeof fe
1312
1312
  };
1313
1313
  }>;
1314
1314
  };
1315
- usage: (month?: string) => Promise<import("./cict.js").CictUsage>;
1315
+ usage: (month?: string, options?: {
1316
+ sender?: string;
1317
+ limit?: number;
1318
+ }) => Promise<import("./cict.js").CictUsage>;
1316
1319
  github: {
1317
1320
  installations: () => Promise<import("./cict.js").CictInstallation[]>;
1318
1321
  connect: () => Promise<{
@@ -1322,7 +1325,13 @@ export declare function createApi(transport: Transport, storageFetch?: typeof fe
1322
1325
  };
1323
1326
  /** DreamLake GPU administration (admins of the platform namespace). */
1324
1327
  cictPlatformAdmin: {
1325
- overview: () => Promise<{
1328
+ overview: (month?: string) => Promise<{
1329
+ platformNamespace?: string | null;
1330
+ month?: string;
1331
+ total?: {
1332
+ gpuSeconds: number;
1333
+ jobs: number;
1334
+ };
1326
1335
  machines: Array<import("./cict.js").CictPlatformMachine & {
1327
1336
  providerId: string;
1328
1337
  env: Record<string, string>;
@@ -1331,9 +1340,11 @@ export declare function createApi(transport: Transport, storageFetch?: typeof fe
1331
1340
  namespaces: Array<import("./cict.js").CictPlatformAccess & {
1332
1341
  namespaceId: string;
1333
1342
  slug: string | null;
1343
+ authorizer?: import("./cict.js").CictAuthorizer | null;
1334
1344
  running: number;
1335
1345
  waiting: number;
1336
1346
  monthGpuSeconds: number;
1347
+ monthJobs?: number;
1337
1348
  }>;
1338
1349
  }>;
1339
1350
  setNamespace: (slug: string, body: {
@@ -1342,6 +1353,13 @@ export declare function createApi(transport: Transport, storageFetch?: typeof fe
1342
1353
  }) => Promise<import("./cict.js").CictPlatformAccess & {
1343
1354
  namespaceId: string;
1344
1355
  }>;
1356
+ providers: () => Promise<{
1357
+ id: string;
1358
+ name: string;
1359
+ usable: boolean;
1360
+ reason: string | null;
1361
+ spec: import("./cict.js").CictPlatformMachine["spec"] | null;
1362
+ }[]>;
1345
1363
  putMachine: (id: string, body: {
1346
1364
  label?: string;
1347
1365
  title?: string;
@@ -1349,7 +1367,6 @@ export declare function createApi(transport: Transport, storageFetch?: typeof fe
1349
1367
  enabled?: boolean;
1350
1368
  maxConcurrent?: number;
1351
1369
  env?: Record<string, string>;
1352
- spec?: import("./cict.js").CictPlatformMachine["spec"];
1353
1370
  }) => Promise<import("./cict.js").CictPlatformMachine & {
1354
1371
  providerId: string;
1355
1372
  maxConcurrent: number;
@@ -2741,7 +2758,10 @@ export declare function createClient(options: ClientOptions): {
2741
2758
  };
2742
2759
  }>;
2743
2760
  };
2744
- usage: (month?: string) => Promise<import("./cict.js").CictUsage>;
2761
+ usage: (month?: string, options?: {
2762
+ sender?: string;
2763
+ limit?: number;
2764
+ }) => Promise<import("./cict.js").CictUsage>;
2745
2765
  github: {
2746
2766
  installations: () => Promise<import("./cict.js").CictInstallation[]>;
2747
2767
  connect: () => Promise<{
@@ -2751,7 +2771,13 @@ export declare function createClient(options: ClientOptions): {
2751
2771
  };
2752
2772
  /** DreamLake GPU administration (admins of the platform namespace). */
2753
2773
  cictPlatformAdmin: {
2754
- overview: () => Promise<{
2774
+ overview: (month?: string) => Promise<{
2775
+ platformNamespace?: string | null;
2776
+ month?: string;
2777
+ total?: {
2778
+ gpuSeconds: number;
2779
+ jobs: number;
2780
+ };
2755
2781
  machines: Array<import("./cict.js").CictPlatformMachine & {
2756
2782
  providerId: string;
2757
2783
  env: Record<string, string>;
@@ -2760,9 +2786,11 @@ export declare function createClient(options: ClientOptions): {
2760
2786
  namespaces: Array<import("./cict.js").CictPlatformAccess & {
2761
2787
  namespaceId: string;
2762
2788
  slug: string | null;
2789
+ authorizer?: import("./cict.js").CictAuthorizer | null;
2763
2790
  running: number;
2764
2791
  waiting: number;
2765
2792
  monthGpuSeconds: number;
2793
+ monthJobs?: number;
2766
2794
  }>;
2767
2795
  }>;
2768
2796
  setNamespace: (slug: string, body: {
@@ -2771,6 +2799,13 @@ export declare function createClient(options: ClientOptions): {
2771
2799
  }) => Promise<import("./cict.js").CictPlatformAccess & {
2772
2800
  namespaceId: string;
2773
2801
  }>;
2802
+ providers: () => Promise<{
2803
+ id: string;
2804
+ name: string;
2805
+ usable: boolean;
2806
+ reason: string | null;
2807
+ spec: import("./cict.js").CictPlatformMachine["spec"] | null;
2808
+ }[]>;
2774
2809
  putMachine: (id: string, body: {
2775
2810
  label?: string;
2776
2811
  title?: string;
@@ -2778,7 +2813,6 @@ export declare function createClient(options: ClientOptions): {
2778
2813
  enabled?: boolean;
2779
2814
  maxConcurrent?: number;
2780
2815
  env?: Record<string, string>;
2781
- spec?: import("./cict.js").CictPlatformMachine["spec"];
2782
2816
  }) => Promise<import("./cict.js").CictPlatformMachine & {
2783
2817
  providerId: string;
2784
2818
  maxConcurrent: number;
@@ -37,6 +37,8 @@ function count(value, flag, max = 1000) {
37
37
  throw new Error(`${flag} must be a whole number from 0 to ${max}`);
38
38
  return n;
39
39
  }
40
+ /** What one job gets: `1x RTX 5090 · 8 CPU · 32 GB · 02:00:00`. */
41
+ const specText = (s) => s ? [`${s.gpus}x ${s.gpu}`, `${s.cpus} CPU`, `${s.memGiB} GB`, s.timeLimit].filter(Boolean).join(" · ") : "unknown";
40
42
  const gpuMinutes = (seconds) => `${seconds > 0 && seconds < 60 ? "<1" : Math.round(seconds / 60)} GPU min`;
41
43
  function selector(value, pattern, shape) {
42
44
  const at = value.indexOf("/");
@@ -74,7 +76,7 @@ function runLine(run) {
74
76
  const where = run.routing.kind === "matched" ? run.routing.pool.name
75
77
  : run.routing.kind === "platform" ? run.routing.machine.label
76
78
  : run.routing.kind === "rejected" || run.routing.kind === "refused" ? `${run.routing.kind}:${run.routing.reason}` : run.routing.kind;
77
- const state = run.queue ? `queued #${run.queue.position}` : outcome(run);
79
+ const state = run.queue?.held ? "held: re-authorize" : run.queue ? `queued #${run.queue.position}` : outcome(run);
78
80
  return [run.id, state.padEnd(11), run.repository.fullName, run.name ?? "", run.headSha?.slice(0, 7) ?? "", where, run.evidence?.state ?? "-"].join(" ");
79
81
  }
80
82
  function runText(run) {
@@ -83,7 +85,7 @@ function runText(run) {
83
85
  ` status ${outcome(run)}`,
84
86
  ` commit ${run.headSha ?? "-"}${run.headBranch ? ` on ${run.headBranch}` : ""}`,
85
87
  ` github ${run.githubUrl}`,
86
- ` routing ${run.routing.kind === "matched" ? `pool ${run.routing.pool.name}` : run.routing.kind === "platform" ? `DreamLake GPU ${run.routing.machine.label}${run.queue ? ` · queued #${run.queue.position}` : ""}` : run.routing.kind === "refused" ? `not started: ${run.routing.reason}` : run.routing.kind}`,
88
+ ` routing ${run.routing.kind === "matched" ? `pool ${run.routing.pool.name}` : run.routing.kind === "platform" ? `DreamLake GPU ${run.routing.machine.label}${run.queue?.held ? " · waiting for re-authorization (dl cict platform source)" : run.queue ? ` · queued #${run.queue.position}` : ""}` : run.routing.kind === "refused" ? `not started: ${run.routing.reason}` : run.routing.kind}`,
87
89
  ...(run.sender ? [` by ${run.sender}`] : []),
88
90
  ...(run.usage ? [` GPU time ${gpuMinutes(run.usage.gpuSeconds)}`] : []),
89
91
  ...(run.comparison ? [` baseline ${run.comparison.baseline ? `${run.comparison.regressions} regressed, ${run.comparison.fixes} fixed vs ${run.comparison.baseline.branch}` : "none yet"}`] : []),
@@ -216,9 +218,11 @@ export function registerCictCommand(program) {
216
218
  return [
217
219
  `DreamLake GPU: ${state}`,
218
220
  ...(a?.state === "active" ? [` running ${st.running} of ${a.maxConcurrent} · queued ${st.waiting} · this month ${gpuMinutes(st.monthGpuSeconds)}`,
219
- ` results: source ${a.evidence?.sourceId} / ${a.evidence?.prefix}`] : []),
221
+ ` results: source ${a.evidence?.sourceId} / ${a.evidence?.prefix}`,
222
+ ...(st.authorizer ? [` authorized by ${st.authorizer.name ?? st.authorizer.userId}${st.authorizer.writable ? ""
223
+ : ` — can no longer write; jobs wait until a namespace admin runs: dl cict platform source ${ns} --source ${a.evidence?.sourceId}`}`] : [])] : []),
220
224
  "Machines:",
221
- ...st.machines.map((m) => ` ${m.label} ${m.spec.gpus}x ${m.spec.gpu} · ${m.spec.cpus} CPU · ${m.spec.memGiB} GB · ${m.spec.timeLimit}`),
225
+ ...st.machines.map((m) => ` ${m.label} per job: ${specText(m.spec)}`),
222
226
  ].join("\n");
223
227
  }));
224
228
  platform.command("start <namespace>").description("start using DreamLake GPU: create cict-evidence (or use --source) for results; you authorize the writes")
@@ -229,7 +233,7 @@ export function registerCictCommand(program) {
229
233
  throw new Error("--source must be a 24-character Source ID");
230
234
  return api(ns).platform.start(opts.source);
231
235
  }, (r) => `DreamLake GPU in use; results go to ${r.source.name}.`));
232
- platform.command("source <namespace>").description("change where DreamLake GPU runs save results")
236
+ platform.command("source <namespace>").description("change where DreamLake GPU runs save results; the same Source re-authorizes (you become the authorizer)")
233
237
  .requiredOption("--source <id>", "a Source you can edit")
234
238
  .option("--json")
235
239
  .action((ns, opts) => execute(opts, () => {
@@ -237,21 +241,47 @@ export function registerCictCommand(program) {
237
241
  throw new Error("--source must be a 24-character Source ID");
238
242
  return api(ns).platform.setSource(opts.source);
239
243
  }, (r) => `Results now go to ${r.source.name}.`));
240
- group.command("usage <namespace>").description("DreamLake GPU time in a month, by repository and workflow")
244
+ group.command("usage <namespace>").description("DreamLake GPU time in a month: by who triggered each job, by repository and workflow, or job by job (--jobs)")
241
245
  .option("--month <YYYY-MM>", "default: this month")
246
+ .option("--jobs", "list the jobs, newest first, instead of the totals")
247
+ .option("--sender <login>", "with --jobs: only jobs this GitHub user triggered")
248
+ .option("--limit <n>", "with --jobs: how many (1-500, default 100)")
242
249
  .option("--json")
243
- .action((ns, opts) => execute(opts, async () => api(ns).usage(opts.month), (u) => [
244
- `${u.month}: ${gpuMinutes(u.gpuSeconds)} over ${u.jobs} job${u.jobs === 1 ? "" : "s"}`,
245
- ...u.byWorkflow.map((r) => ` ${r.repository} ${r.workflowName ?? "-"} ${r.jobs} jobs ${gpuMinutes(r.gpuSeconds)}`),
246
- ].join("\n")));
250
+ .action((ns, opts) => execute(opts, async () => {
251
+ if ((opts.sender !== undefined || opts.limit !== undefined) && !opts.jobs)
252
+ throw new Error("--sender and --limit go with --jobs");
253
+ return api(ns).usage(opts.month, {
254
+ ...(opts.sender !== undefined ? { sender: opts.sender } : {}),
255
+ ...(opts.limit !== undefined ? { limit: count(opts.limit, "--limit", 500) } : {}),
256
+ });
257
+ }, (u) => {
258
+ const head = `${u.month}: ${gpuMinutes(u.gpuSeconds)} over ${u.jobs} job${u.jobs === 1 ? "" : "s"}`;
259
+ if (opts.jobs) {
260
+ const runs = u.runs ?? [];
261
+ return [
262
+ head + (opts.sender ? ` (jobs by ${opts.sender})` : ""),
263
+ ...runs.map((r) => ` ${r.completedAt.slice(0, 16).replace("T", " ")} ${r.runId ?? "-"} ${r.repository} · ${r.name ?? r.workflowName ?? "job"} ${r.headBranch ?? "-"} by ${r.sender ?? "unknown"} ${gpuMinutes(r.gpuSeconds)}`),
264
+ ...(u.runsTotal > runs.length ? [` … latest ${runs.length} of ${u.runsTotal}; raise --limit for more`] : []),
265
+ ...(runs.length ? [] : [" no DreamLake GPU jobs"]),
266
+ ].join("\n");
267
+ }
268
+ return [
269
+ head,
270
+ ...(u.bySender ? ["By person:", ...u.bySender.map((p) => ` ${p.sender ?? "unknown"} ${p.jobs} jobs ${gpuMinutes(p.gpuSeconds)}`)] : []),
271
+ "By workflow:",
272
+ ...u.byWorkflow.map((r) => ` ${r.repository} ${r.workflowName ?? "-"} ${r.jobs} jobs ${gpuMinutes(r.gpuSeconds)}`),
273
+ ].join("\n");
274
+ }));
247
275
  const admin = platform.command("admin").description("administer DreamLake GPU (admins of the platform namespace)");
248
- admin.command("list").description("machine types and namespaces with their limits, occupancy and this month's GPU time")
276
+ admin.command("list").description("machine types and namespaces with their limits, occupancy and a month's GPU time")
277
+ .option("--month <YYYY-MM>", "default: this month")
249
278
  .option("--json")
250
- .action((opts) => execute(opts, () => adminApi().overview(), (o) => [
279
+ .action((opts) => execute(opts, () => adminApi().overview(opts.month), (o) => [
280
+ ...(o.total ? [`${o.month}: ${gpuMinutes(o.total.gpuSeconds)} over ${o.total.jobs} job${o.total.jobs === 1 ? "" : "s"}, all namespaces`] : []),
251
281
  "Namespaces:",
252
- ...o.namespaces.map((n) => ` ${n.slug ?? n.namespaceId} ${n.state} limit ${n.maxConcurrent} running ${n.running} queued ${n.waiting} ${gpuMinutes(n.monthGpuSeconds)}`),
282
+ ...o.namespaces.map((n) => ` ${n.slug ?? n.namespaceId} ${n.state}${n.authorizer && !n.authorizer.writable ? " (needs re-authorization)" : ""} limit ${n.maxConcurrent} running ${n.running} queued ${n.waiting} ${gpuMinutes(n.monthGpuSeconds)}`),
253
283
  "Machines:",
254
- ...o.machines.map((m) => ` ${m.id} ${m.label} ${m.enabled ? "enabled" : "disabled"} limit ${m.maxConcurrent} provider ${m.providerId}`),
284
+ ...o.machines.map((m) => ` ${m.id} ${m.label} per job: ${specText(m.spec)} ${m.enabled ? "enabled" : "disabled"} ${m.maxConcurrent} jobs at once provider ${m.providerId}`),
255
285
  ].join("\n")));
256
286
  admin.command("allow <namespace>").description("let a namespace use DreamLake GPU (or resume a paused one)")
257
287
  .option("--limit <n>", "jobs at once for this namespace")
@@ -263,21 +293,22 @@ export function registerCictCommand(program) {
263
293
  admin.command("limit <namespace> <n>").description("set how many DreamLake GPU jobs a namespace runs at once")
264
294
  .option("--json")
265
295
  .action((slug, n, opts) => execute(opts, () => adminApi().setNamespace(slug, { maxConcurrent: count(n, "limit", 100) }), (a) => `${slug}: limit ${a.maxConcurrent}`));
266
- admin.command("machine <id>").description("create or change a machine type")
296
+ admin.command("providers").description("Slurm providers in the platform namespace and what one job gets on each, from its launch layer")
297
+ .option("--json")
298
+ .action((opts) => execute(opts, () => adminApi().providers(), (list) => list.length
299
+ ? list.map((p) => `${p.id} ${p.name} ${p.usable ? `per job: ${specText(p.spec)}` : `not usable: ${p.reason}`}`).join("\n")
300
+ : "No Slurm provider in the platform namespace"));
301
+ admin.command("machine <id>").description("create or change a machine type; what one job gets comes from the provider's launch layer")
267
302
  .option("--label <label>", "runs-on label, dreamlake-…")
268
303
  .option("--title <text>")
269
- .option("--provider <id>", "Slurm provider in the platform namespace")
304
+ .option("--provider <id>", "Slurm provider in the platform namespace (see: platform admin providers)")
270
305
  .option("--limit <n>", "jobs at once across all namespaces")
271
306
  .option("--enable").option("--disable")
272
- .option("--gpus <n>").option("--gpu <model>").option("--cpus <n>").option("--mem-gib <n>").option("--time-limit <hh:mm:ss>")
273
307
  .option("--env <NAME=value>", "replace every variable (repeatable)", collect)
274
308
  .option("--json")
275
309
  .action((id, opts) => execute(opts, () => {
276
310
  if (opts.enable && opts.disable)
277
311
  throw new Error("Pass --enable or --disable, not both");
278
- const specFlags = [opts.gpus, opts.gpu, opts.cpus, opts.memGib, opts.timeLimit];
279
- if (specFlags.some((v) => v !== undefined) && specFlags.some((v) => v === undefined))
280
- throw new Error("The catalog spec needs all of --gpus, --gpu, --cpus, --mem-gib and --time-limit");
281
312
  if (opts.provider !== undefined && !ID.test(opts.provider))
282
313
  throw new Error("--provider must be a 24-character provider ID");
283
314
  return adminApi().putMachine(id, {
@@ -285,10 +316,9 @@ export function registerCictCommand(program) {
285
316
  ...(opts.provider ? { providerId: opts.provider } : {}),
286
317
  ...(opts.limit !== undefined ? { maxConcurrent: count(opts.limit, "--limit") } : {}),
287
318
  ...(opts.enable ? { enabled: true } : opts.disable ? { enabled: false } : {}),
288
- ...(opts.gpus !== undefined ? { spec: { gpus: count(opts.gpus, "--gpus", 16), gpu: opts.gpu, cpus: count(opts.cpus, "--cpus", 512), memGiB: count(opts.memGib, "--mem-gib", 4096), timeLimit: opts.timeLimit } } : {}),
289
319
  ...(opts.env ? { env: envOf(opts.env) } : {}),
290
320
  });
291
- }, (m) => `${m.id}: ${m.label} ${m.enabled ? "enabled" : "disabled"}, limit ${m.maxConcurrent}`));
321
+ }, (m) => `${m.id}: ${m.label} per job: ${specText(m.spec)} ${m.enabled ? "enabled" : "disabled"}, ${m.maxConcurrent} jobs at once`));
292
322
  }
293
323
  // Text output for `runs show`, with or without the result.
294
324
  function runShowText(value) {
@@ -49,7 +49,8 @@ export const helpExamples = {
49
49
  "cict platform admin allow": "dl cict platform admin allow robotics-lab --limit 2",
50
50
  "cict platform admin pause": "dl cict platform admin pause robotics-lab",
51
51
  "cict platform admin limit": "dl cict platform admin limit robotics-lab 4",
52
- "cict platform admin machine": "dl cict platform admin machine gpu-rtx5090 --label dreamlake-gpu-rtx5090 \\\n --provider 0123456789abcdef01234567 --limit 6 --enable \\\n --gpus 1 --gpu \"RTX 5090\" --cpus 8 --mem-gib 32 --time-limit 02:00:00\ndl cict platform admin machine gpu-rtx5090 --disable",
52
+ "cict platform admin providers": "dl cict platform admin providers",
53
+ "cict platform admin machine": "dl cict platform admin machine gpu-rtx5090 --label dreamlake-gpu-rtx5090 \\\n --provider 0123456789abcdef01234567 --limit 6 --enable \\\n --env DREAMLAKE_ROBOT_ASSETS_CACHE=/work/shared/robot-assets\ndl cict platform admin machine gpu-rtx5090 --disable",
53
54
  "hosts": "dl hosts\ndl hosts --all\ndl hosts -h\ndl hosts list -h",
54
55
  "su": "dl su fortyfive\ndl hosts list\ndl hosts list --namespace geyang\ndl su geyang",
55
56
  "logout": "dl logout --env staging",
@@ -1 +1 @@
1
- export declare const VERSION = "0.123.0";
1
+ export declare const VERSION = "0.125.0";
@@ -6,4 +6,4 @@
6
6
  // value means a binary that re-installs the same version forever.
7
7
  //
8
8
  // Editing this by hand does nothing for a release; bump package.json.
9
- export const VERSION = "0.123.0";
9
+ export const VERSION = "0.125.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dreamlake/dreamlake-cli",
3
- "version": "0.123.0",
3
+ "version": "0.125.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/dreamlake-ai/dreamlake-cli.git"
@@ -37,13 +37,13 @@
37
37
  "node": ">=18"
38
38
  },
39
39
  "optionalDependencies": {
40
- "@dreamlake/dreamlake-cli-darwin-arm64": "0.123.0",
41
- "@dreamlake/dreamlake-cli-darwin-x64": "0.123.0",
42
- "@dreamlake/dreamlake-cli-linux-x64": "0.123.0",
43
- "@dreamlake/dreamlake-cli-linux-arm64": "0.123.0",
44
- "@dreamlake/dreamlake-cli-linux-x64-musl": "0.123.0",
45
- "@dreamlake/dreamlake-cli-linux-arm64-musl": "0.123.0",
46
- "@dreamlake/dreamlake-cli-win32-x64": "0.123.0",
47
- "@dreamlake/dreamlake-cli-win32-arm64": "0.123.0"
40
+ "@dreamlake/dreamlake-cli-darwin-arm64": "0.125.0",
41
+ "@dreamlake/dreamlake-cli-darwin-x64": "0.125.0",
42
+ "@dreamlake/dreamlake-cli-linux-x64": "0.125.0",
43
+ "@dreamlake/dreamlake-cli-linux-arm64": "0.125.0",
44
+ "@dreamlake/dreamlake-cli-linux-x64-musl": "0.125.0",
45
+ "@dreamlake/dreamlake-cli-linux-arm64-musl": "0.125.0",
46
+ "@dreamlake/dreamlake-cli-win32-x64": "0.125.0",
47
+ "@dreamlake/dreamlake-cli-win32-arm64": "0.125.0"
48
48
  }
49
49
  }