@colony2/c2j 0.0.22 → 0.0.24

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.
Files changed (2) hide show
  1. package/README.md +75 -12
  2. package/package.json +14 -14
package/README.md CHANGED
@@ -6,6 +6,8 @@ Use it when you want to:
6
6
 
7
7
  - submit a recipe job from a named recipe or a local recipe file
8
8
  - run or continue an existing job
9
+ - count and claim available jobs for external scheduling
10
+ - run a tenant worker loop with bounded local concurrency
9
11
  - use the embedded local runtime for fast iteration
10
12
  - inspect the current cell configuration used for job targeting
11
13
  - list jobs for a cell
@@ -19,7 +21,11 @@ c2j self
19
21
  c2j cells
20
22
  c2j init
21
23
  c2j submit
22
- c2j exec
24
+ c2j run
25
+ c2j run one
26
+ c2j run any
27
+ c2j run loop
28
+ c2j ready
23
29
  c2j list
24
30
  c2j test
25
31
  ```
@@ -85,7 +91,7 @@ c2j list --self --embed
85
91
  Continue a submitted job:
86
92
 
87
93
  ```bash
88
- c2j exec --job-id <job-id> --embed
94
+ c2j run --job-id <job-id> --embed
89
95
  ```
90
96
 
91
97
  ## Current Cell Commands
@@ -316,20 +322,22 @@ Useful flags:
316
322
 
317
323
  ## Running Jobs
318
324
 
319
- `c2j exec` executes or continues an existing job and prints live story progress to stdout.
325
+ `c2j run` executes or continues one existing job and prints live story progress
326
+ to stdout. `c2j run one` is the explicit form of the same command.
320
327
 
321
328
  Basic usage:
322
329
 
323
330
  ```bash
324
- c2j exec --job-id <job-id> --embed
331
+ c2j run --job-id <job-id> --embed
332
+ c2j run one --job-id <job-id> --embed
325
333
  ```
326
334
 
327
335
  Common variants:
328
336
 
329
337
  ```bash
330
- c2j exec --job-id <job-id> --wait-timeout 30m --embed
331
- c2j exec --job-id <job-id> --input-mode fail --embed
332
- c2j exec --job-id <job-id> --ci --embed
338
+ c2j run --job-id <job-id> --wait-timeout 30m --embed
339
+ c2j run --job-id <job-id> --input-mode fail --embed
340
+ c2j run --job-id <job-id> --ci --embed
333
341
  ```
334
342
 
335
343
  Important behavior:
@@ -355,7 +363,7 @@ Important behavior:
355
363
 
356
364
  ### Not-ready handling
357
365
 
358
- `--on-not-ready` controls how `exec` reacts when a job is not runnable yet:
366
+ `--on-not-ready` controls how `run` reacts when a job is not runnable yet:
359
367
 
360
368
  - `wait`
361
369
  - `fail`
@@ -364,17 +372,70 @@ Important behavior:
364
372
  - `fail-on-future`
365
373
  - `fail-on-missing-capability`
366
374
 
367
- With the default `wait`, `exec` will print `waiting: ...` lines and poll until the job becomes runnable or the wait timeout is reached.
375
+ With the default `wait`, `run` will print `waiting: ...` lines and poll until
376
+ the job becomes runnable or the wait timeout is reached.
368
377
 
369
378
  ### Exit codes
370
379
 
371
- `c2j exec` uses distinct exit codes:
380
+ `c2j run` uses distinct exit codes:
372
381
 
373
382
  - `1`: general failure or job failure
374
383
  - `2`: wait timeout
375
384
  - `3`: input required
376
385
  - `4`: job not runnable under the selected policy
377
- - `5`: invalid job identity or invalid exec arguments
386
+ - `5`: invalid job identity or invalid run arguments
387
+
388
+ ## Worker Modes
389
+
390
+ `c2j run loop` runs a long-lived worker for one tenant. It leases available jobs
391
+ from an external SWF runtime and executes up to the configured local concurrency.
392
+
393
+ Basic usage:
394
+
395
+ ```bash
396
+ c2j run loop --tenant-id <tenant-id> --swf-url http://localhost:9047 --concurrency 4
397
+ ```
398
+
399
+ Important behavior:
400
+
401
+ - `--concurrency <n>` controls how many jobs this process can run at once
402
+ - `--tenant-id` defaults the same way as `submit`, `run`, and `list`
403
+ - `--swf-url` must be an external `http://` or `https://` runtime
404
+ - `--embed` is not available for `run loop`
405
+ - `--swf-url embed:///` is rejected for `run loop`
406
+ - `run loop` is non-interactive; use `run` or an ops surface for jobs that need input
407
+
408
+ ### Loose scheduling with `ready` and `run any`
409
+
410
+ `c2j ready` prints the number of currently ready recipe jobs for one tenant:
411
+
412
+ ```bash
413
+ c2j ready --tenant-id <tenant-id> --swf-url http://localhost:9047
414
+ ```
415
+
416
+ `c2j run any` atomically polls for one available item of recipe work, leases it,
417
+ runs it, and exits. If no lease is available, it exits successfully after
418
+ printing `no jobs found`.
419
+
420
+ ```bash
421
+ c2j run any --tenant-id <tenant-id> --swf-url http://localhost:9047
422
+ ```
423
+
424
+ These can be composed by an external scheduler:
425
+
426
+ ```bash
427
+ count=$(c2j ready --tenant-id <tenant-id> --swf-url http://localhost:9047)
428
+ if [ "$count" -gt 0 ]; then
429
+ for _ in $(seq 1 "$count"); do
430
+ c2j run any --tenant-id <tenant-id> --swf-url http://localhost:9047 &
431
+ done
432
+ wait
433
+ fi
434
+ ```
435
+
436
+ `ready` is only a non-mutating snapshot and can become stale under competing
437
+ workers. `run any` uses SWF polling so finding available work and acquiring the
438
+ lease happen in one runtime operation.
378
439
 
