@colony2/c2j 0.0.40 → 0.0.50
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/README.md +34 -36
- package/package.json +13 -13
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# c2j
|
|
2
2
|
|
|
3
|
-
`c2j` is the local job-oriented CLI for submitting and running recipe jobs through
|
|
3
|
+
`c2j` is the local job-oriented CLI for submitting and running recipe jobs through JobDB.
|
|
4
4
|
|
|
5
5
|
Use it when you want to:
|
|
6
6
|
|
|
@@ -91,7 +91,7 @@ That does all of the following:
|
|
|
91
91
|
|
|
92
92
|
- loads the local YAML file
|
|
93
93
|
- embeds that recipe into the submitted job
|
|
94
|
-
- starts an embedded
|
|
94
|
+
- starts an embedded JobDB runtime
|
|
95
95
|
- submits the job
|
|
96
96
|
- immediately executes it
|
|
97
97
|
|
|
@@ -333,7 +333,7 @@ Useful flags:
|
|
|
333
333
|
- `--case <id>` filters suite mode to selected cases
|
|
334
334
|
- `--parallelism <n>` controls local case concurrency
|
|
335
335
|
- `--out-dir <dir>` defaults to `.c2j/test-results/<timestamp>/`
|
|
336
|
-
- passthrough cases use a disposable embedded runtime
|
|
336
|
+
- passthrough cases use a disposable embedded runtime automatically
|
|
337
337
|
|
|
338
338
|
## Running Jobs
|
|
339
339
|
|
|
@@ -403,21 +403,20 @@ the job becomes runnable or the wait timeout is reached.
|
|
|
403
403
|
## Worker Modes
|
|
404
404
|
|
|
405
405
|
`c2j run loop` runs a long-lived worker for one tenant. It leases available jobs
|
|
406
|
-
from
|
|
406
|
+
from a remote JobDB runtime and executes up to the configured local concurrency.
|
|
407
407
|
|
|
408
408
|
Basic usage:
|
|
409
409
|
|
|
410
410
|
```bash
|
|
411
|
-
c2j run loop --
|
|
411
|
+
c2j run loop --jobdb http://localhost:9047/<tenant-id> --concurrency 4
|
|
412
412
|
```
|
|
413
413
|
|
|
414
414
|
Important behavior:
|
|
415
415
|
|
|
416
416
|
- `--concurrency <n>` controls how many jobs this process can run at once
|
|
417
|
-
- `--
|
|
418
|
-
- `--swf-url` must be an external `http://` or `https://` runtime
|
|
417
|
+
- `--jobdb` must be a remote `http://host/tenant` or `https://host/tenant` URI
|
|
419
418
|
- `--embed` is not available for `run loop`
|
|
420
|
-
- `--
|
|
419
|
+
- `--jobdb embed:///` is rejected for `run loop`
|
|
421
420
|
- `run loop` is non-interactive; use `run` or an ops surface for jobs that need input
|
|
422
421
|
|
|
423
422
|
### Loose scheduling with `ready` and `run any`
|
|
@@ -425,7 +424,7 @@ Important behavior:
|
|
|
425
424
|
`c2j ready` prints the number of currently ready recipe jobs for one tenant:
|
|
426
425
|
|
|
427
426
|
```bash
|
|
428
|
-
c2j ready --
|
|
427
|
+
c2j ready --jobdb http://localhost:9047/<tenant-id>
|
|
429
428
|
```
|
|
430
429
|
|
|
431
430
|
`c2j run any` atomically polls for one available item of recipe work, leases it,
|
|
@@ -433,23 +432,23 @@ runs it, and exits. If no lease is available, it exits successfully after
|
|
|
433
432
|
printing `no jobs found`.
|
|
434
433
|
|
|
435
434
|
```bash
|
|
436
|
-
c2j run any --
|
|
435
|
+
c2j run any --jobdb http://localhost:9047/<tenant-id>
|
|
437
436
|
```
|
|
438
437
|
|
|
439
438
|
These can be composed by an external scheduler:
|
|
440
439
|
|
|
441
440
|
```bash
|
|
442
|
-
count=$(c2j ready --
|
|
441
|
+
count=$(c2j ready --jobdb http://localhost:9047/<tenant-id>)
|
|
443
442
|
if [ "$count" -gt 0 ]; then
|
|
444
443
|
for _ in $(seq 1 "$count"); do
|
|
445
|
-
c2j run any --
|
|
444
|
+
c2j run any --jobdb http://localhost:9047/<tenant-id> &
|
|
446
445
|
done
|
|
447
446
|
wait
|
|
448
447
|
fi
|
|
449
448
|
```
|
|
450
449
|
|
|
451
450
|
`ready` is only a non-mutating snapshot and can become stale under competing
|
|
452
|
-
workers. `run any` uses
|
|
451
|
+
workers. `run any` uses JobDB polling so finding available work and acquiring the
|
|
453
452
|
lease happen in one runtime operation.
|
|
454
453
|
|
|
455
454
|
## Listing Jobs
|
|
@@ -495,15 +494,16 @@ Useful filters:
|
|
|
495
494
|
`--embed` is shorthand for:
|
|
496
495
|
|
|
497
496
|
```bash
|
|
498
|
-
--
|
|
497
|
+
--jobdb embed:///
|
|
499
498
|
```
|
|
500
499
|
|
|
501
|
-
Use it when you want a local self-contained runtime instead of
|
|
500
|
+
Use it when you want a local self-contained runtime instead of a remote JobDB server.
|
|
502
501
|
|
|
503
502
|
Behavior:
|
|
504
503
|
|
|
505
504
|
- starts embedded Postgres and Strata as needed
|
|
506
505
|
- uses a persistent runtime root on disk
|
|
506
|
+
- always uses tenant `0`
|
|
507
507
|
- works well for local recipe authoring and debugging
|
|
508
508
|
|
|
509
509
|
Defaults:
|
|
@@ -511,41 +511,39 @@ Defaults:
|
|
|
511
511
|
- runtime URL: `embed:///`
|
|
512
512
|
- runtime root: `~/.c2j/embed/default`
|
|
513
513
|
|
|
514
|
-
You can override the root with:
|
|
515
|
-
|
|
516
|
-
```bash
|
|
517
|
-
export C2J_EMBED_ROOT=/absolute/path/to/embed-root
|
|
518
|
-
```
|
|
519
|
-
|
|
520
514
|
Notes:
|
|
521
515
|
|
|
522
|
-
- `C2J_EMBED_ROOT` must be an absolute path
|
|
523
516
|
- only one `c2j` process can own a given embedded runtime root at a time
|
|
524
|
-
- if you need parallel embedded runtimes, give each process a different `C2J_EMBED_ROOT`
|
|
525
517
|
|
|
526
|
-
##
|
|
518
|
+
## JobDB Configuration
|
|
527
519
|
|
|
528
520
|
`c2j` reads these environment variables:
|
|
529
521
|
|
|
530
|
-
- `
|
|
531
|
-
- `C2J_TENANT_ID`
|
|
532
|
-
- `C2J_EMBED_ROOT`
|
|
522
|
+
- `C2J_JOBDB`
|
|
533
523
|
|
|
534
|
-
|
|
524
|
+
JobDB URI forms:
|
|
535
525
|
|
|
536
|
-
- `
|
|
537
|
-
- `
|
|
526
|
+
- `https://jobdb.example.com/<tenant-id>`
|
|
527
|
+
- `http://localhost:9047/<tenant-id>`
|
|
528
|
+
- `embed:///`
|
|
538
529
|
|
|
539
530
|
Examples:
|
|
540
531
|
|
|
541
532
|
```bash
|
|
542
|
-
export
|
|
543
|
-
export C2J_TENANT_ID=123
|
|
533
|
+
export C2J_JOBDB=http://localhost:9047/my-tenant
|
|
544
534
|
```
|
|
545
535
|
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
536
|
+
`--jobdb` overrides `C2J_JOBDB` for that command. Project config may also define:
|
|
537
|
+
|
|
538
|
+
```yaml
|
|
539
|
+
jobdb: https://jobdb.example.com/my-tenant
|
|
540
|
+
```
|
|
541
|
+
|
|
542
|
+
For local embedded mode in project config:
|
|
543
|
+
|
|
544
|
+
```yaml
|
|
545
|
+
jobdb: embed:///
|
|
546
|
+
```
|
|
549
547
|
|
|
550
548
|
## Common Workflows
|
|
551
549
|
|
|
@@ -568,7 +566,7 @@ c2j run --job-id <job-id> --embed
|
|
|
568
566
|
```bash
|
|
569
567
|
c2j submit \
|
|
570
568
|
--recipe-file ./recipes/my-recipe.yaml \
|
|
571
|
-
--
|
|
569
|
+
--jobdb http://localhost:9047/my-tenant \
|
|
572
570
|
--run
|
|
573
571
|
```
|
|
574
572
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@colony2/c2j",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.50",
|
|
5
5
|
"description": "c2j job system",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"postinstall": "node install.js",
|
|
@@ -30,51 +30,51 @@
|
|
|
30
30
|
},
|
|
31
31
|
"archives": {
|
|
32
32
|
"darwin-arm64": {
|
|
33
|
-
"name": "c2j_0.0.
|
|
34
|
-
"url": "https://github.com/colony-2/c2j
|
|
33
|
+
"name": "c2j_0.0.50_Darwin_arm64.tar.gz",
|
|
34
|
+
"url": "https://github.com/colony-2/c2j/releases/download/v0.0.50/c2j_0.0.50_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": "
|
|
41
|
+
"digest": "b91fdeb7d21a36f2600eaf3ffc1661ce014ab442aecceae26fd4254d402656a1"
|
|
42
42
|
}
|
|
43
43
|
},
|
|
44
44
|
"darwin-x64": {
|
|
45
|
-
"name": "c2j_0.0.
|
|
46
|
-
"url": "https://github.com/colony-2/c2j
|
|
45
|
+
"name": "c2j_0.0.50_Darwin_x86_64.tar.gz",
|
|
46
|
+
"url": "https://github.com/colony-2/c2j/releases/download/v0.0.50/c2j_0.0.50_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": "
|
|
53
|
+
"digest": "ae12ffdda3d24b6b14f55dbd329b488f69c02907bde62589ca0c234deb7080ce"
|
|
54
54
|
}
|
|
55
55
|
},
|
|
56
56
|
"linux-arm64": {
|
|
57
|
-
"name": "c2j_0.0.
|
|
58
|
-
"url": "https://github.com/colony-2/c2j
|
|
57
|
+
"name": "c2j_0.0.50_Linux_arm64.tar.gz",
|
|
58
|
+
"url": "https://github.com/colony-2/c2j/releases/download/v0.0.50/c2j_0.0.50_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": "
|
|
65
|
+
"digest": "e198f9037bd138270aa92ac8b5caa4509b9f76056273d4191909e810d406ba72"
|
|
66
66
|
}
|
|
67
67
|
},
|
|
68
68
|
"linux-x64": {
|
|
69
|
-
"name": "c2j_0.0.
|
|
70
|
-
"url": "https://github.com/colony-2/c2j
|
|
69
|
+
"name": "c2j_0.0.50_Linux_x86_64.tar.gz",
|
|
70
|
+
"url": "https://github.com/colony-2/c2j/releases/download/v0.0.50/c2j_0.0.50_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": "
|
|
77
|
+
"digest": "c8b720b153a9b7354887bfb9dd3f7d26ff615cd29a74dd8385fecda8f79d6e0f"
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
},
|