@smoothbricks/nx-plugin 0.6.0 → 0.6.2
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 +68 -56
- package/dist/.build-inputs.json +16 -13
- package/dist/cargo-retention-hook.d.ts +8 -1
- package/dist/cargo-retention-hook.d.ts.map +1 -1
- package/dist/cargo-retention-hook.js +12 -1
- package/dist/ensure-built-receipt.d.ts +9 -0
- package/dist/ensure-built-receipt.d.ts.map +1 -1
- package/dist/ensure-built-receipt.js +42 -1
- package/dist/executors/bounded-exec/cpu-pool-thread.d.ts +28 -0
- package/dist/executors/bounded-exec/cpu-pool-thread.d.ts.map +1 -0
- package/dist/executors/bounded-exec/cpu-pool-thread.js +20 -0
- package/dist/executors/bounded-exec/cpu-pool.d.ts +4 -4
- package/dist/executors/bounded-exec/cpu-pool.d.ts.map +1 -1
- package/dist/executors/bounded-exec/cpu-pool.js +7 -6
- package/dist/executors/bounded-exec/executor.d.ts.map +1 -1
- package/dist/executors/bounded-exec/executor.js +20 -2
- package/dist/executors/bounded-exec/gateway-lease.d.ts +3 -2
- package/dist/executors/bounded-exec/gateway-lease.d.ts.map +1 -1
- package/dist/executors/bounded-exec/gateway-lease.js +23 -3
- package/dist/executors/bounded-exec/hang-diagnostics.d.ts.map +1 -1
- package/dist/executors/bounded-exec/hang-diagnostics.js +25 -1
- package/dist/executors/bounded-exec/lease-wait.d.ts +23 -2
- package/dist/executors/bounded-exec/lease-wait.d.ts.map +1 -1
- package/dist/executors/bounded-exec/lease-wait.js +15 -11
- package/dist/executors/bounded-exec/mbx-pool.d.ts +31 -0
- package/dist/executors/bounded-exec/mbx-pool.d.ts.map +1 -0
- package/dist/executors/bounded-exec/mbx-pool.js +24 -0
- package/dist/executors/bounded-exec/run-cpu-pool.d.ts +9 -3
- package/dist/executors/bounded-exec/run-cpu-pool.d.ts.map +1 -1
- package/dist/executors/bounded-exec/run-cpu-pool.js +109 -12
- package/dist/executors/bounded-exec/verdict.d.ts +8 -0
- package/dist/executors/bounded-exec/verdict.d.ts.map +1 -1
- package/dist/executors/bounded-exec/verdict.js +1 -1
- package/dist/executors/typescript-emit/emit-overrides.d.ts +14 -0
- package/dist/executors/typescript-emit/emit-overrides.d.ts.map +1 -0
- package/dist/executors/typescript-emit/emit-overrides.js +24 -0
- package/dist/executors/typescript-emit/executor.d.ts.map +1 -1
- package/dist/executors/typescript-emit/executor.js +1 -19
- package/dist/managed-files/files.d.ts.map +1 -1
- package/dist/managed-files/files.js +6 -0
- package/dist/managed-files/publish-workflow.js +14 -11
- package/dist/producer-receipts.d.ts.map +1 -1
- package/dist/producer-receipts.js +441 -1
- package/managed/raw/envrc +15 -0
- package/managed/raw/tooling/direnv/developer-links.ts +12 -1
- package/managed/raw/tooling/direnv/devenv.smoo.nix +21 -8
- package/managed/raw/tooling/direnv/linked-snapshots.ts +50 -13
- package/managed/raw/tooling/direnv/setup-environment.ts +23 -11
- package/managed/raw/tooling/git-hooks/pre-push.sh +4 -1
- package/managed/raw/tooling/git-reword-commit +151 -0
- package/package.json +22 -5
- package/src/cargo-retention-hook.ts +12 -1
- package/src/ensure-built-receipt.ts +41 -0
- package/src/executors/bounded-exec/cpu-pool-thread.ts +43 -0
- package/src/executors/bounded-exec/cpu-pool.ts +7 -6
- package/src/executors/bounded-exec/executor.ts +20 -2
- package/src/executors/bounded-exec/gateway-lease.ts +17 -7
- package/src/executors/bounded-exec/hang-diagnostics.ts +28 -1
- package/src/executors/bounded-exec/lease-wait.ts +39 -12
- package/src/executors/bounded-exec/mbx-pool.ts +48 -0
- package/src/executors/bounded-exec/run-cpu-pool.ts +117 -15
- package/src/executors/bounded-exec/verdict.ts +8 -1
- package/src/executors/typescript-emit/emit-overrides.ts +24 -0
- package/src/executors/typescript-emit/executor.ts +1 -20
- package/src/managed-files/files.ts +6 -0
- package/src/managed-files/publish-workflow.ts +20 -15
- package/src/producer-receipts.ts +28 -0
- package/test-timings.json +120 -118
package/README.md
CHANGED
|
@@ -231,60 +231,61 @@ The plugin discovers Cargo workspaces beside Nx project manifests at any depth:
|
|
|
231
231
|
only grows. After each Nx run that executed a Cargo producer (an inferred target that builds, checks or tests into the
|
|
232
232
|
target directory, marked by its `cargoProducer` metadata: `cargo-test-archive`, `cargo-test`, `cargo-lint`,
|
|
233
233
|
`cargo-lint-cross`, mutation, bench, and the napi and wasm builds), the plugin's `postTasksExecution` runs its Cargo
|
|
234
|
-
retention hook, which calls `@smoothbricks/cargo-retain` for each Cargo workspace that is due for maintenance.
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
target
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
234
|
+
retention hook, which calls `@smoothbricks/cargo-retain` for each Cargo workspace that is due for maintenance. In an
|
|
235
|
+
mbx project, whose canonical environment names `MBX_CACHE_DIR` beside `MBX_TARGET_VIEWS=1`, the targets are mbx's to
|
|
236
|
+
collect and the hook does nothing. Automatic passes run at most once per 24 hours after a successful completed pass,
|
|
237
|
+
one that reclaimed in every root; its existing receipt records completion time and configuration/workspace/target
|
|
238
|
+
identity. A not-due hook reports that scheduling decision without locks, a fingerprint scan, cleanup or receipt
|
|
239
|
+
replacement. It does not claim newer outputs were inspected or the graph is unchanged. Busy, refused, invalid, foreign
|
|
240
|
+
or backward-clock receipt evidence never postpones the next attempt. The first executed producer after the interval
|
|
241
|
+
runs a current pass; cache replays, fetch and noop tasks start none. Manual preview and apply always run fresh. Due
|
|
242
|
+
passes reclaim superseded generations under `<profile>/build/<package>/<META>/`. They keep the newest generation, by
|
|
243
|
+
last use, of each unit identity of a workspace member (identity is every fingerprint field but its edges, source state
|
|
244
|
+
and toolchain, which is `rustc` and the `--sysroot` flag; integers read exactly, so a newer toolchain supersedes an
|
|
245
|
+
older one), every unit used in the last 24 hours (`-Zmtime-on-use` stamps each use; cowshed exports
|
|
246
|
+
`CARGO_UNSTABLE_MTIME_ON_USE=true` to every host shell and job of a Cargo project, and a repository outside cowshed
|
|
247
|
+
sets `[unstable] mtime-on-use = true`), and the transitive dependency closure of those across every profile, host and
|
|
248
|
+
cross alike. A root whose hash files show no stamp (none newer than its compile by more than 24 hours) reports
|
|
249
|
+
`recency-unknown: mtime-on-use off`: its last use is then only its last compile. A profile that holds a legacy layout
|
|
250
|
+
beside the current one is read for the current one, and its legacy entries are retained as `legacy-layout`. A pass
|
|
251
|
+
holds every profile's Cargo locks without waiting: one held lock skips the pass as `busy`, and a profile it cannot
|
|
252
|
+
read (unreadable fingerprint, missing `build/` or lock, or a legacy layout's records alone) refuses the whole pass, as
|
|
253
|
+
does a lock it cannot attempt at all, with the reason named: under Node, macOS takes its `flock(2)`s in-process
|
|
254
|
+
(`open(2)` with `O_EXLOCK | O_NONBLOCK`) and starts no helper, and other platforms hold them in a perl child, so a
|
|
255
|
+
sandbox that refuses to exec perl, like a lock file that cannot be opened, refuses the pass instead of failing the
|
|
256
|
+
run. The compiled CLI opens and locks through a small C wrapper (`native/flock.c`) that captures `errno` immediately.
|
|
257
|
+
Each provider's canonical refusal retains the operation, exact lock path, actual host errno and OS cause: only
|
|
258
|
+
contention is `busy`; any other failure refuses the pass. The hook only reports outcomes and never fails the run it
|
|
259
|
+
follows: whatever escapes a pass is logged as a warning, and the next workspace is still tried. It moves each
|
|
260
|
+
reclaimed generation into the profile's `.smoo-retention-trash/` under that hold, recording its inode first, and
|
|
261
|
+
unlinks it after letting go. Each proven generation gets a synchronous, non-symlink-following inode census and one
|
|
262
|
+
native recursive removal, not an awaited lstat/unlink for every artifact. The census counts internal hardlinks once;
|
|
263
|
+
the pass ledger drops an inode only when its last link is removed, so bytes freed and bytes still linked outside the
|
|
264
|
+
removed generations remain distinct. The manifest's root identity is rechecked immediately before removal. A failed
|
|
265
|
+
removal is an I/O failure, not a successful reclaim or a new completed maintenance receipt. It writes its last report
|
|
266
|
+
to `<target>/.smoo-cargo-retention.json`. Cargo's root-relative fingerprint paths distinguish cross profiles from
|
|
267
|
+
nested target roots under the lock; mixed, foreign or unprovable cross-profile roots refuse the pass rather than
|
|
268
|
+
silently dropping their dependency edges. That scan finds a nested target root (`target/cargo-lint`,
|
|
269
|
+
`target/cargo-lint-cross`) by locking and reading its depth-two profile like the target's own, so a pass held or
|
|
270
|
+
refused there reaches no nested root. Each nested root then gets the same pass over its own profiles, host and cross,
|
|
271
|
+
under only their Cargo locks and the target's one retention lock, one root after another: units never depend across
|
|
272
|
+
roots, so a nested root that is held (a lint running into it) or refused is skipped and reported in the receipt's
|
|
273
|
+
`nestedRoots` without holding up the others, and the receipt schedules the next automatic pass only when every root
|
|
274
|
+
reclaimed. Only generations are reclaimed, never a root or a profile, and a nested root holding no unit of a workspace
|
|
275
|
+
member is retained whole as `foreign-root`. A pre-created target need not carry Cargo's optional backup tag; a present
|
|
276
|
+
but invalid tag still refuses the pass. Every pass still reads the current fingerprint graph. The locked scan reuses
|
|
277
|
+
directory-entry types and reads its small metadata files synchronously, avoiding duplicate stats and one asynchronous
|
|
278
|
+
dispatch per tiny file; it does not walk retained artifact contents or reuse an earlier graph that could miss in-place
|
|
279
|
+
recompiles. `cargo-retention` runs that package's native `smoo-nx-cargo-retain` executable to preview the same
|
|
280
|
+
selection, nested roots included, without changing anything. Each profile's `incremental/<crate>-<id>/` directories go
|
|
281
|
+
in the same pass: rustc keeps one per build variant and never removes the one a feature, profile or flag change
|
|
282
|
+
superseded. One is kept while its newest finished session started inside the compile window (`invoked.timestamp` to
|
|
283
|
+
the hash file's last write) of a kept unit of the same crate, while it started within the recent-use window, or while
|
|
284
|
+
the directory holds an unfinished or unreadable session. The split-debuginfo objects rustc keeps inside current
|
|
285
|
+
generations (rust-lang/rust#161824) are not reclaimed, so a target directory is not bounded by them. Empty fingerprint
|
|
286
|
+
hashes are kept as unfinished compilations. The preservation proof covers Cargo's current unit and dependency records,
|
|
287
|
+
not every debug reference in copied binaries or other checkouts. In particular, a binary copied up before a failed
|
|
288
|
+
link can outlive the generation its debug map names; this pass does not establish that machine-wide debug closure.
|
|
288
289
|
- **Scheduling:** inference never throttles Nx. It sets no `parallelism: false` or `parallel: false`, no cap, and no
|
|
289
290
|
edge whose only purpose is keeping two cargo writers off one `target/`: Cargo owns that lock, and a second process
|
|
290
291
|
waits inside cargo. An edge states a real consumer — fetch before frozen cargo, the archive before the runners,
|
|
@@ -2276,11 +2277,22 @@ instead of each sizing its runner to the whole host. Its scope is one run. A com
|
|
|
2276
2277
|
as configured, sized only by the ceilings it inherits, and nothing is said; a cowshed job's own jobserver fifo still
|
|
2277
2278
|
reaches it by Cargo's own rule ("Cargo reads its holder's jobserver").
|
|
2278
2279
|
|
|
2280
|
+
The pool runs on a worker thread of its own (`cpu-pool-thread.ts`). The process that serves the run, the Nx daemon when
|
|
2281
|
+
installed plugins load in it or the Nx CLI without one, hashes tasks and builds the project graph in synchronous calls
|
|
2282
|
+
on its main thread; a pool on that thread wrote no heartbeat behind a 14.2 s `hashPlans`, and every runner queued on it
|
|
2283
|
+
failed `SILENT` while it was alive. Under Bun, which tests the source, the thread takes the transform preload the
|
|
2284
|
+
package's bunfig names, since a Bun worker starts without its parent's preloads. The `test-pool-silence` target proves
|
|
2285
|
+
the thread: a runner in another process, queued on a 1-token run pool, stays queued while the test's own thread blocks
|
|
2286
|
+
for 20 s, and is granted when the holder returns its token. Its file is not `*.test.ts`, so the shards skip its
|
|
2287
|
+
real-time waits.
|
|
2288
|
+
|
|
2279
2289
|
CPU admission connects and sends within the 5 s control bound, then waits for the queue acknowledgement and grant under
|
|
2280
2290
|
15 s of actor silence, not a total queue deadline (`specs/cowshed/05_gateway.md`, "Deadlines"). A queued reply past 2 s
|
|
2281
2291
|
is accepted; the disk gateway's old-protocol half-close is not CPU admission policy. While tokens are held, the pool
|
|
2282
|
-
actor sends an advancing heartbeat every 5 s, so a live queue waits until tokens return.
|
|
2283
|
-
|
|
2292
|
+
actor sends an advancing heartbeat every 5 s, so a live queue waits until tokens return. The queue acknowledgement names
|
|
2293
|
+
the pid of the process the pool runs in. A silent actor fails admission as `SILENT` with its endpoint, that pid, bound,
|
|
2294
|
+
waited time and last progress, and the refused run's verdict record keeps the failure as its typed `cpuWait` row; the
|
|
2295
|
+
command never runs outside the pool.
|
|
2284
2296
|
|
|
2285
2297
|
A granted executor serves a private `BOUNDED_EXEC_CPU_POOL` with its actual token count, and the same count as a make
|
|
2286
2298
|
jobserver fifo beside it: `g − 1` token bytes, the command holding the implicit first, which the pool lends a socket
|
package/dist/.build-inputs.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"packages/nx-plugin/src/cargo-build-script-env.ts": "e5b45ccefc2255cd8a48121eb97132a08e136b4cbbc375d04c940d821a429b23",
|
|
16
16
|
"packages/nx-plugin/src/cargo-closure-input.ts": "6f16430ec0b8949c33337353280372a7258a22d19c79ea3d3dd6bb47acb6fa0d",
|
|
17
17
|
"packages/nx-plugin/src/cargo-dev-profile.ts": "34764ba4fc2aeebe75051c98c2eb64b6baeaa3d8cc0242803081ef935465368d",
|
|
18
|
-
"packages/nx-plugin/src/cargo-retention-hook.ts": "
|
|
18
|
+
"packages/nx-plugin/src/cargo-retention-hook.ts": "8666d49b18227b9793d90f68bd5162d8071ed6b9f004be781852b1c74d5adbe1",
|
|
19
19
|
"packages/nx-plugin/src/cargo-source-hash.ts": "1d72427cb2c7d9038c9452db958d14cbb5017d633f40590093654b474b71cb8e",
|
|
20
20
|
"packages/nx-plugin/src/cargo-toolchain-paths.ts": "3f91da4c07394e47205093874b3d46e888c2e53ab735bbea2b64d660c2611469",
|
|
21
21
|
"packages/nx-plugin/src/cargo-toolchain-policy.ts": "715a743a9922fa1f3be4301bbecee5ed5c1c00c7e9fa6eec0ce9ef9b384fad04",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"packages/nx-plugin/src/cross-check-policy.ts": "fc45eefdcf7ea3975affb4b89d91093b9cbfc3504756103a18353aef3a264db6",
|
|
24
24
|
"packages/nx-plugin/src/deploy-policy.ts": "8456e2f896c489e5f4905383a0294d1b7a33c2d95c5ca718458cc40ed8672c5c",
|
|
25
25
|
"packages/nx-plugin/src/disk-command-policy.ts": "fb8731ccf41cff47b88f30165b08dc8d551068c436f4e49cb2b62aa4b49be43c",
|
|
26
|
-
"packages/nx-plugin/src/ensure-built-receipt.ts": "
|
|
26
|
+
"packages/nx-plugin/src/ensure-built-receipt.ts": "f80084d91d37c5132822bf26b45e6a9ae35e54e366cedbb9d69a2abd663ca419",
|
|
27
27
|
"packages/nx-plugin/src/ensure-built-witness.ts": "428b3bde289d4f10cdc2b2442a84ebc653f3da8955f9ea596dddf3c759029b1c",
|
|
28
28
|
"packages/nx-plugin/src/ensure-built.ts": "cced1cdc9090c820320492c6bf40b853dd02e461651484193af89dc29173984f",
|
|
29
29
|
"packages/nx-plugin/src/eslint-config-closure.ts": "0cd5a9da34df914c2d6033b7d3de49728cd71229065a2e1b43dba923001e0826",
|
|
@@ -31,13 +31,15 @@
|
|
|
31
31
|
"packages/nx-plugin/src/executors/all-verdicts/executor.ts": "e8abe81c29074b6517a6251cc1c1ee87ba126d6f0959e182a9dd46b5a977ce6d",
|
|
32
32
|
"packages/nx-plugin/src/executors/all-verdicts/schema.ts": "9d2372b64ec77ae82b686df68a2843c11268920064909aa871edc538414ef13c",
|
|
33
33
|
"packages/nx-plugin/src/executors/bounded-exec/bounds.ts": "bb192e95fe56659e958c200282b9248653ea350e61dcb1eb84065b6e1b746c2b",
|
|
34
|
-
"packages/nx-plugin/src/executors/bounded-exec/cpu-pool.ts": "
|
|
34
|
+
"packages/nx-plugin/src/executors/bounded-exec/cpu-pool-thread.ts": "4b914385f7ab73cfb3afdc75c0e3c462e7c103c5061f7f7720d7b95f6655e32d",
|
|
35
|
+
"packages/nx-plugin/src/executors/bounded-exec/cpu-pool.ts": "a4be1280a0ea4b5aa0f04170ce75ce4b813631264c50fab5cdd05d34926fc890",
|
|
35
36
|
"packages/nx-plugin/src/executors/bounded-exec/disk-lease.ts": "1a3f6a6fa590d9a2550490bb6906dc91b6c05fbef235b025eaf257eb5310e92d",
|
|
36
|
-
"packages/nx-plugin/src/executors/bounded-exec/executor.ts": "
|
|
37
|
-
"packages/nx-plugin/src/executors/bounded-exec/gateway-lease.ts": "
|
|
38
|
-
"packages/nx-plugin/src/executors/bounded-exec/hang-diagnostics.ts": "
|
|
39
|
-
"packages/nx-plugin/src/executors/bounded-exec/lease-wait.ts": "
|
|
37
|
+
"packages/nx-plugin/src/executors/bounded-exec/executor.ts": "0d1284c1f3e9718a2b2ff5d7139b048cae7d9a7fe3db96d01110bf0937a7ecfc",
|
|
38
|
+
"packages/nx-plugin/src/executors/bounded-exec/gateway-lease.ts": "f3f73bd92db30e4857f98fb8bd2b9a75b2a5a2a318f094e075ed803c1f9a0117",
|
|
39
|
+
"packages/nx-plugin/src/executors/bounded-exec/hang-diagnostics.ts": "56a6997611b23eb5f603672e73b58f212558e5255f69b65332734516ad37fe9d",
|
|
40
|
+
"packages/nx-plugin/src/executors/bounded-exec/lease-wait.ts": "59d8ac94d0b8b75858971c5bb28ee421fca4f7685577274fe8bbaf0c01ba462a",
|
|
40
41
|
"packages/nx-plugin/src/executors/bounded-exec/lock-wait.ts": "b14a23b49759a777f4b3338ced003adaf76837c2c38462458f76a7fef1b95d9e",
|
|
42
|
+
"packages/nx-plugin/src/executors/bounded-exec/mbx-pool.ts": "ed35855d8c989358e78a8487b47658319d38efd52f4b1b9a3e95d74dee4002b8",
|
|
41
43
|
"packages/nx-plugin/src/executors/bounded-exec/no-space.ts": "ec032968d89f9e853796012705a06c06cfc4da54bf6e6f10a526f98daca3d077",
|
|
42
44
|
"packages/nx-plugin/src/executors/bounded-exec/owned-subtree.ts": "cb5edf2b5fe2c1b5b961f8c0ff16ec7bfae3c22ad75dfd671b74f1a4a865863f",
|
|
43
45
|
"packages/nx-plugin/src/executors/bounded-exec/progress.ts": "353f415cc869fca65a75e5e89bd826292e1421ce1609002e4e47477cbb5ea6b4",
|
|
@@ -46,13 +48,13 @@
|
|
|
46
48
|
"packages/nx-plugin/src/executors/bounded-exec/ram-temp-fixtures.ts": "075da4ecfd1cf7dd98fc8c894599dcf2720faba07ac30b8e5592964178849359",
|
|
47
49
|
"packages/nx-plugin/src/executors/bounded-exec/ram-temp-held.ts": "7c32555bc6dab3f767925b55b68684d33a69393050342d06f055fb81e8e5332b",
|
|
48
50
|
"packages/nx-plugin/src/executors/bounded-exec/ram-temp.ts": "8d66e6ac13c4ccf6172586b9857d5114b48e027bdcb305f94f6828076c1f7eb4",
|
|
49
|
-
"packages/nx-plugin/src/executors/bounded-exec/run-cpu-pool.ts": "
|
|
51
|
+
"packages/nx-plugin/src/executors/bounded-exec/run-cpu-pool.ts": "3fc4bfe04862a756d9f74743e399d902a6ce6052a0a3ff4e7edf17f875f33266",
|
|
50
52
|
"packages/nx-plugin/src/executors/bounded-exec/runner-hook.ts": "606eab5db826e571eb15df618315e01cc773d09fd647beb1c00f6434df58ffad",
|
|
51
53
|
"packages/nx-plugin/src/executors/bounded-exec/runner-lifecycle.ts": "dc5c10634b8ccda82c71887bf55aaa67f322b1dace53383d45bd8863469af8a1",
|
|
52
54
|
"packages/nx-plugin/src/executors/bounded-exec/runner-sizing.ts": "bb8ecbc6acad99e077885ef096f61bf04fe017aa4184c34c98a578c3d3ef5a93",
|
|
53
55
|
"packages/nx-plugin/src/executors/bounded-exec/runtime-pin.ts": "8e7fecaf6dd01ce6e065020f8c87edfcdc04e995934e018ab3b69b36acdc5e4f",
|
|
54
56
|
"packages/nx-plugin/src/executors/bounded-exec/schema.ts": "18c2b0b6e8c5377f3cd520798da26a0fe2d04ebc35e16035af6432b85d038a2c",
|
|
55
|
-
"packages/nx-plugin/src/executors/bounded-exec/verdict.ts": "
|
|
57
|
+
"packages/nx-plugin/src/executors/bounded-exec/verdict.ts": "c9b6746839602f14d92c48b9013e86d1fa4c3dd5446384146c7c22d1fd7b712c",
|
|
56
58
|
"packages/nx-plugin/src/executors/cargo-zigbuild/executor.ts": "d20b73cc90ae1a9c3f96996cdde4d97347395ca875c4801ab67842ec89f9acd7",
|
|
57
59
|
"packages/nx-plugin/src/executors/cargo-zigbuild/schema.ts": "e5cf3b0cc91a2d003a63ca0c9a93f1ec08263469b8a19dbe338b2dc0c0810747",
|
|
58
60
|
"packages/nx-plugin/src/executors/clean-outputs/executor.ts": "acf82d9560451d76d9357217f5f57645135a393a6deadf8f217b57b481022c46",
|
|
@@ -62,7 +64,8 @@
|
|
|
62
64
|
"packages/nx-plugin/src/executors/scriptc-native/schema.ts": "41e48a9032ce93b2e6965861c73776e23015f44a0ebd1e011a0786e17b22a108",
|
|
63
65
|
"packages/nx-plugin/src/executors/shard-timings/executor.ts": "b5a84156fe2b71022603990a9c3e7721de7995987770b14ae60bd7e8117b1adf",
|
|
64
66
|
"packages/nx-plugin/src/executors/shard-timings/schema.ts": "e509fc7be7a5752f1636f3006440e747d8381c40a46229627b11d7cdad633f69",
|
|
65
|
-
"packages/nx-plugin/src/executors/typescript-emit/
|
|
67
|
+
"packages/nx-plugin/src/executors/typescript-emit/emit-overrides.ts": "3021aeb756492632d3e5da7a7ae15dded0a9399f73734c0d1fea1c69a2bd4b85",
|
|
68
|
+
"packages/nx-plugin/src/executors/typescript-emit/executor.ts": "efea02d08b3112d1927562f09dd8641d8a5e1653af876d89314e35fc381e6a53",
|
|
66
69
|
"packages/nx-plugin/src/executors/typescript-emit/schema.ts": "20edee20fee80198bbfbb743848d4ac3e41e734050abd511fceafcea9cd6da28",
|
|
67
70
|
"packages/nx-plugin/src/forbidden-spelling-policy.ts": "d6c2c17665770432e53ae4b49986dc88eb8e5205be915c6baf34cd819ca9470c",
|
|
68
71
|
"packages/nx-plugin/src/generators/bounded-test-targets/generator.ts": "fd77c72df6c8457f25c73e512546229ef11001974cba0a05d8700e523d990131",
|
|
@@ -78,7 +81,7 @@
|
|
|
78
81
|
"packages/nx-plugin/src/managed-assets.ts": "9cea959c09f3163992e666eecc5a65ec1f1b63c81fc56c5e99088507d02c5e3b",
|
|
79
82
|
"packages/nx-plugin/src/managed-files/ci-workflow.ts": "2d64d689e999af20d65cc21b4803659a835a6eb5340e8d3f896cb0c74e6a0878",
|
|
80
83
|
"packages/nx-plugin/src/managed-files/context.ts": "5b83c000322382cb781df4f415f3759388e69686b76779599572a62a5c4dd28c",
|
|
81
|
-
"packages/nx-plugin/src/managed-files/files.ts": "
|
|
84
|
+
"packages/nx-plugin/src/managed-files/files.ts": "468d462da82cf0c3b8bb5db736cb3c06203c2cf8f9bc6cebe70ca52eb6fdac5f",
|
|
82
85
|
"packages/nx-plugin/src/managed-files/generator.ts": "8cf1a1b121645c5ead86c163c9da03f612efb2fff6aabed3ea858d87d6cbd0b3",
|
|
83
86
|
"packages/nx-plugin/src/managed-files/github-runs-on.ts": "a049ca60a79dec57f77e5d18090569a9b8b78818219f236fe352e7705500f531",
|
|
84
87
|
"packages/nx-plugin/src/managed-files/json-edit.ts": "81bc6dd10fffff583cc9f2269f0c2fd2f76b1c5aedbc7d068cf29878371497c2",
|
|
@@ -87,7 +90,7 @@
|
|
|
87
90
|
"packages/nx-plugin/src/managed-files/paths.ts": "0727cde9a3eea88420290b63cb4c9a3ffab857b39e0411eed3c4ddeb4e563745",
|
|
88
91
|
"packages/nx-plugin/src/managed-files/pr-preview-cleanup-workflow.ts": "0f34805a6d737f364c23801da62aefcd4afdc7ba87e911019dd6301be640b385",
|
|
89
92
|
"packages/nx-plugin/src/managed-files/private-npm-policy.ts": "795882f98b2c2434e7c0115e93a7b4c0da6142ae0602274b362893c49a46d5a7",
|
|
90
|
-
"packages/nx-plugin/src/managed-files/publish-workflow.ts": "
|
|
93
|
+
"packages/nx-plugin/src/managed-files/publish-workflow.ts": "3552ac2aef74447e5b2e0681aa62d7ff35cbf348993a23e5d69834bc9668e8c6",
|
|
91
94
|
"packages/nx-plugin/src/managed-files/tree.ts": "a6b7dc515796a3824199938ce70af7d2b45347ed32064b487f3d5f381509dc54",
|
|
92
95
|
"packages/nx-plugin/src/manifest-hash.ts": "26cb2598853801cf70785386e1847feba7f04780b43809597004b7fb7ecbc2b6",
|
|
93
96
|
"packages/nx-plugin/src/nextest-code-bound.ts": "e1036934a35f1b65e0f43bddbea259e01a1100e553cdeaefc2db8823a4517340",
|
|
@@ -100,7 +103,7 @@
|
|
|
100
103
|
"packages/nx-plugin/src/process-children.ts": "eb59f25c02213942b85c16f9f758acf37112b5a5a550152c80656dc1ffcf8b30",
|
|
101
104
|
"packages/nx-plugin/src/process-group.ts": "2fcfb039c7dd2467319eb7377a3097b2ef7296ad31183595d0c98c1c2ead1189",
|
|
102
105
|
"packages/nx-plugin/src/process-listing.ts": "70e7b75d1dda4e813d6fd43800f38ea890cd816fd9b652dfb2eae4b598ff9e46",
|
|
103
|
-
"packages/nx-plugin/src/producer-receipts.ts": "
|
|
106
|
+
"packages/nx-plugin/src/producer-receipts.ts": "7b3bc6ad60333015e35861da1d85443cc7954cd08cde8488e863aa856f120490",
|
|
104
107
|
"packages/nx-plugin/src/release-config-policy.ts": "850fefcddefff6a76c596abea4d9e569f932fd3f94782b26ac6c8e29e3ac4c98",
|
|
105
108
|
"packages/nx-plugin/src/runtime-input-policy.ts": "a16545693909fa9b8271af51f73570b392c5c99a864bfd1eae4db40775e1d53f",
|
|
106
109
|
"packages/nx-plugin/src/runtime-input.ts": "56e748e0b7835d65efbb3be109c201bb4f10dc601a7ac5c8a8a51521501329a7",
|
|
@@ -7,11 +7,18 @@ import type { PostTasksExecutionContext } from 'nx/src/project-graph/plugins/pub
|
|
|
7
7
|
export declare const CARGO_PRODUCER_METADATA: {
|
|
8
8
|
readonly cargoProducer: true;
|
|
9
9
|
};
|
|
10
|
+
/**
|
|
11
|
+
* Whether the run's environment is an mbx project's canonical one, which names the shared store beside mbx-managed
|
|
12
|
+
* target views (specs/cowshed/11_shell.md, "Canonical mbx environment"). Such a project's targets are mbx's to collect,
|
|
13
|
+
* so the plugin retains and purges nothing in them (specs/cowshed/16_build_volumes.md, "Migration" step 4).
|
|
14
|
+
*/
|
|
15
|
+
export declare function mbxManagesTargets(environment: Readonly<NodeJS.ProcessEnv>): boolean;
|
|
10
16
|
/**
|
|
11
17
|
* After a run that executed a Cargo producer task ({@link CARGO_PRODUCER_METADATA}), check whether
|
|
12
18
|
* each Cargo workspace is due for its daily maintenance. A successful receipt schedules only;
|
|
13
19
|
* every due pass reads the current graph under Cargo's locks and is awaited by this Nx process.
|
|
14
|
-
* Maintenance never fails the run it follows: every outcome, a refused or busy pass included, is only reported.
|
|
20
|
+
* Maintenance never fails the run it follows: every outcome, a refused or busy pass included, is only reported. In an
|
|
21
|
+
* mbx project ({@link mbxManagesTargets}) it does nothing.
|
|
15
22
|
*/
|
|
16
23
|
export declare function postTasksExecution(_options: unknown, context: PostTasksExecutionContext): Promise<void>;
|
|
17
24
|
//# sourceMappingURL=cargo-retention-hook.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cargo-retention-hook.d.ts","sourceRoot":"","sources":["../src/cargo-retention-hook.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,4CAA4C,CAAC;AAuB5F;;;;GAIG;AACH,eAAO,MAAM,uBAAuB;aAAK,aAAa;CAAiB,CAAC;AAExE
|
|
1
|
+
{"version":3,"file":"cargo-retention-hook.d.ts","sourceRoot":"","sources":["../src/cargo-retention-hook.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,4CAA4C,CAAC;AAuB5F;;;;GAIG;AACH,eAAO,MAAM,uBAAuB;aAAK,aAAa;CAAiB,CAAC;AAExE;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,OAAO,CAEnF;AAED;;;;;;GAMG;AACH,wBAAsB,kBAAkB,CAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,yBAAyB,GAAG,OAAO,CAAC,IAAI,CAAC,CA8C7G"}
|
|
@@ -25,13 +25,24 @@ function ran(status) {
|
|
|
25
25
|
* another language or a cache-restored replay wrote nothing there.
|
|
26
26
|
*/
|
|
27
27
|
export const CARGO_PRODUCER_METADATA = { cargoProducer: true };
|
|
28
|
+
/**
|
|
29
|
+
* Whether the run's environment is an mbx project's canonical one, which names the shared store beside mbx-managed
|
|
30
|
+
* target views (specs/cowshed/11_shell.md, "Canonical mbx environment"). Such a project's targets are mbx's to collect,
|
|
31
|
+
* so the plugin retains and purges nothing in them (specs/cowshed/16_build_volumes.md, "Migration" step 4).
|
|
32
|
+
*/
|
|
33
|
+
export function mbxManagesTargets(environment) {
|
|
34
|
+
return Boolean(environment.MBX_CACHE_DIR) && environment.MBX_TARGET_VIEWS === '1';
|
|
35
|
+
}
|
|
28
36
|
/**
|
|
29
37
|
* After a run that executed a Cargo producer task ({@link CARGO_PRODUCER_METADATA}), check whether
|
|
30
38
|
* each Cargo workspace is due for its daily maintenance. A successful receipt schedules only;
|
|
31
39
|
* every due pass reads the current graph under Cargo's locks and is awaited by this Nx process.
|
|
32
|
-
* Maintenance never fails the run it follows: every outcome, a refused or busy pass included, is only reported.
|
|
40
|
+
* Maintenance never fails the run it follows: every outcome, a refused or busy pass included, is only reported. In an
|
|
41
|
+
* mbx project ({@link mbxManagesTargets}) it does nothing.
|
|
33
42
|
*/
|
|
34
43
|
export async function postTasksExecution(_options, context) {
|
|
44
|
+
if (mbxManagesTargets(process.env))
|
|
45
|
+
return;
|
|
35
46
|
const executed = Object.values(context.taskResults).filter(({ status }) => ran(status));
|
|
36
47
|
if (executed.length === 0)
|
|
37
48
|
return;
|
|
@@ -58,6 +58,15 @@ export declare function captureProducerSources(root: string, targets: ReadonlyMa
|
|
|
58
58
|
export declare function producerSourceUnchanged(root: string, before: ProducerSourceWitness): ReceiptEvidence<true>;
|
|
59
59
|
/** Enumerate exact public nodes; never exempt a broad directory of tracked source. */
|
|
60
60
|
export declare function producerOutputPaths(root: string, tasks: readonly Task[], expand: typeof expandOutputs): string[];
|
|
61
|
+
/**
|
|
62
|
+
* Remove what a producer's previous receipt declared as task outputs and its current task graph no longer declares,
|
|
63
|
+
* inside the declaring task's project root. A layout change (an output moved, a target renamed) otherwise leaves the
|
|
64
|
+
* old layout's files where a package's published `files` still packs them, so a consumer's capture hashes them as the
|
|
65
|
+
* producer's tools and ships them. A previously declared directory that holds a currently declared output loses only
|
|
66
|
+
* its other entries. A previous task that left this graph while its target still exists is not this producer's to
|
|
67
|
+
* clean: `defined` says whether a task's target still exists. Returns the removed paths, relative to `root`.
|
|
68
|
+
*/
|
|
69
|
+
export declare function removeOrphanedOutputs(root: string, previous: readonly Task[], current: readonly Task[], expand: typeof expandOutputs, defined: (task: Task) => boolean): string[];
|
|
61
70
|
export declare function providerReceipt(root: string, taskId: string, tasks: readonly Task[], proof: ProviderInputProof, expand: typeof expandOutputs, source: ProducerSourceWitness, producer: Omit<EnsureBuiltProducerReceipt, 'outputSha256'>): {
|
|
62
71
|
readonly disposition: 'hit';
|
|
63
72
|
readonly receipt: EnsureBuiltReceipt;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ensure-built-receipt.d.ts","sourceRoot":"","sources":["../src/ensure-built-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B,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,IAAI,EAAE,EAAE,MAAM,EAAE,OAAO,aAAa,GAAG,MAAM,EAAE,CAiBhH;AACD;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,SAAS,IAAI,EAAE,EACzB,OAAO,EAAE,SAAS,IAAI,EAAE,EACxB,MAAM,EAAE,OAAO,aAAa,EAC5B,OAAO,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,GAC/B,MAAM,EAAE,CAyBV;AACD,wBAAgB,eAAe,CAC7B,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,SAAS,IAAI,EAAE,EACtB,KAAK,EAAE,kBAAkB,EACzB,MAAM,EAAE,OAAO,aAAa,EAC5B,MAAM,EAAE,qBAAqB,EAC7B,QAAQ,EAAE,IAAI,CAAC,0BAA0B,EAAE,cAAc,CAAC,GACzD;IAAE,QAAQ,CAAC,WAAW,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,kBAAkB,CAAA;CAAE,GAAG,uBAAuB,CAyFjG;AACD,2IAA2I;AAC3I,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,EAC5C,WAAW,EAAE,SAAS,MAAM,EAAE,EAC9B,KAAK,EAAE,SAAS,MAAM,EAAE,EACxB,kBAAkB,EAAE,OAAO,GAC1B,kBAAkB,CAAC,eAAe,CAAC,CAsBrC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { spawnSync } from 'node:child_process';
|
|
2
2
|
import { createHash } from 'node:crypto';
|
|
3
|
-
import { closeSync, lstatSync, openSync, readdirSync, readFileSync, readlinkSync, readSync, realpathSync, } from 'node:fs';
|
|
3
|
+
import { closeSync, lstatSync, openSync, readdirSync, readFileSync, readlinkSync, readSync, realpathSync, rmSync, } from 'node:fs';
|
|
4
4
|
import { isAbsolute, join, relative } from 'node:path';
|
|
5
5
|
import { CARGO_TOOLCHAIN_PIN_INPUTS, cargoRuntimeInput, cargoToolchainPathsInput } from './cargo-toolchain-policy.js';
|
|
6
6
|
import { censusStart, directoryMembers, movedNodes, recordedStamp, } from './ensure-built-witness.js';
|
|
@@ -352,6 +352,47 @@ export function producerOutputPaths(root, tasks, expand) {
|
|
|
352
352
|
visit(path);
|
|
353
353
|
return [...paths].sort();
|
|
354
354
|
}
|
|
355
|
+
/**
|
|
356
|
+
* Remove what a producer's previous receipt declared as task outputs and its current task graph no longer declares,
|
|
357
|
+
* inside the declaring task's project root. A layout change (an output moved, a target renamed) otherwise leaves the
|
|
358
|
+
* old layout's files where a package's published `files` still packs them, so a consumer's capture hashes them as the
|
|
359
|
+
* producer's tools and ships them. A previously declared directory that holds a currently declared output loses only
|
|
360
|
+
* its other entries. A previous task that left this graph while its target still exists is not this producer's to
|
|
361
|
+
* clean: `defined` says whether a task's target still exists. Returns the removed paths, relative to `root`.
|
|
362
|
+
*/
|
|
363
|
+
export function removeOrphanedOutputs(root, previous, current, expand, defined) {
|
|
364
|
+
const declared = current.flatMap((task) => expand(root, task.outputs));
|
|
365
|
+
const currentIds = new Set(current.map((task) => task.id));
|
|
366
|
+
const removed = [];
|
|
367
|
+
function prune(path) {
|
|
368
|
+
if (declared.some((output) => path === output || path.startsWith(`${output}/`)))
|
|
369
|
+
return;
|
|
370
|
+
const stats = lstatSync(join(root, path), { throwIfNoEntry: false });
|
|
371
|
+
if (stats === undefined)
|
|
372
|
+
return;
|
|
373
|
+
if (!declared.some((output) => output.startsWith(`${path}/`))) {
|
|
374
|
+
rmSync(join(root, path), { recursive: true, force: true });
|
|
375
|
+
removed.push(path);
|
|
376
|
+
return;
|
|
377
|
+
}
|
|
378
|
+
if (stats.isDirectory())
|
|
379
|
+
for (const name of readdirSync(join(root, path)))
|
|
380
|
+
prune(join(path, name));
|
|
381
|
+
}
|
|
382
|
+
for (const task of previous) {
|
|
383
|
+
if (!currentIds.has(task.id) && defined(task))
|
|
384
|
+
continue;
|
|
385
|
+
const project = task.projectRoot ?? '';
|
|
386
|
+
for (const output of expand(root, task.outputs)) {
|
|
387
|
+
if (isAbsolute(output) || output.split('/').includes('..'))
|
|
388
|
+
continue;
|
|
389
|
+
if (project !== '' && project !== '.' && output !== project && !output.startsWith(`${project}/`))
|
|
390
|
+
continue;
|
|
391
|
+
prune(output);
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
return removed.sort();
|
|
395
|
+
}
|
|
355
396
|
export function providerReceipt(root, taskId, tasks, proof, expand, source, producer) {
|
|
356
397
|
const failed = (detail) => ({
|
|
357
398
|
disposition: 'failed',
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type CloseOutcome } from './cpu-pool.js';
|
|
2
|
+
/**
|
|
3
|
+
* The thread an Nx run's CPU pool runs on (`run-cpu-pool.ts`; specs/cowshed/05_gateway.md, "Every Nx run budgets
|
|
4
|
+
* itself"). The process that serves a run's pool, the Nx daemon when installed plugins load in it or the Nx CLI without
|
|
5
|
+
* one, hashes tasks and builds the project graph in synchronous calls on its main thread. A pool there writes no
|
|
6
|
+
* heartbeat while one runs, and every runner queued on it fails `SILENT` while it still works. Here the pool's socket,
|
|
7
|
+
* jobserver fifo and heartbeat share an event loop that runs nothing else, so the heartbeat proves that the actor which
|
|
8
|
+
* admits and grants is turning.
|
|
9
|
+
*
|
|
10
|
+
* The thread is started with the pool's count. It says once that the pool serves, with the environment a task inherits,
|
|
11
|
+
* or why it cannot; the host's one message is its close, after which the thread says how the pool closed.
|
|
12
|
+
*/
|
|
13
|
+
/** What the thread is started with. */
|
|
14
|
+
export interface CpuPoolThreadData {
|
|
15
|
+
readonly tokens: number;
|
|
16
|
+
}
|
|
17
|
+
/** What the thread says, in order: the pool serves or failed; after the host's close, how the pool closed. */
|
|
18
|
+
export type CpuPoolThreadReport = {
|
|
19
|
+
readonly kind: 'serving';
|
|
20
|
+
readonly environment: Record<string, string>;
|
|
21
|
+
} | {
|
|
22
|
+
readonly kind: 'failed';
|
|
23
|
+
readonly error: string;
|
|
24
|
+
} | {
|
|
25
|
+
readonly kind: 'closed';
|
|
26
|
+
readonly outcome: CloseOutcome;
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=cpu-pool-thread.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cpu-pool-thread.d.ts","sourceRoot":"","sources":["../../../src/executors/bounded-exec/cpu-pool-thread.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,YAAY,EAAiB,MAAM,eAAe,CAAC;AAEjE;;;;;;;;;;GAUG;AAEH,uCAAuC;AACvC,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,8GAA8G;AAC9G,MAAM,MAAM,mBAAmB,GAC3B;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,GAC1E;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACnD;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,YAAY,CAAA;CAAE,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { parentPort, workerData } from 'node:worker_threads';
|
|
2
|
+
import { createCpuPool } from './cpu-pool.js';
|
|
3
|
+
const host = parentPort;
|
|
4
|
+
if (host === null) {
|
|
5
|
+
throw new Error('cpu-pool-thread runs as the worker thread run-cpu-pool starts, never as a module of its own');
|
|
6
|
+
}
|
|
7
|
+
const report = (message) => host.postMessage(message);
|
|
8
|
+
const data = workerData;
|
|
9
|
+
// The pool lives until its host closes it, or with the thread.
|
|
10
|
+
const made = await createCpuPool(data.tokens, new Promise(() => { }));
|
|
11
|
+
if (made.ok) {
|
|
12
|
+
const { pool } = made;
|
|
13
|
+
host.once('message', () => {
|
|
14
|
+
void pool.close().then((outcome) => report({ kind: 'closed', outcome }));
|
|
15
|
+
});
|
|
16
|
+
report({ kind: 'serving', environment: pool.environment });
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
report({ kind: 'failed', error: made.error });
|
|
20
|
+
}
|
|
@@ -2,8 +2,9 @@ import { type Unleased } from './gateway-lease.js';
|
|
|
2
2
|
/**
|
|
3
3
|
* A CPU pool: the tokens a process lends the runners it starts, held live rather than inherited as a
|
|
4
4
|
* bare count (specs/cowshed/05_gateway.md, "Host scheduling", "Parallelism inside a job"). An Nx run
|
|
5
|
-
* serves one (`run-cpu-pool.ts`), and every granted bounded-exec serves a
|
|
6
|
-
* its own descendants, so the runners of one build tree together stay
|
|
5
|
+
* serves one on a thread of its own (`run-cpu-pool.ts`), and every granted bounded-exec serves a
|
|
6
|
+
* sub-pool of its grant to its own descendants, so the runners of one build tree together stay
|
|
7
|
+
* within the tree's count.
|
|
7
8
|
*
|
|
8
9
|
* The pool is a private Unix socket in a directory the process owns: the directory 0700, the socket
|
|
9
10
|
* 0600. A child asks it for a count with one request line, in `holdLease`'s framing. The pool
|
|
@@ -37,7 +38,7 @@ export interface CpuPool {
|
|
|
37
38
|
*/
|
|
38
39
|
close(): Promise<CloseOutcome>;
|
|
39
40
|
}
|
|
40
|
-
type CloseOutcome = {
|
|
41
|
+
export type CloseOutcome = {
|
|
41
42
|
ok: true;
|
|
42
43
|
} | {
|
|
43
44
|
ok: false;
|
|
@@ -78,5 +79,4 @@ export declare function createCpuPool(tokens: number, closed: Promise<void>): Pr
|
|
|
78
79
|
ok: false;
|
|
79
80
|
error: string;
|
|
80
81
|
}>;
|
|
81
|
-
export {};
|
|
82
82
|
//# sourceMappingURL=cpu-pool.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cpu-pool.d.ts","sourceRoot":"","sources":["../../../src/executors/bounded-exec/cpu-pool.ts"],"names":[],"mappings":"AAQA,OAAO,EAAa,KAAK,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAI9D
|
|
1
|
+
{"version":3,"file":"cpu-pool.d.ts","sourceRoot":"","sources":["../../../src/executors/bounded-exec/cpu-pool.ts"],"names":[],"mappings":"AAQA,OAAO,EAAa,KAAK,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAI9D;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,yGAAyG;AACzG,eAAO,MAAM,YAAY,0BAA0B,CAAC;AAEpD,6FAA6F;AAC7F,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,sDAAsD;IACtD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,yFAAyF;AACzF,MAAM,WAAW,OAAO;IACtB,oFAAoF;IACpF,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7C;;;;OAIG;IACH,KAAK,IAAI,OAAO,CAAC,YAAY,CAAC,CAAC;CAChC;AAED,MAAM,MAAM,YAAY,GAAG;IAAE,EAAE,EAAE,IAAI,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AA2DvE;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,gBAAgB,GAAG,IAAI,CAOtG;AAED;;;GAGG;AACH,MAAM,MAAM,UAAU,GAAG;IAAE,OAAO,EAAE,IAAI,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,IAAI,CAAC;IAAC,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,CAAA;CAAE,GAAG,QAAQ,CAAC;AAElH;;;;;GAKG;AACH,wBAAsB,mBAAmB,CAAC,MAAM,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAyBrG;AAsJD;;;;GAIG;AACH,wBAAsB,aAAa,CACjC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,GACpB,OAAO,CAAC;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,OAAO,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,CAsUrE"}
|
|
@@ -16,8 +16,9 @@ import { CPU_TOKENS_ENV, parseInheritedTokens } from './runner-sizing.js';
|
|
|
16
16
|
/**
|
|
17
17
|
* A CPU pool: the tokens a process lends the runners it starts, held live rather than inherited as a
|
|
18
18
|
* bare count (specs/cowshed/05_gateway.md, "Host scheduling", "Parallelism inside a job"). An Nx run
|
|
19
|
-
* serves one (`run-cpu-pool.ts`), and every granted bounded-exec serves a
|
|
20
|
-
* its own descendants, so the runners of one build tree together stay
|
|
19
|
+
* serves one on a thread of its own (`run-cpu-pool.ts`), and every granted bounded-exec serves a
|
|
20
|
+
* sub-pool of its grant to its own descendants, so the runners of one build tree together stay
|
|
21
|
+
* within the tree's count.
|
|
21
22
|
*
|
|
22
23
|
* The pool is a private Unix socket in a directory the process owns: the directory 0700, the socket
|
|
23
24
|
* 0600. A child asks it for a count with one request line, in `holdLease`'s framing. The pool
|
|
@@ -49,7 +50,7 @@ const isRequest = (() => {
|
|
|
49
50
|
const stringifyReply = (() => {
|
|
50
51
|
const _ip0 = input => true === input["ok"];
|
|
51
52
|
const _so0 = input => `{"ok":${String(input.ok)},"progress":${String(_jsonStringifyNumber_1._jsonStringifyNumber(input.progress))}}`;
|
|
52
|
-
const _so1 = input => `{"ok":${String(input.ok)},"lease":${"\"" + input.lease + "\""}}`;
|
|
53
|
+
const _so1 = input => `{"ok":${String(input.ok)},"lease":${"\"" + input.lease + "\""},"server":${String(_jsonStringifyNumber_1._jsonStringifyNumber(input.server))}}`;
|
|
53
54
|
const _so2 = input => `{"ok":${String(input.ok)},"lease":${"\"" + input.lease + "\""},"tokens":${String(_jsonStringifyNumber_1._jsonStringifyNumber(input.tokens))}}`;
|
|
54
55
|
const _so3 = input => `{"ok":${String(input.ok)},"code":${"\"" + input.code + "\""},"error":${_jsonStringifyString_1._jsonStringifyString(input.error)}}`;
|
|
55
56
|
const _su0 = input => (() => {
|
|
@@ -64,12 +65,12 @@ const stringifyReply = (() => {
|
|
|
64
65
|
else
|
|
65
66
|
_throwTypeGuardError_1._throwTypeGuardError({
|
|
66
67
|
method: "typia.json.createStringify",
|
|
67
|
-
expected: "(CpuLeaseProgress |
|
|
68
|
+
expected: "(CpuLeaseProgress | CpuLeaseQueued | { ok: true; lease: \"granted\"; tokens: number; } | { ok: false; code: \"invalid-request\"; error: string; })",
|
|
68
69
|
value: input
|
|
69
70
|
});
|
|
70
71
|
})();
|
|
71
72
|
const _io0 = input => _ip0(input) && "number" === typeof input.progress;
|
|
72
|
-
const _io1 = input => _ip0(input) && "queued" === input.lease;
|
|
73
|
+
const _io1 = input => _ip0(input) && "queued" === input.lease && ("number" === typeof input.server && _isTypeUint32_1._isTypeUint32(input.server));
|
|
73
74
|
const _io2 = input => _ip0(input) && "granted" === input.lease && "number" === typeof input.tokens;
|
|
74
75
|
const _io3 = input => false === input.ok && "invalid-request" === input.code && "string" === typeof input.error;
|
|
75
76
|
return input => _su0(input);
|
|
@@ -484,7 +485,7 @@ export async function createCpuPool(tokens, closed) {
|
|
|
484
485
|
const request = parsed;
|
|
485
486
|
child.phase = { kind: 'queued' };
|
|
486
487
|
queue.push({ child, want: request.want });
|
|
487
|
-
socket.write(frame({ ok: true, lease: 'queued' }));
|
|
488
|
+
socket.write(frame({ ok: true, lease: 'queued', server: process.pid }));
|
|
488
489
|
drain(0);
|
|
489
490
|
});
|
|
490
491
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../../../src/executors/bounded-exec/executor.ts"],"names":[],"mappings":"AAgBA,OAAO,EAIL,KAAK,gBAAgB,EAItB,MAAM,eAAe,CAAC;AAGvB,OAAO,EAAE,sBAAsB,EAAmB,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../../../src/executors/bounded-exec/executor.ts"],"names":[],"mappings":"AAgBA,OAAO,EAIL,KAAK,gBAAgB,EAItB,MAAM,eAAe,CAAC;AAGvB,OAAO,EAAE,sBAAsB,EAAmB,MAAM,uBAAuB,CAAC;AAKhF,OAAO,EAOL,KAAK,YAAY,EAClB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EASL,aAAa,EAEd,MAAM,eAAe,CAAC;AAIvB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAEL,KAAK,eAAe,EAarB,MAAM,cAAc,CAAC;AAuBtB,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,wFAAwF;IACxF,MAAM,CAAC,EAAE;QAAE,IAAI,EAAE,eAAe,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC;IACtD,uFAAuF;IACvF,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CAClC;AAED,qEAAqE;AACrE,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,SAAS,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE;YAAE,IAAI,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC,CAAA;KAAE,CAAC;CAC1D;AAED,MAAM,WAAW,iB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