379
440
  ## Listing Jobs
380
441
 
@@ -468,6 +529,8 @@ export C2J_TENANT_ID=123
468
529
  ```
469
530
 
470
531
  When `--embed` is present, it overrides `C2J_SWF_URL` for that command.
532
+ `c2j run loop` is the exception: it does not support `--embed` and rejects
533
+ `C2J_SWF_URL=embed:///`.
471
534
 
472
535
  ## Common Workflows
473
536
 
@@ -482,7 +545,7 @@ c2j submit --recipe-file ./recipes/my-recipe.yaml --run --embed
482
545
 
483
546
  ```bash
484
547
  c2j submit --recipe-file ./recipes/my-recipe.yaml --json --embed
485
- c2j exec --job-id <job-id> --embed
548
+ c2j run --job-id <job-id> --embed
486
549
  ```
487
550
 
488
551
  ### Run against a remote runtime instead of embed
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@colony2/c2j",
3
3
  "type": "module",
4
- "version": "0.0.22",
4
+ "version": "0.0.24",
5
5
  "description": "c2j job system",
6
6
  "scripts": {
7
7
  "postinstall": "node install.js",
@@ -26,55 +26,55 @@
26
26
  "dependencies": {
27
27
  "jszip": "3.10.1",
28
28
  "proxy-agent": "8.0.1",
29
- "tar": "7.5.13"
29
+ "tar": "7.5.15"
30
30
  },
31
31
  "archives": {
32
32
  "darwin-arm64": {
33
- "name": "c2j_0.0.22_Darwin_arm64.tar.gz",
34
- "url": "https://github.com/colony-2/c2j-release/releases/download/v0.0.22/c2j_0.0.22_Darwin_arm64.tar.gz",
33
+ "name": "c2j_0.0.24_Darwin_arm64.tar.gz",
34
+ "url": "https://github.com/colony-2/c2j-release/releases/download/v0.0.24/c2j_0.0.24_Darwin_arm64.tar.gz",
35
35
  "bins": [
36
36
  "c2j"
37
37
  ],
38
38
  "format": "tar.gz",
39
39
  "checksum": {
40
40
  "algorithm": "sha256",
41
- "digest": "5c20d523b73e68b67ef853a63d5724339619d134c441915518367a257bf29575"
41
+ "digest": "34ca8f77c4f5e53c92698427f5dc054d4f60e8545dc2b4a49c9f4a02d6250682"
42
42
  }
43
43
  },
44
44
  "darwin-x64": {
45
- "name": "c2j_0.0.22_Darwin_x86_64.tar.gz",
46
- "url": "https://github.com/colony-2/c2j-release/releases/download/v0.0.22/c2j_0.0.22_Darwin_x86_64.tar.gz",
45
+ "name": "c2j_0.0.24_Darwin_x86_64.tar.gz",
46
+ "url": "https://github.com/colony-2/c2j-release/releases/download/v0.0.24/c2j_0.0.24_Darwin_x86_64.tar.gz",
47
47
  "bins": [
48
48
  "c2j"
49
49
  ],
50
50
  "format": "tar.gz",
51
51
  "checksum": {
52
52
  "algorithm": "sha256",
53
- "digest": "5b038ff429d5d3b44cc145811d5a13e7ebaac9aaa3a4f053cf0a63742b25ced5"
53
+ "digest": "84fbff2bb0c69598b53523169421c8d885277ae1c3053e6e48a16c817aed60ec"
54
54
  }
55
55
  },
56
56
  "linux-arm64": {
57
- "name": "c2j_0.0.22_Linux_arm64.tar.gz",
58
- "url": "https://github.com/colony-2/c2j-release/releases/download/v0.0.22/c2j_0.0.22_Linux_arm64.tar.gz",
57
+ "name": "c2j_0.0.24_Linux_arm64.tar.gz",
58
+ "url": "https://github.com/colony-2/c2j-release/releases/download/v0.0.24/c2j_0.0.24_Linux_arm64.tar.gz",
59
59
  "bins": [
60
60
  "c2j"
61
61
  ],
62
62
  "format": "tar.gz",
63
63
  "checksum": {
64
64
  "algorithm": "sha256",
65
- "digest": "de9caf6f4af2182b4e25794d6a5a71e1137130e1398d76f9cde72ac2ef2f967d"
65
+ "digest": "b97cf3e305c8122f44c4c403e01d64a355afa6022ffa943ccd022460e8b4a47a"
66
66
  }
67
67
  },
68
68
  "linux-x64": {
69
- "name": "c2j_0.0.22_Linux_x86_64.tar.gz",
70
- "url": "https://github.com/colony-2/c2j-release/releases/download/v0.0.22/c2j_0.0.22_Linux_x86_64.tar.gz",
69
+ "name": "c2j_0.0.24_Linux_x86_64.tar.gz",
70
+ "url": "https://github.com/colony-2/c2j-release/releases/download/v0.0.24/c2j_0.0.24_Linux_x86_64.tar.gz",
71
71
  "bins": [
72
72
  "c2j"
73
73
  ],
74
74
  "format": "tar.gz",
75
75
  "checksum": {
76
76
  "algorithm": "sha256",
77
- "digest": "d4dfc4b2d734f3efeed4c30dbc78258595d4fd5683a272ee7ea3a53ee40c3487"
77
+ "digest": "31913776acc40d186c863ec0699e9ec6fa19b936f1e21691afbd51a92d9bf8df"
78
78
  }
79
79
  }
80
80
  },