@dreamlake/dreamlake-cli 0.91.0 → 0.92.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.
@@ -78,6 +78,8 @@ export declare function queuesApi(t: Transport, namespace: string): {
78
78
  unmount: (prefix: string) => Promise<unknown>;
79
79
  token: (prefix: string, token: string) => Promise<unknown>;
80
80
  proxy: (prefix: string, lakeshoreNamespace: string, kind: "queues" | "workers" | "jobs" | "invocations", query?: Query) => Promise<unknown>;
81
+ worker: (prefix: string, lakeshoreNamespace: string, workerId: string) => Promise<unknown>;
82
+ setWorkerClaimJobs: (prefix: string, lakeshoreNamespace: string, workerId: string, enabled: boolean) => Promise<unknown>;
81
83
  };
82
84
  export declare function submitRun(t: Transport, namespace: string, input: RunInput): Promise<{
83
85
  run: Record<string, unknown>;
@@ -53,6 +53,9 @@ export function queuesApi(t, namespace) {
53
53
  seg(lakeshoreNamespace) +
54
54
  "/" +
55
55
  kind, undefined, query),
56
+ worker: (prefix, lakeshoreNamespace, workerId) => call(t, "GET", p(prefix) + "/proxy/v1/namespaces/" + seg(lakeshoreNamespace) + "/workers/" + seg(workerId)),
57
+ // Future business claims only; heartbeat, control and remote exec continue.
58
+ setWorkerClaimJobs: (prefix, lakeshoreNamespace, workerId, enabled) => call(t, "POST", p(prefix) + "/proxy/v1/namespaces/" + seg(lakeshoreNamespace) + "/workers/" + seg(workerId) + "/claim-jobs", { enabled }),
56
59
  };
57
60
  }
