@smoothbricks/nx-plugin 0.7.11 → 0.7.12
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 +9 -1
- package/dist/.build-inputs.json +9 -9
- package/dist/executors/bounded-exec/cpu-pool-thread.d.ts +5 -4
- package/dist/executors/bounded-exec/cpu-pool-thread.d.ts.map +1 -1
- package/dist/executors/bounded-exec/cpu-pool.d.ts +25 -10
- package/dist/executors/bounded-exec/cpu-pool.d.ts.map +1 -1
- package/dist/executors/bounded-exec/cpu-pool.js +86 -23
- package/dist/executors/bounded-exec/executor.d.ts +5 -0
- package/dist/executors/bounded-exec/executor.d.ts.map +1 -1
- package/dist/executors/bounded-exec/executor.js +44 -5
- package/dist/executors/bounded-exec/host-memory.d.ts +22 -0
- package/dist/executors/bounded-exec/host-memory.d.ts.map +1 -1
- package/dist/executors/bounded-exec/host-memory.darwin.d.ts.map +1 -1
- package/dist/executors/bounded-exec/host-memory.darwin.js +7 -1
- package/dist/executors/bounded-exec/host-memory.js +6 -0
- package/dist/executors/bounded-exec/host-memory.linux.d.ts +3 -1
- package/dist/executors/bounded-exec/host-memory.linux.d.ts.map +1 -1
- package/dist/executors/bounded-exec/host-memory.linux.js +43 -1
- package/dist/executors/bounded-exec/pool-admission.d.ts +31 -7
- package/dist/executors/bounded-exec/pool-admission.d.ts.map +1 -1
- package/dist/executors/bounded-exec/pool-admission.js +44 -8
- package/dist/executors/bounded-exec/run-cpu-pool.d.ts.map +1 -1
- package/dist/executors/bounded-exec/run-cpu-pool.js +1 -1
- package/dist/executors/bounded-exec/verdict.d.ts +4 -2
- package/dist/executors/bounded-exec/verdict.d.ts.map +1 -1
- package/dist/executors/bounded-exec/verdict.js +19 -2
- package/managed/raw/patches/nx@24.0.3.patch +16 -0
- package/package.json +1 -1
- package/src/executors/bounded-exec/cpu-pool-thread.ts +5 -4
- package/src/executors/bounded-exec/cpu-pool.ts +121 -25
- package/src/executors/bounded-exec/executor.ts +71 -5
- package/src/executors/bounded-exec/host-memory.darwin.ts +7 -1
- package/src/executors/bounded-exec/host-memory.linux.ts +42 -2
- package/src/executors/bounded-exec/host-memory.ts +25 -0
- package/src/executors/bounded-exec/pool-admission.ts +66 -11
- package/src/executors/bounded-exec/run-cpu-pool.ts +3 -3
- package/src/executors/bounded-exec/verdict.ts +25 -5
- package/test-timings.json +2 -0
|
@@ -27,3 +27,9 @@ export function readRunMemory() {
|
|
|
27
27
|
}
|
|
28
28
|
return HOST_MEMORY.readRunMemory();
|
|
29
29
|
}
|
|
30
|
+
/** The run's bound live on this platform, or why it cannot be read: a pool says it, never leaves it out. */
|
|
31
|
+
export function readLiveUsage(bound) {
|
|
32
|
+
return HOST_MEMORY === null
|
|
33
|
+
? { ok: false, reason: `${process.platform} has no reader of live memory` }
|
|
34
|
+
: HOST_MEMORY.liveUsage(bound);
|
|
35
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { HostMemory, RunMemoryReading } from './host-memory.js';
|
|
1
|
+
import type { HostMemory, LiveUsageReading, RunMemoryReading } from './host-memory.js';
|
|
2
2
|
/** A file's text, or the errno code and message its read failed with. */
|
|
3
3
|
export type FileRead = {
|
|
4
4
|
readonly ok: true;
|
|
@@ -10,5 +10,7 @@ export type FileRead = {
|
|
|
10
10
|
};
|
|
11
11
|
/** The run's memory, reading every file through `read`. */
|
|
12
12
|
export declare function linuxRunMemory(read: (path: string) => Promise<FileRead>): Promise<RunMemoryReading>;
|
|
13
|
+
/** The memory a bound holds live: `memory.stat`'s `anon` and `shmem` beside a cgroup's `memory.max`, meminfo's `AnonPages` and `Shmem` for the host's. */
|
|
14
|
+
export declare function linuxLiveUsage(read: (path: string) => FileRead, bound: string): LiveUsageReading;
|
|
13
15
|
export declare const linuxMemory: HostMemory;
|
|
14
16
|
//# sourceMappingURL=host-memory.linux.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"host-memory.linux.d.ts","sourceRoot":"","sources":["../../../src/executors/bounded-exec/host-memory.linux.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"host-memory.linux.d.ts","sourceRoot":"","sources":["../../../src/executors/bounded-exec/host-memory.linux.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAA6B,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAclH,yEAAyE;AACzE,MAAM,MAAM,QAAQ,GAChB;IAAE,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC5C;IAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AA2B5E,2DAA2D;AAC3D,wBAAsB,cAAc,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,QAAQ,CAAC,GAAG,OAAO,CAAC,gBAAgB,CAAC,CA8CzG;AAWD,0JAA0J;AAC1J,wBAAgB,cAAc,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,QAAQ,EAAE,KAAK,EAAE,MAAM,GAAG,gBAAgB,CAuBhG;AAmDD,eAAO,MAAM,WAAW,EAAE,UAKzB,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
1
2
|
import { readFile } from 'node:fs/promises';
|
|
2
3
|
import { posix } from 'node:path';
|
|
3
4
|
import { childPids } from '../../process-children.linux.js';
|
|
@@ -93,6 +94,42 @@ async function readText(path) {
|
|
|
93
94
|
return { ok: false, code, message: error instanceof Error ? error.message : String(error) };
|
|
94
95
|
}
|
|
95
96
|
}
|
|
97
|
+
/** The memory a bound holds live: `memory.stat`'s `anon` and `shmem` beside a cgroup's `memory.max`, meminfo's `AnonPages` and `Shmem` for the host's. */
|
|
98
|
+
export function linuxLiveUsage(read, bound) {
|
|
99
|
+
const cgroupLimit = '/memory.max';
|
|
100
|
+
if (bound.endsWith(cgroupLimit)) {
|
|
101
|
+
const file = `${bound.slice(0, -cgroupLimit.length)}/memory.stat`;
|
|
102
|
+
const stat = read(file);
|
|
103
|
+
if (!stat.ok)
|
|
104
|
+
return { ok: false, reason: `${file}: ${stat.code}: ${stat.message}` };
|
|
105
|
+
const [anon, shmem] = [/^anon (\d+)$/m.exec(stat.text)?.[1], /^shmem (\d+)$/m.exec(stat.text)?.[1]];
|
|
106
|
+
return anon === undefined || shmem === undefined
|
|
107
|
+
? { ok: false, reason: `${file} names no anon and shmem in bytes` }
|
|
108
|
+
: { ok: true, usage: { anon: Number(anon), shmem: Number(shmem), source: file } };
|
|
109
|
+
}
|
|
110
|
+
if (bound === `${MEMINFO} MemTotal`) {
|
|
111
|
+
const info = read(MEMINFO);
|
|
112
|
+
if (!info.ok)
|
|
113
|
+
return { ok: false, reason: `${MEMINFO}: ${info.code}: ${info.message}` };
|
|
114
|
+
const [anon, shmem] = [
|
|
115
|
+
/^AnonPages:\s+(\d+) kB$/m.exec(info.text)?.[1],
|
|
116
|
+
/^Shmem:\s+(\d+) kB$/m.exec(info.text)?.[1],
|
|
117
|
+
];
|
|
118
|
+
return anon === undefined || shmem === undefined
|
|
119
|
+
? { ok: false, reason: `${MEMINFO} names no AnonPages and Shmem in kB` }
|
|
120
|
+
: { ok: true, usage: { anon: Number(anon) * 1024, shmem: Number(shmem) * 1024, source: MEMINFO } };
|
|
121
|
+
}
|
|
122
|
+
return { ok: false, reason: `${bound} is no cgroup memory.max or meminfo bound` };
|
|
123
|
+
}
|
|
124
|
+
function readTextSync(path) {
|
|
125
|
+
try {
|
|
126
|
+
return { ok: true, text: readFileSync(path, 'utf8') };
|
|
127
|
+
}
|
|
128
|
+
catch (error) {
|
|
129
|
+
const code = error instanceof Error && 'code' in error && typeof error.code === 'string' ? error.code : 'EIO';
|
|
130
|
+
return { ok: false, code, message: error instanceof Error ? error.message : String(error) };
|
|
131
|
+
}
|
|
132
|
+
}
|
|
96
133
|
/** Bun before 1.4.0 reports Linux's `ru_maxrss` as the kernel does, in KiB; from 1.4.0 it reports bytes. */
|
|
97
134
|
function peakBytes(maxRss, bunVersion) {
|
|
98
135
|
const version = /^(\d+)\.(\d+)\./.exec(bunVersion);
|
|
@@ -134,4 +171,9 @@ async function residentBytes(pid) {
|
|
|
134
171
|
const kib = /^VmRSS:\s+(\d+) kB$/m.exec(status)?.[1];
|
|
135
172
|
return kib === undefined ? 0 : Number(kib) * 1024;
|
|
136
173
|
}
|
|
137
|
-
export const linuxMemory = {
|
|
174
|
+
export const linuxMemory = {
|
|
175
|
+
readRunMemory: () => linuxRunMemory(readText),
|
|
176
|
+
peakBytes,
|
|
177
|
+
treeResidentBytes,
|
|
178
|
+
liveUsage: (bound) => linuxLiveUsage(readTextSync, bound),
|
|
179
|
+
};
|
|
@@ -7,32 +7,56 @@
|
|
|
7
7
|
* Every grant needs both. The head takes `min(want, free)` tokens once one is free, and only while the charges of the
|
|
8
8
|
* leaves holding grants plus its own fit the run's memory; a head that cannot be granted holds up every request behind
|
|
9
9
|
* it, and no request holds part of a grant while it waits for the rest. A leaf is charged its task's last recorded
|
|
10
|
-
* memory peak, and nothing while its task has none. A
|
|
11
|
-
*
|
|
10
|
+
* memory peak, and nothing while its task has none. A runner's memory grows with the parallelism it is lent (a Vitest
|
|
11
|
+
* worker is a process of its own), so a peak measured while the leaf was lent `parallelism` tokens is charged in
|
|
12
|
+
* proportion to the tokens it is lent now when that is more, never less: the baseline a leaf holds however few workers
|
|
13
|
+
* it has makes a smaller grant no cheaper. When its whole ask does not fit, the head is lent the most tokens whose
|
|
14
|
+
* charge does. A leaf whose own charge alone exceeds the run's memory could never fit, so it is granted once nothing
|
|
15
|
+
* else holds memory, on one token when its peak names the parallelism it was measured under, and the grant says so.
|
|
16
|
+
*
|
|
17
|
+
* A leaf the kernel killed for memory, run again (`alone`), is granted only while nothing holds a grant, ahead of the
|
|
18
|
+
* leaves behind it, and while it runs nothing else is granted: a leaf that was killed beside others runs by itself.
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* What a queued request asks: whole tokens, at least one, its charge in bytes (0 for a task with no peak), and the
|
|
22
|
+
* tokens that charge was measured under. Without them the charge is flat: it is the same however many tokens are lent.
|
|
12
23
|
*/
|
|
13
|
-
/** What a queued request asks: whole tokens, at least one, and its charge in bytes (0 for a task with no peak). */
|
|
14
24
|
export interface PoolAsk {
|
|
15
25
|
readonly want: number;
|
|
16
26
|
readonly memory: number;
|
|
27
|
+
readonly parallelism?: number | undefined;
|
|
28
|
+
/** A leaf the kernel killed for memory, run again: granted while nothing else holds a grant, and alone. */
|
|
29
|
+
readonly alone?: boolean | undefined;
|
|
30
|
+
}
|
|
31
|
+
/** Who holds a grant when the pool decides: how many leaves, and whether one of them runs alone. */
|
|
32
|
+
export interface Holding {
|
|
33
|
+
readonly holders: number;
|
|
34
|
+
readonly alone: boolean;
|
|
17
35
|
}
|
|
18
36
|
/** The run's memory a pool charges against, and the bytes its holders are charged; null for a pool that charges none. */
|
|
19
37
|
export interface MemoryLedger {
|
|
20
38
|
readonly capacity: number;
|
|
21
39
|
readonly held: number;
|
|
22
40
|
}
|
|
23
|
-
/**
|
|
41
|
+
/**
|
|
42
|
+
* One request's grant: the request, its tokens, the bytes it is charged at those tokens, and whether its charge alone
|
|
43
|
+
* exceeds the run's memory.
|
|
44
|
+
*/
|
|
24
45
|
export interface PoolGrant<Ask extends PoolAsk> {
|
|
25
46
|
readonly request: Ask;
|
|
26
47
|
readonly tokens: number;
|
|
48
|
+
readonly charge: number;
|
|
27
49
|
readonly oversized: boolean;
|
|
28
50
|
}
|
|
29
51
|
/**
|
|
30
52
|
* The grants of the queue's first requests, in its order, and what the first request left waiting waits for: free
|
|
31
|
-
* tokens (`cpu`)
|
|
53
|
+
* tokens (`cpu`), the run's memory (`memory`) or the grants others hold (`alone`). `waiting` is null when every request was granted.
|
|
32
54
|
*/
|
|
33
55
|
export interface Admission<Ask extends PoolAsk> {
|
|
34
56
|
readonly grants: readonly PoolGrant<Ask>[];
|
|
35
|
-
readonly waiting: 'cpu' | 'memory' | null;
|
|
57
|
+
readonly waiting: 'cpu' | 'memory' | 'alone' | null;
|
|
36
58
|
}
|
|
37
|
-
|
|
59
|
+
/** The bytes `ask` is charged when it is lent `tokens`: its peak, scaled up when that is more than it was measured under. */
|
|
60
|
+
export declare function chargeAt(ask: PoolAsk, tokens: number): number;
|
|
61
|
+
export declare function admit<Ask extends PoolAsk>(queue: readonly Ask[], available: number, memory: MemoryLedger | null, holding?: Holding): Admission<Ask>;
|
|
38
62
|
//# sourceMappingURL=pool-admission.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pool-admission.d.ts","sourceRoot":"","sources":["../../../src/executors/bounded-exec/pool-admission.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"pool-admission.d.ts","sourceRoot":"","sources":["../../../src/executors/bounded-exec/pool-admission.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH;;;GAGG;AACH,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1C,2GAA2G;IAC3G,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CACtC;AAED,oGAAoG;AACpG,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;CACzB;AAGD,yHAAyH;AACzH,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED;;;GAGG;AACH,MAAM,WAAW,SAAS,CAAC,GAAG,SAAS,OAAO;IAC5C,QAAQ,CAAC,OAAO,EAAE,GAAG,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;CAC7B;AAED;;;GAGG;AACH,MAAM,WAAW,SAAS,CAAC,GAAG,SAAS,OAAO;IAC5C,QAAQ,CAAC,MAAM,EAAE,SAAS,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC;IAC3C,QAAQ,CAAC,OAAO,EAAE,KAAK,GAAG,QAAQ,GAAG,OAAO,GAAG,IAAI,CAAC;CACrD;AAED,6HAA6H;AAC7H,wBAAgB,QAAQ,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAG7D;AAcD,wBAAgB,KAAK,CAAC,GAAG,SAAS,OAAO,EACvC,KAAK,EAAE,SAAS,GAAG,EAAE,EACrB,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,YAAY,GAAG,IAAI,EAC3B,OAAO,GAAE,OAAsB,GAC9B,SAAS,CAAC,GAAG,CAAC,CA8BhB"}
|
|
@@ -7,25 +7,61 @@
|
|
|
7
7
|
* Every grant needs both. The head takes `min(want, free)` tokens once one is free, and only while the charges of the
|
|
8
8
|
* leaves holding grants plus its own fit the run's memory; a head that cannot be granted holds up every request behind
|
|
9
9
|
* it, and no request holds part of a grant while it waits for the rest. A leaf is charged its task's last recorded
|
|
10
|
-
* memory peak, and nothing while its task has none. A
|
|
11
|
-
*
|
|
10
|
+
* memory peak, and nothing while its task has none. A runner's memory grows with the parallelism it is lent (a Vitest
|
|
11
|
+
* worker is a process of its own), so a peak measured while the leaf was lent `parallelism` tokens is charged in
|
|
12
|
+
* proportion to the tokens it is lent now when that is more, never less: the baseline a leaf holds however few workers
|
|
13
|
+
* it has makes a smaller grant no cheaper. When its whole ask does not fit, the head is lent the most tokens whose
|
|
14
|
+
* charge does. A leaf whose own charge alone exceeds the run's memory could never fit, so it is granted once nothing
|
|
15
|
+
* else holds memory, on one token when its peak names the parallelism it was measured under, and the grant says so.
|
|
16
|
+
*
|
|
17
|
+
* A leaf the kernel killed for memory, run again (`alone`), is granted only while nothing holds a grant, ahead of the
|
|
18
|
+
* leaves behind it, and while it runs nothing else is granted: a leaf that was killed beside others runs by itself.
|
|
12
19
|
*/
|
|
13
|
-
|
|
20
|
+
const NOTHING_HELD = { holders: 0, alone: false };
|
|
21
|
+
/** The bytes `ask` is charged when it is lent `tokens`: its peak, scaled up when that is more than it was measured under. */
|
|
22
|
+
export function chargeAt(ask, tokens) {
|
|
23
|
+
const measured = ask.parallelism;
|
|
24
|
+
return measured === undefined || tokens <= measured ? ask.memory : Math.ceil((ask.memory * tokens) / measured);
|
|
25
|
+
}
|
|
26
|
+
/** The most tokens, up to `most`, whose charge fits `room` bytes; none when even the peak itself does not. */
|
|
27
|
+
function tokensFitting(ask, most, room) {
|
|
28
|
+
if (ask.memory > room) {
|
|
29
|
+
return 0;
|
|
30
|
+
}
|
|
31
|
+
const measured = ask.parallelism;
|
|
32
|
+
if (measured === undefined || ask.memory === 0 || most <= measured) {
|
|
33
|
+
return most;
|
|
34
|
+
}
|
|
35
|
+
return Math.min(most, Math.floor((room * measured) / ask.memory));
|
|
36
|
+
}
|
|
37
|
+
export function admit(queue, available, memory, holding = NOTHING_HELD) {
|
|
14
38
|
const grants = [];
|
|
39
|
+
if (holding.alone) {
|
|
40
|
+
return { grants, waiting: queue.length === 0 ? null : 'alone' };
|
|
41
|
+
}
|
|
15
42
|
let free = available;
|
|
16
43
|
let held = memory?.held ?? 0;
|
|
17
44
|
for (const request of queue) {
|
|
45
|
+
if (request.alone === true && holding.holders + grants.length > 0) {
|
|
46
|
+
return { grants, waiting: 'alone' };
|
|
47
|
+
}
|
|
18
48
|
const oversized = memory !== null && request.memory > memory.capacity;
|
|
19
|
-
|
|
49
|
+
const room = memory === null ? Number.POSITIVE_INFINITY : memory.capacity - held;
|
|
50
|
+
if (request.memory > room && !(oversized && held === 0)) {
|
|
20
51
|
return { grants, waiting: 'memory' };
|
|
21
52
|
}
|
|
22
|
-
const
|
|
23
|
-
if (
|
|
53
|
+
const most = Math.min(request.want, free);
|
|
54
|
+
if (most === 0) {
|
|
24
55
|
return { grants, waiting: 'cpu' };
|
|
25
56
|
}
|
|
57
|
+
const tokens = oversized ? (request.parallelism === undefined ? most : 1) : tokensFitting(request, most, room);
|
|
58
|
+
const charge = chargeAt(request, tokens);
|
|
26
59
|
free -= tokens;
|
|
27
|
-
held +=
|
|
28
|
-
grants.push({ request, tokens, oversized });
|
|
60
|
+
held += charge;
|
|
61
|
+
grants.push({ request, tokens, charge, oversized });
|
|
62
|
+
if (request.alone === true) {
|
|
63
|
+
return { grants, waiting: grants.length < queue.length ? 'alone' : null };
|
|
64
|
+
}
|
|
29
65
|
}
|
|
30
66
|
return { grants, waiting: null };
|
|
31
67
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-cpu-pool.d.ts","sourceRoot":"","sources":["../../../src/executors/bounded-exec/run-cpu-pool.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,yBAAyB,EAAE,wBAAwB,EAAE,MAAM,4CAA4C,CAAC;AAGtH,OAAO,
|
|
1
|
+
{"version":3,"file":"run-cpu-pool.d.ts","sourceRoot":"","sources":["../../../src/executors/bounded-exec/run-cpu-pool.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,yBAAyB,EAAE,wBAAwB,EAAE,MAAM,4CAA4C,CAAC;AAGtH,OAAO,EAAkB,KAAK,gBAAgB,EAAsC,MAAM,kBAAkB,CAAC;AAqD7G;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAM5F;AAED;;;;;GAKG;AACH,wBAAsB,eAAe,CACnC,OAAO,EAAE,IAAI,CAAC,wBAAwB,EAAE,IAAI,CAAC,EAC7C,GAAG,GAAE,MAAM,CAAC,UAAwB,EACpC,KAAK,GAAE,MAA+B,EACtC,UAAU,GAAE,MAAM,OAAO,CAAC,gBAAgB,CAAiB,GAC1D,OAAO,CAAC,IAAI,CAAC,CAoBf;AAoED,uEAAuE;AACvE,wBAAsB,eAAe,CAAC,OAAO,EAAE,IAAI,CAAC,yBAAyB,EAAE,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAUnG"}
|
|
@@ -70,7 +70,7 @@ export async function serveRunCpuPool(context, env = process.env, cores = availa
|
|
|
70
70
|
if (!memory.ok) {
|
|
71
71
|
throw new RunMemoryUnreadable(memory.error);
|
|
72
72
|
}
|
|
73
|
-
const served = await servePoolThread(tokens, memory.memory
|
|
73
|
+
const served = await servePoolThread(tokens, memory.memory);
|
|
74
74
|
if (!served.ok) {
|
|
75
75
|
logger.warn(`bounded-exec: this run's CPU pool failed (${served.error}); its tasks are sized only by the ceilings they inherit`);
|
|
76
76
|
return;
|
|
@@ -90,8 +90,9 @@ export interface BoundedExecRecord {
|
|
|
90
90
|
readonly verdict: BoundedExecVerdict;
|
|
91
91
|
/**
|
|
92
92
|
* The parent CPU pool's grant the run started under: tokens granted of those asked for, and
|
|
93
|
-
* how long it waited for the pool. Absent when it ran ungranted
|
|
94
|
-
*
|
|
93
|
+
* how long it waited for the pool. Absent when it ran ungranted. Its tokens are the parallelism the run's
|
|
94
|
+
* `peakBytes` was measured under, which the task's next run reads (`readLastPeak`) to charge that peak in proportion
|
|
95
|
+
* to the parallelism it is lent.
|
|
95
96
|
*/
|
|
96
97
|
readonly cpu?: {
|
|
97
98
|
readonly tokens: number;
|
|
@@ -237,6 +238,7 @@ export declare function readRecord(directory: string): Promise<BoundedExecRecord
|
|
|
237
238
|
export declare function readLastPeak(directory: string): Promise<{
|
|
238
239
|
ok: true;
|
|
239
240
|
peakBytes: number | null;
|
|
241
|
+
parallelism: number | null;
|
|
240
242
|
} | {
|
|
241
243
|
ok: false;
|
|
242
244
|
error: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verdict.d.ts","sourceRoot":"","sources":["../../../src/executors/bounded-exec/verdict.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAmB,KAAK,QAAQ,EAAe,MAAM,gBAAgB,CAAC;AAC7E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAGhE;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,MAAM,kBAAkB,GAC1B;IAAE,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAA;CAAE,GAC9B,CAAC;IAAE,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GAAG,kBAAkB,CAAC,GAChF;IACE,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,SAAS,CAAC;IACpC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B,GACD;IAAE,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,GACxF;IACE,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC;IAC3B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,K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eAAe,CACnC,SAAS,EAAE,MAAM,EACjB,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,SAAS,gBAAgB,EAAE,KAAK,IAAI,GACzD,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CAS/B;AAwJD,0FAA0F;AAC1F,MAAM,MAAM,UAAU,GAClB;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,kBAAkB,EAAE;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC,CAAA;CAAE,GACpH;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAE9E;;;;GAIG;AACH,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CA6BrG;AAED,kFAAkF;AAClF,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,kBAAkB,GAAG,MAAM,CAQvE;AACD,wBAAgB,eAAe,CAAC,OAAO,EAAE,kBAAkB,GAAG,MAAM,CA2BnE;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,eAAe,GAAG,MAAM,CAgBjE"}
|
|
@@ -327,7 +327,8 @@ export async function readRecord(directory) {
|
|
|
327
327
|
*/
|
|
328
328
|
export async function readLastPeak(directory) {
|
|
329
329
|
try {
|
|
330
|
-
|
|
330
|
+
const record = await readRecord(directory);
|
|
331
|
+
return { ok: true, peakBytes: record?.peakBytes ?? null, parallelism: record?.cpu?.tokens ?? null };
|
|
331
332
|
}
|
|
332
333
|
catch (error) {
|
|
333
334
|
return {
|
|
@@ -361,7 +362,23 @@ function parseRecord(value) {
|
|
|
361
362
|
if (!(peakBytes === null || (typeof peakBytes === 'number' && Number.isSafeInteger(peakBytes) && peakBytes >= 0))) {
|
|
362
363
|
throw new Error(`not a bounded-exec record: ${JSON.stringify(value)}`);
|
|
363
364
|
}
|
|
364
|
-
|
|
365
|
+
const cpu = value.cpu;
|
|
366
|
+
if (cpu === undefined) {
|
|
367
|
+
return { task: value.task, hash: value.hash, verdict: parseVerdict(value.verdict), peakBytes };
|
|
368
|
+
}
|
|
369
|
+
if (!isObject(cpu) ||
|
|
370
|
+
!(typeof cpu.tokens === 'number' && Number.isSafeInteger(cpu.tokens) && cpu.tokens >= 1) ||
|
|
371
|
+
!(typeof cpu.want === 'number' && Number.isSafeInteger(cpu.want) && cpu.want >= 1) ||
|
|
372
|
+
!(typeof cpu.waitedMs === 'number' && Number.isFinite(cpu.waitedMs) && cpu.waitedMs >= 0)) {
|
|
373
|
+
throw new Error(`not a bounded-exec record: ${JSON.stringify(value)}`);
|
|
374
|
+
}
|
|
375
|
+
return {
|
|
376
|
+
task: value.task,
|
|
377
|
+
hash: value.hash,
|
|
378
|
+
verdict: parseVerdict(value.verdict),
|
|
379
|
+
cpu: { tokens: cpu.tokens, want: cpu.want, waitedMs: cpu.waitedMs },
|
|
380
|
+
peakBytes,
|
|
381
|
+
};
|
|
365
382
|
}
|
|
366
383
|
function parseVerdict(value) {
|
|
367
384
|
if (isObject(value)) {
|
|
@@ -4000,6 +4000,22 @@ index 2000bbcd5d707c5435c2bc47573528d7a31ae606..524a82cae46a6028baceaa985097fe59
|
|
|
4000
4000
|
}
|
|
4001
4001
|
function setErrorTimeout(timeoutMs, errorMessage) {
|
|
4002
4002
|
if (environment.NX_PLUGIN_NO_TIMEOUTS === 'true') {
|
|
4003
|
+
diff --git a/dist/src/project-graph/plugins/loaded-nx-plugin.js b/dist/src/project-graph/plugins/loaded-nx-plugin.js
|
|
4004
|
+
index 9fa6b993ac4dbe918c163092c12f77f87eaccb27..d93538310c4dc2622cde88cd9da983bcc1e3e63c 100644
|
|
4005
|
+
--- a/dist/src/project-graph/plugins/loaded-nx-plugin.js
|
|
4006
|
+
+++ b/dist/src/project-graph/plugins/loaded-nx-plugin.js
|
|
4007
|
+
@@ -85,7 +85,10 @@ class LoadedNxPlugin {
|
|
4008
|
+
this.preTasksExecution = async (context) => {
|
|
4009
|
+
const updates = {};
|
|
4010
|
+
let originalEnv = process.env;
|
|
4011
|
+
- if ((0, enabled_1.isIsolationEnabled)() || (0, client_1.isDaemonEnabled)()) {
|
|
4012
|
+
+ // A plugin worker records the hook's writes whatever the isolation setting and the daemon say: the
|
|
4013
|
+
+ // patched Nx loads a local plugin in one under every setting, and these recorded writes are how the
|
|
4014
|
+
+ // hook's environment reaches the client that applies it.
|
|
4015
|
+
+ if ((0, enabled_1.isIsolationEnabled)() || (0, client_1.isDaemonEnabled)() || global.NX_PLUGIN_WORKER) {
|
|
4016
|
+
process.env = new Proxy(originalEnv, {
|
|
4017
|
+
set: (target, key, value) => {
|
|
4018
|
+
target[key] = value;
|
|
4003
4019
|
diff --git a/dist/src/project-graph/plugins/local-plugin-source.d.ts b/dist/src/project-graph/plugins/local-plugin-source.d.ts
|
|
4004
4020
|
new file mode 100644
|
|
4005
4021
|
index 0000000000000000000000000000000000000000..1a84106509d0e05a2f0d6c595b79ecc781ff21d1
|
package/package.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { parentPort, workerData } from 'node:worker_threads';
|
|
2
2
|
import { type CloseOutcome, createCpuPool } from './cpu-pool.js';
|
|
3
|
+
import type { RunMemory } from './host-memory.js';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* The thread an Nx run's CPU pool runs on (`run-cpu-pool.ts`; specs/cowshed/05_gateway.md, "Every Nx run budgets
|
|
@@ -9,14 +10,14 @@ import { type CloseOutcome, createCpuPool } from './cpu-pool.js';
|
|
|
9
10
|
* jobserver fifo and heartbeat share an event loop that runs nothing else, so the heartbeat proves that the actor which
|
|
10
11
|
* admits and grants is turning.
|
|
11
12
|
*
|
|
12
|
-
* The thread is started with the pool's count and the run's memory. It says once that the pool serves, with the environment a
|
|
13
|
-
* or why it cannot; the host's one message is its close, after which the thread says how the pool closed.
|
|
13
|
+
* The thread is started with the pool's count and the run's memory. It says once that the pool serves, with the environment a
|
|
14
|
+
* task inherits, or why it cannot; the host's one message is its close, after which the thread says how the pool closed.
|
|
14
15
|
*/
|
|
15
16
|
|
|
16
|
-
/** What the thread is started with: the run's count, and the run's memory
|
|
17
|
+
/** What the thread is started with: the run's count, and the run's memory its grants are charged against. */
|
|
17
18
|
export interface CpuPoolThreadData {
|
|
18
19
|
readonly tokens: number;
|
|
19
|
-
readonly memory:
|
|
20
|
+
readonly memory: RunMemory;
|
|
20
21
|
}
|
|
21
22
|
|
|
22
23
|
/** What the thread says, in order: the pool serves or failed; after the host's close, how the pool closed. */
|