58
61
  export async function submitRun(t, namespace, input) {
@@ -1136,6 +1136,8 @@ export declare function createApi(transport: Transport): {
1136
1136
  unmount: (prefix: string) => Promise<unknown>;
1137
1137
  token: (prefix: string, token: string) => Promise<unknown>;
1138
1138
  proxy: (prefix: string, lakeshoreNamespace: string, kind: "queues" | "workers" | "jobs" | "invocations", query?: import("./common.js").Query) => Promise<unknown>;
1139
+ worker: (prefix: string, lakeshoreNamespace: string, workerId: string) => Promise<unknown>;
1140
+ setWorkerClaimJobs: (prefix: string, lakeshoreNamespace: string, workerId: string, enabled: boolean) => Promise<unknown>;
1139
1141
  };
1140
1142
  ownership: (namespace: string) => {
1141
1143
  resource: (kind: "project" | "source", id: string, action?: "inspect" | "manifest" | "restore" | "transfer-plan") => Promise<unknown>;
@@ -2333,6 +2335,8 @@ export declare function createClient(options: ClientOptions): {
2333
2335
  unmount: (prefix: string) => Promise<unknown>;
2334
2336
  token: (prefix: string, token: string) => Promise<unknown>;
2335
2337
  proxy: (prefix: string, lakeshoreNamespace: string, kind: "queues" | "workers" | "jobs" | "invocations", query?: import("./common.js").Query) => Promise<unknown>;
2338
+ worker: (prefix: string, lakeshoreNamespace: string, workerId: string) => Promise<unknown>;
2339
+ setWorkerClaimJobs: (prefix: string, lakeshoreNamespace: string, workerId: string, enabled: boolean) => Promise<unknown>;
2336
2340
  };
2337
2341
  ownership: (namespace: string) => {
2338
2342
  resource: (kind: "project" | "source", id: string, action?: "inspect" | "manifest" | "restore" | "transfer-plan") => Promise<unknown>;
@@ -126,6 +126,7 @@ export const helpExamples = {
126
126
  "providers nodes": "dreamlake providers nodes team/333333333333333333333333 --json",
127
127
  "providers instances logs": "dreamlake providers instances logs team/333333333333333333333333 --instance POD_NAME --tail 100 --json",
128
128
  "providers instances terminate": "dreamlake providers instances terminate team/333333333333333333333333 --instance POD_NAME --request-id kube-delete-01 --json",
129
+ "queues worker-claims": "dreamlake queues worker-claims lab WORKER_ID --namespace geyang\ndreamlake queues worker-claims lab WORKER_ID --namespace geyang --disable\ndreamlake queues worker-claims lab WORKER_ID --namespace geyang --enable --json",
129
130
  "queues slurm clusters": "dreamlake queues slurm clusters --namespace geyang",
130
131
  "queues slurm jobs": "dreamlake queues slurm jobs CLUSTER_ID --namespace geyang\ndreamlake queues slurm jobs CLUSTER_ID --namespace geyang --details\ndreamlake queues slurm jobs CLUSTER_ID --namespace geyang --json",
131
132
  "runnable run": "dreamlake runnable run udf/NAMESPACE/NAME@FULL_SHA256 \\\n --target NAMESPACE/GROUP/HOST --enrollment-id ENROLLMENT_ID \\\n --request-id YOUR_STABLE_REQUEST_ID --inputs inputs.json --json",
@@ -30,4 +30,9 @@ export declare function runQueuesResources(prefix: string, resource: "workers" |
30
30
  limit?: string;
31
31
  offset?: string;
32
32
  }): Promise<number>;
33
+ export interface WorkerClaimsOpts extends QueueOpts {
34
+ enable?: boolean;
35
+ disable?: boolean;
36
+ }
37
+ export declare function runQueuesWorkerClaims(prefix: string, workerId: string, opts: WorkerClaimsOpts): Promise<number>;
33
38
  export declare function registerQueuesCommand(program: Command): void;
@@ -219,6 +219,38 @@ export async function runQueuesResources(prefix, resource, opts) {
219
219
  return error(err);
220
220
  }
221
221
  }
222
+ // Shows or sets one worker's job-claim switch. Disabled workers keep heartbeat,
223
+ // control, setup and remote exec; already-claimed work is not cancelled.
224
+ export async function runQueuesWorkerClaims(prefix, workerId, opts) {
225
+ try {
226
+ if (opts.enable && opts.disable)
227
+ throw new Error("choose one of --enable or --disable");
228
+ if (!/^[a-f0-9]{24}$/.test(workerId))
229
+ throw new Error("worker ID must be the 24-character ID shown by 'dreamlake queues workers'");
230
+ const c = await context(opts);
231
+ const path = `${c.path}/${seg(prefix)}`;
232
+ const mount = await requestJson(c.remote, path, { token: c.token });
233
+ const worker = `${path}/proxy/v1/namespaces/${seg(mount.lakeshoreNs)}/workers/${seg(workerId)}`;
234
+ if (opts.enable || opts.disable) {
235
+ await requestJson(c.remote, `${worker}/claim-jobs`, { token: c.token, method: "POST", json: { enabled: !!opts.enable } });
236
+ }
237
+ // Report what the control plane stores, not what was requested.
238
+ const view = await requestJson(c.remote, worker, { token: c.token });
239
+ if (typeof view.claimJobs !== "boolean") {
240
+ throw new Error("this Lakeshore control plane does not report claimJobs; it predates the worker job-claim switch");
241
+ }
242
+ const result = { workerId: view.id ?? workerId, label: view.label ?? null, state: view.state ?? null, claimJobs: view.claimJobs };
243
+ if (opts.json)
244
+ emitJson(result);
245
+ else
246
+ process.stdout.write(`${result.label ?? result.workerId}: business job claims ${result.claimJobs ? "enabled" : "disabled"}`
247
+ + (result.claimJobs ? "" : " (heartbeat, control and remote exec continue)") + "\n");
248
+ return 0;
249
+ }
250
+ catch (err) {
251
+ return error(err);
252
+ }
253
+ }
222
254
  export function registerQueuesCommand(program) {
223
255
  const queues = program.command("queues").description("mount Lakeshore servers and view live queues through DreamLake");
224
256
  registerSlurmCommands(queues);
@@ -241,6 +273,10 @@ export function registerQueuesCommand(program) {
241
273
  .action(async (prefix, opts) => { process.exitCode = await runQueuesToken(prefix, opts); });
242
274
  common(queues.command("workers <prefix>").description("view workers on a mounted server"))
243
275
  .action(async (prefix, opts) => { process.exitCode = await runQueuesResources(prefix, "workers", opts); });
276
+ common(queues.command("worker-claims <prefix> <worker-id>").description("show or set whether one worker claims new jobs; exec and heartbeat continue")
277
+ .option("--disable", "stop claiming new jobs from every queue")
278
+ .option("--enable", "resume claiming jobs"))
279
+ .action(async (prefix, workerId, opts) => { process.exitCode = await runQueuesWorkerClaims(prefix, workerId, opts); });
244
280
  common(queues.command("jobs <prefix>").description("view jobs on a mounted server").option("--limit <count>", "maximum jobs").option("--offset <count>", "pagination offset"))
245
281
  .action(async (prefix, opts) => { process.exitCode = await runQueuesResources(prefix, "jobs", opts); });
246
282
  common(collectionList(queues, "list <prefix>").description("list live queues on a mounted server"))
@@ -1 +1 @@
1
- export declare const VERSION = "0.91.0";
1
+ export declare const VERSION = "0.92.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.91.0";
9
+ export const VERSION = "0.92.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dreamlake/dreamlake-cli",
3
- "version": "0.91.0",
3
+ "version": "0.92.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/dreamlake-ai/dreamlake-cli.git"
@@ -35,13 +35,13 @@
35
35
  "node": ">=18"
36
36
  },
37
37
  "optionalDependencies": {
38
- "@dreamlake/dreamlake-cli-darwin-arm64": "0.91.0",
39
- "@dreamlake/dreamlake-cli-darwin-x64": "0.91.0",
40
- "@dreamlake/dreamlake-cli-linux-x64": "0.91.0",
41
- "@dreamlake/dreamlake-cli-linux-arm64": "0.91.0",
42
- "@dreamlake/dreamlake-cli-linux-x64-musl": "0.91.0",
43
- "@dreamlake/dreamlake-cli-linux-arm64-musl": "0.91.0",
44
- "@dreamlake/dreamlake-cli-win32-x64": "0.91.0",
45
- "@dreamlake/dreamlake-cli-win32-arm64": "0.91.0"
38
+ "@dreamlake/dreamlake-cli-darwin-arm64": "0.92.0",
39
+ "@dreamlake/dreamlake-cli-darwin-x64": "0.92.0",
40
+ "@dreamlake/dreamlake-cli-linux-x64": "0.92.0",
41
+ "@dreamlake/dreamlake-cli-linux-arm64": "0.92.0",
42
+ "@dreamlake/dreamlake-cli-linux-x64-musl": "0.92.0",
43
+ "@dreamlake/dreamlake-cli-linux-arm64-musl": "0.92.0",
44
+ "@dreamlake/dreamlake-cli-win32-x64": "0.92.0",
45
+ "@dreamlake/dreamlake-cli-win32-arm64": "0.92.0"
46
46
  }
47
47
  }