nx 22.1.0-beta.4 → 22.1.0-beta.5
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/package.json +11 -11
- package/src/core/graph/main.js +1 -1
- package/src/daemon/client/client.d.ts +1 -0
- package/src/daemon/client/client.d.ts.map +1 -1
- package/src/daemon/client/client.js +18 -1
- package/src/executors/run-commands/run-commands.impl.d.ts +1 -1
- package/src/executors/run-commands/run-commands.impl.d.ts.map +1 -1
- package/src/executors/run-commands/run-commands.impl.js +7 -4
- package/src/executors/run-commands/running-tasks.d.ts +4 -3
- package/src/executors/run-commands/running-tasks.d.ts.map +1 -1
- package/src/executors/run-commands/running-tasks.js +30 -9
- package/src/native/index.d.ts +90 -0
- package/src/native/native-bindings.js +1 -0
- package/src/native/nx.wasm32-wasi.wasm +0 -0
- package/src/project-graph/plugins/isolation/plugin-pool.d.ts.map +1 -1
- package/src/project-graph/plugins/isolation/plugin-pool.js +17 -1
- package/src/tasks-runner/create-task-graph.d.ts.map +1 -1
- package/src/tasks-runner/create-task-graph.js +4 -11
- package/src/tasks-runner/forked-process-task-runner.d.ts.map +1 -1
- package/src/tasks-runner/forked-process-task-runner.js +36 -4
- package/src/tasks-runner/process-metrics-service.d.ts +54 -0
- package/src/tasks-runner/process-metrics-service.d.ts.map +1 -0
- package/src/tasks-runner/process-metrics-service.js +161 -0
- package/src/tasks-runner/pseudo-terminal.d.ts +1 -0
- package/src/tasks-runner/pseudo-terminal.d.ts.map +1 -1
- package/src/tasks-runner/pseudo-terminal.js +3 -0
- package/src/tasks-runner/running-tasks/node-child-process.d.ts.map +1 -1
- package/src/tasks-runner/task-orchestrator.d.ts.map +1 -1
- package/src/tasks-runner/task-orchestrator.js +1 -1
- package/src/tasks-runner/utils.d.ts +1 -0
- package/src/tasks-runner/utils.d.ts.map +1 -1
- package/src/tasks-runner/utils.js +8 -0
|
@@ -73,6 +73,7 @@ export declare class DaemonClient {
|
|
|
73
73
|
private sendToDaemonViaQueue;
|
|
74
74
|
private setUpConnection;
|
|
75
75
|
private sendMessageToDaemon;
|
|
76
|
+
private registerDaemonProcessWithMetricsService;
|
|
76
77
|
private retryMessageAfterNewDaemonStarts;
|
|
77
78
|
private handleMessage;
|
|
78
79
|
startInBackground(): Promise<ChildProcess['pid']>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/daemon/client/client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAS,MAAM,eAAe,CAAC;AAoBpD,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAUpE,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,uDAAuD,CAAC;AAKhG,OAAO,EAAW,gBAAgB,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAoC9E,OAAO,KAAK,EACV,+BAA+B,EAC/B,sBAAsB,EACvB,MAAM,6BAA6B,CAAC;AAcrC,OAAO,EACL,yBAAyB,EACzB,wBAAwB,EACzB,MAAM,wCAAwC,CAAC;AAoBhD,MAAM,MAAM,kBAAkB,GAAG,MAAM,IAAI,CAAC;AAC5C,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAC;CACtC,CAAC;AAQF,qBAAa,YAAY;IACvB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA6B;;IAWpD,OAAO,CAAC,KAAK,CAAqB;IAClC,OAAO,CAAC,eAAe,CAAwB;IAE/C,OAAO,CAAC,cAAc,CAAC;IACvB,OAAO,CAAC,cAAc,CAAC;IACvB,OAAO,CAAC,aAAa,CAAC;IAEtB,OAAO,CA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AC;IAwDjD,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAkB5B;AAED,eAAO,MAAM,YAAY,cAAqB,CAAC;AAE/C,wBAAgB,eAAe,YAE9B"}
|
|
@@ -419,15 +419,20 @@ class DaemonClient {
|
|
|
419
419
|
async sendMessageToDaemon(message, force) {
|
|
420
420
|
if (this._daemonStatus == DaemonStatus.DISCONNECTED) {
|
|
421
421
|
this._daemonStatus = DaemonStatus.CONNECTING;
|
|
422
|
+
let daemonPid = null;
|
|
422
423
|
if (!(await this.isServerAvailable())) {
|
|
423
|
-
await this.startInBackground();
|
|
424
|
+
daemonPid = await this.startInBackground();
|
|
424
425
|
}
|
|
425
426
|
this.setUpConnection();
|
|
426
427
|
this._daemonStatus = DaemonStatus.CONNECTED;
|
|
427
428
|
this._daemonReady();
|
|
429
|
+
daemonPid ??= (0, cache_1.getDaemonProcessIdSync)();
|
|
430
|
+
await this.registerDaemonProcessWithMetricsService(daemonPid);
|
|
428
431
|
}
|
|
429
432
|
else if (this._daemonStatus == DaemonStatus.CONNECTING) {
|
|
430
433
|
await this._waitForDaemonReady;
|
|
434
|
+
const daemonPid = (0, cache_1.getDaemonProcessIdSync)();
|
|
435
|
+
await this.registerDaemonProcessWithMetricsService(daemonPid);
|
|
431
436
|
}
|
|
432
437
|
// An open promise isn't enough to keep the event loop
|
|
433
438
|
// alive, so we set a timeout here and clear it when we hear
|
|
@@ -443,6 +448,18 @@ class DaemonClient {
|
|
|
443
448
|
clearTimeout(keepAlive);
|
|
444
449
|
});
|
|
445
450
|
}
|
|
451
|
+
async registerDaemonProcessWithMetricsService(daemonPid) {
|
|
452
|
+
if (!daemonPid) {
|
|
453
|
+
return;
|
|
454
|
+
}
|
|
455
|
+
try {
|
|
456
|
+
const { getProcessMetricsService } = await Promise.resolve().then(() => require('../../tasks-runner/process-metrics-service'));
|
|
457
|
+
getProcessMetricsService().registerDaemonProcess(daemonPid);
|
|
458
|
+
}
|
|
459
|
+
catch {
|
|
460
|
+
// don't error, this is a secondary concern that should not break task execution
|
|
461
|
+
}
|
|
462
|
+
}
|
|
446
463
|
retryMessageAfterNewDaemonStarts() {
|
|
447
464
|
const [msg, res, rej] = [
|
|
448
465
|
this.currentMessage,
|
|
@@ -55,6 +55,6 @@ export default function (options: RunCommandsOptions, context: ExecutorContext):
|
|
|
55
55
|
success: boolean;
|
|
56
56
|
terminalOutput: string;
|
|
57
57
|
}>;
|
|
58
|
-
export declare function runCommands(options: RunCommandsOptions, context: ExecutorContext): Promise<import("../../tasks-runner/pseudo-terminal").PseudoTtyProcess | NoopChildProcess | ParallelRunningTasks | SeriallyRunningTasks>;
|
|
58
|
+
export declare function runCommands(options: RunCommandsOptions, context: ExecutorContext, taskId?: string): Promise<import("../../tasks-runner/pseudo-terminal").PseudoTtyProcess | NoopChildProcess | ParallelRunningTasks | SeriallyRunningTasks>;
|
|
59
59
|
export declare function interpolateArgsIntoCommand(command: string, opts: Pick<NormalizedRunCommandsOptions, 'args' | 'parsedArgs' | '__unparsed__' | 'unknownOptions' | 'unparsedCommandArgs'>, forwardAllArgs: boolean): string;
|
|
60
60
|
//# sourceMappingURL=run-commands.impl.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-commands.impl.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/executors/run-commands/run-commands.impl.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"run-commands.impl.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/executors/run-commands/run-commands.impl.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAI/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,qDAAqD,CAAC;AACvF,OAAO,EACL,oBAAoB,EAEpB,oBAAoB,EACrB,MAAM,iBAAiB,CAAC;AAEzB,eAAO,MAAM,YAAY,QAAiB,CAAC;AAC3C,MAAM,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AAE;QACV,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC;KAClB,CAAC;IACF,mBAAmB,CAAC,EAAE;QACpB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,CAAC;KAChC,CAAC;IACF,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,eAAe,EAAE;QAAE,aAAa,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,OAAO,CAAA;KAAE,EAAE,CAAC;CAC9D;AAED,yBACE,OAAO,EAAE,kBAAkB,EAC3B,OAAO,EAAE,eAAe,GACvB,OAAO,CAAC;IACT,OAAO,EAAE,OAAO,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;CACxB,CAAC,CAOD;AAED,wBAAsB,WAAW,CAC/B,OAAO,EAAE,kBAAkB,EAC3B,OAAO,EAAE,eAAe,EACxB,MAAM,CAAC,EAAE,MAAM,2IAuEhB;AAmED,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,IAAI,CACR,4BAA4B,EAC1B,MAAM,GACN,YAAY,GACZ,cAAc,GACd,gBAAgB,GAChB,qBAAqB,CACxB,EACD,cAAc,EAAE,OAAO,GACtB,MAAM,CAwCR"}
|
|
@@ -7,6 +7,7 @@ exports.interpolateArgsIntoCommand = interpolateArgsIntoCommand;
|
|
|
7
7
|
const yargsParser = require("yargs-parser");
|
|
8
8
|
const is_tui_enabled_1 = require("../../tasks-runner/is-tui-enabled");
|
|
9
9
|
const pseudo_terminal_1 = require("../../tasks-runner/pseudo-terminal");
|
|
10
|
+
const utils_1 = require("../../tasks-runner/utils");
|
|
10
11
|
const noop_child_process_1 = require("../../tasks-runner/running-tasks/noop-child-process");
|
|
11
12
|
const running_tasks_1 = require("./running-tasks");
|
|
12
13
|
exports.LARGE_BUFFER = 1024 * 1000000;
|
|
@@ -37,7 +38,7 @@ async function default_1(options, context) {
|
|
|
37
38
|
success: results.code === 0,
|
|
38
39
|
};
|
|
39
40
|
}
|
|
40
|
-
async function runCommands(options, context) {
|
|
41
|
+
async function runCommands(options, context, taskId) {
|
|
41
42
|
const normalized = normalizeOptions(options);
|
|
42
43
|
if (normalized.readyWhenStatus.length && !normalized.parallel) {
|
|
43
44
|
throw new Error('ERROR: Bad executor config for run-commands - "readyWhen" can only be used when "parallel=true".');
|
|
@@ -59,11 +60,13 @@ async function runCommands(options, context) {
|
|
|
59
60
|
normalized.usePty;
|
|
60
61
|
const tuiEnabled = (0, is_tui_enabled_1.isTuiEnabled)();
|
|
61
62
|
try {
|
|
63
|
+
const resolvedTaskId = taskId ??
|
|
64
|
+
(0, utils_1.createTaskId)(context.projectName, context.targetName, context.configurationName);
|
|
62
65
|
const runningTask = isSingleCommandAndCanUsePseudoTerminal
|
|
63
|
-
? await (0, running_tasks_1.runSingleCommandWithPseudoTerminal)(normalized, context)
|
|
66
|
+
? await (0, running_tasks_1.runSingleCommandWithPseudoTerminal)(normalized, context, resolvedTaskId)
|
|
64
67
|
: options.parallel
|
|
65
|
-
? new running_tasks_1.ParallelRunningTasks(normalized, context)
|
|
66
|
-
: new running_tasks_1.SeriallyRunningTasks(normalized, context, tuiEnabled);
|
|
68
|
+
? new running_tasks_1.ParallelRunningTasks(normalized, context, resolvedTaskId)
|
|
69
|
+
: new running_tasks_1.SeriallyRunningTasks(normalized, context, tuiEnabled, resolvedTaskId);
|
|
67
70
|
return runningTask;
|
|
68
71
|
}
|
|
69
72
|
catch (e) {
|
|
@@ -9,7 +9,7 @@ export declare class ParallelRunningTasks implements RunningTask {
|
|
|
9
9
|
private readonly streamOutput;
|
|
10
10
|
private exitCallbacks;
|
|
11
11
|
private outputCallbacks;
|
|
12
|
-
constructor(options: NormalizedRunCommandsOptions, context: ExecutorContext);
|
|
12
|
+
constructor(options: NormalizedRunCommandsOptions, context: ExecutorContext, taskId: string);
|
|
13
13
|
getResults(): Promise<{
|
|
14
14
|
code: number;
|
|
15
15
|
terminalOutput: string;
|
|
@@ -23,13 +23,14 @@ export declare class ParallelRunningTasks implements RunningTask {
|
|
|
23
23
|
}
|
|
24
24
|
export declare class SeriallyRunningTasks implements RunningTask {
|
|
25
25
|
private readonly tuiEnabled;
|
|
26
|
+
private readonly taskId;
|
|
26
27
|
private terminalOutput;
|
|
27
28
|
private currentProcess;
|
|
28
29
|
private exitCallbacks;
|
|
29
30
|
private code;
|
|
30
31
|
private error;
|
|
31
32
|
private outputCallbacks;
|
|
32
|
-
constructor(options: NormalizedRunCommandsOptions, context: ExecutorContext, tuiEnabled: boolean);
|
|
33
|
+
constructor(options: NormalizedRunCommandsOptions, context: ExecutorContext, tuiEnabled: boolean, taskId: string);
|
|
33
34
|
getResults(): Promise<{
|
|
34
35
|
code: number;
|
|
35
36
|
terminalOutput: string;
|
|
@@ -41,5 +42,5 @@ export declare class SeriallyRunningTasks implements RunningTask {
|
|
|
41
42
|
private run;
|
|
42
43
|
private createProcess;
|
|
43
44
|
}
|
|
44
|
-
export declare function runSingleCommandWithPseudoTerminal(normalized: NormalizedRunCommandsOptions, context: ExecutorContext): Promise<PseudoTtyProcess>;
|
|
45
|
+
export declare function runSingleCommandWithPseudoTerminal(normalized: NormalizedRunCommandsOptions, context: ExecutorContext, taskId: string): Promise<PseudoTtyProcess>;
|
|
45
46
|
//# sourceMappingURL=running-tasks.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"running-tasks.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/executors/run-commands/running-tasks.ts"],"names":[],"mappings":"AACA,OAAO,EAAsB,YAAY,EAAE,MAAM,eAAe,CAAC;AAIjE,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAGL,gBAAgB,EACjB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAC;
|
|
1
|
+
{"version":3,"file":"running-tasks.d.ts","sourceRoot":"","sources":["../../../../../../packages/nx/src/executors/run-commands/running-tasks.ts"],"names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,KAAK,CAAM;IACnB,OAAO,CAAC,eAAe,CAA+C;gBAGpE,OAAO,EAAE,4BAA4B,EACrC,OAAO,EAAE,eAAe,EACP,UAAU,EAAE,OAAO,EACnB,MAAM,EAAE,MAAM;IAajC,UAAU,IAAI,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,cAAc,EAAE,MAAM,CAAA;KAAE,CAAC;IAY/D,MAAM,CAAC,EAAE,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,KAAK,IAAI,GAAG,IAAI;IAIhE,QAAQ,CAAC,EAAE,EAAE,CAAC,cAAc,EAAE,MAAM,KAAK,IAAI;IAI7C,IAAI,CAAC,OAAO,EAAE,YAAY,GAAG,IAAI;IAIjC,IAAI,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,OAAO;YAId,GAAG;YAyCH,aAAa;CAsD5B;AAoKD,wBAAsB,kCAAkC,CACtD,UAAU,EAAE,4BAA4B,EACxC,OAAO,EAAE,eAAe,EACxB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,gBAAgB,CAAC,CAsB3B"}
|
|
@@ -9,13 +9,14 @@ const path_1 = require("path");
|
|
|
9
9
|
const treeKill = require("tree-kill");
|
|
10
10
|
const pseudo_terminal_1 = require("../../tasks-runner/pseudo-terminal");
|
|
11
11
|
const task_env_1 = require("../../tasks-runner/task-env");
|
|
12
|
+
const process_metrics_service_1 = require("../../tasks-runner/process-metrics-service");
|
|
12
13
|
const exit_codes_1 = require("../../utils/exit-codes");
|
|
13
14
|
const run_commands_impl_1 = require("./run-commands.impl");
|
|
14
15
|
class ParallelRunningTasks {
|
|
15
|
-
constructor(options, context) {
|
|
16
|
+
constructor(options, context, taskId) {
|
|
16
17
|
this.exitCallbacks = [];
|
|
17
18
|
this.outputCallbacks = [];
|
|
18
|
-
this.childProcesses = options.commands.map((commandConfig) => new RunningNodeProcess(commandConfig, options.color, calculateCwd(options.cwd, context), options.env ?? {}, options.readyWhenStatus, options.streamOutput, options.envFile));
|
|
19
|
+
this.childProcesses = options.commands.map((commandConfig) => new RunningNodeProcess(commandConfig, options.color, calculateCwd(options.cwd, context), options.env ?? {}, options.readyWhenStatus, options.streamOutput, options.envFile, taskId));
|
|
19
20
|
this.readyWhenStatus = options.readyWhenStatus;
|
|
20
21
|
this.streamOutput = options.streamOutput;
|
|
21
22
|
this.run();
|
|
@@ -139,8 +140,9 @@ class ParallelRunningTasks {
|
|
|
139
140
|
}
|
|
140
141
|
exports.ParallelRunningTasks = ParallelRunningTasks;
|
|
141
142
|
class SeriallyRunningTasks {
|
|
142
|
-
constructor(options, context, tuiEnabled) {
|
|
143
|
+
constructor(options, context, tuiEnabled, taskId) {
|
|
143
144
|
this.tuiEnabled = tuiEnabled;
|
|
145
|
+
this.taskId = taskId;
|
|
144
146
|
this.terminalOutput = '';
|
|
145
147
|
this.currentProcess = null;
|
|
146
148
|
this.exitCallbacks = [];
|
|
@@ -182,7 +184,7 @@ class SeriallyRunningTasks {
|
|
|
182
184
|
}
|
|
183
185
|
async run(options, context) {
|
|
184
186
|
for (const c of options.commands) {
|
|
185
|
-
const childProcess = await this.createProcess(c, options.color, calculateCwd(options.cwd, context), options.processEnv ?? options.env ?? {}, options.usePty, options.streamOutput, options.tty, options.envFile);
|
|
187
|
+
const childProcess = await this.createProcess(c, options.color, calculateCwd(options.cwd, context), options.processEnv ?? options.env ?? {}, this.taskId, options.usePty, options.streamOutput, options.tty, options.envFile);
|
|
186
188
|
this.currentProcess = childProcess;
|
|
187
189
|
childProcess.onOutput((output) => {
|
|
188
190
|
for (const cb of this.outputCallbacks) {
|
|
@@ -204,7 +206,7 @@ class SeriallyRunningTasks {
|
|
|
204
206
|
}
|
|
205
207
|
}
|
|
206
208
|
}
|
|
207
|
-
async createProcess(commandConfig, color, cwd, env, usePty = true, streamOutput = true, tty, envFile) {
|
|
209
|
+
async createProcess(commandConfig, color, cwd, env, taskId, usePty = true, streamOutput = true, tty, envFile) {
|
|
208
210
|
// The rust runCommand is always a tty, so it will not look nice in parallel and if we need prefixes
|
|
209
211
|
// currently does not work properly in windows
|
|
210
212
|
if (process.env.NX_NATIVE_COMMAND_RUNNER !== 'false' &&
|
|
@@ -213,15 +215,23 @@ class SeriallyRunningTasks {
|
|
|
213
215
|
pseudo_terminal_1.PseudoTerminal.isSupported()) {
|
|
214
216
|
const pseudoTerminal = (0, pseudo_terminal_1.createPseudoTerminal)();
|
|
215
217
|
registerProcessListener(this, pseudoTerminal);
|
|
216
|
-
|
|
218
|
+
const pseudoTtyProcess = await createProcessWithPseudoTty(pseudoTerminal, commandConfig, color, cwd, env, streamOutput, tty, envFile);
|
|
219
|
+
// Register process for metrics collection (direct run-commands execution)
|
|
220
|
+
// Skip registration if we're in a forked executor - the fork wrapper already registered
|
|
221
|
+
const pid = pseudoTtyProcess.getPid();
|
|
222
|
+
if (pid && !process.env.NX_FORKED_TASK_EXECUTOR) {
|
|
223
|
+
(0, process_metrics_service_1.getProcessMetricsService)().registerTaskProcess(taskId, pid);
|
|
224
|
+
}
|
|
225
|
+
return pseudoTtyProcess;
|
|
217
226
|
}
|
|
218
|
-
return new RunningNodeProcess(commandConfig, color, cwd, env, [], streamOutput, envFile);
|
|
227
|
+
return new RunningNodeProcess(commandConfig, color, cwd, env, [], streamOutput, envFile, taskId);
|
|
219
228
|
}
|
|
220
229
|
}
|
|
221
230
|
exports.SeriallyRunningTasks = SeriallyRunningTasks;
|
|
222
231
|
class RunningNodeProcess {
|
|
223
|
-
constructor(commandConfig, color, cwd, env, readyWhenStatus, streamOutput = true, envFile) {
|
|
232
|
+
constructor(commandConfig, color, cwd, env, readyWhenStatus, streamOutput = true, envFile, taskId) {
|
|
224
233
|
this.readyWhenStatus = readyWhenStatus;
|
|
234
|
+
this.taskId = taskId;
|
|
225
235
|
this.terminalOutput = '';
|
|
226
236
|
this.exitCallbacks = [];
|
|
227
237
|
this.outputCallbacks = [];
|
|
@@ -237,6 +247,11 @@ class RunningNodeProcess {
|
|
|
237
247
|
cwd,
|
|
238
248
|
windowsHide: false,
|
|
239
249
|
});
|
|
250
|
+
// Register process for metrics collection
|
|
251
|
+
// Skip registration if we're in a forked executor - the fork wrapper already registered
|
|
252
|
+
if (this.childProcess.pid && !process.env.NX_FORKED_TASK_EXECUTOR) {
|
|
253
|
+
(0, process_metrics_service_1.getProcessMetricsService)().registerTaskProcess(this.taskId, this.childProcess.pid);
|
|
254
|
+
}
|
|
240
255
|
this.addListeners(commandConfig, streamOutput);
|
|
241
256
|
}
|
|
242
257
|
getResults() {
|
|
@@ -341,9 +356,15 @@ class RunningNodeProcess {
|
|
|
341
356
|
});
|
|
342
357
|
}
|
|
343
358
|
}
|
|
344
|
-
async function runSingleCommandWithPseudoTerminal(normalized, context) {
|
|
359
|
+
async function runSingleCommandWithPseudoTerminal(normalized, context, taskId) {
|
|
345
360
|
const pseudoTerminal = (0, pseudo_terminal_1.createPseudoTerminal)();
|
|
346
361
|
const pseudoTtyProcess = await createProcessWithPseudoTty(pseudoTerminal, normalized.commands[0], normalized.color, calculateCwd(normalized.cwd, context), normalized.env, normalized.streamOutput, pseudoTerminal ? normalized.isTTY : false, normalized.envFile);
|
|
362
|
+
// Register process for metrics collection (direct run-commands execution)
|
|
363
|
+
// Skip registration if we're in a forked executor - the fork wrapper already registered
|
|
364
|
+
const pid = pseudoTtyProcess.getPid();
|
|
365
|
+
if (pid && !process.env.NX_FORKED_TASK_EXECUTOR) {
|
|
366
|
+
(0, process_metrics_service_1.getProcessMetricsService)().registerTaskProcess(taskId, pid);
|
|
367
|
+
}
|
|
347
368
|
registerProcessListener(pseudoTtyProcess, pseudoTerminal);
|
|
348
369
|
return pseudoTtyProcess;
|
|
349
370
|
}
|
package/src/native/index.d.ts
CHANGED
|
@@ -27,6 +27,7 @@ export declare class AppLifeCycle {
|
|
|
27
27
|
|
|
28
28
|
export declare class ChildProcess {
|
|
29
29
|
getParserAndWriter(): ExternalObject<[ParserArc, WriterArc]>
|
|
30
|
+
getPid(): number
|
|
30
31
|
kill(signal?: NodeJS.Signals): void
|
|
31
32
|
onExit(callback: (message: string) => void): void
|
|
32
33
|
onOutput(callback: (message: string) => void): void
|
|
@@ -92,6 +93,45 @@ export declare class NxTaskHistory {
|
|
|
92
93
|
getEstimatedTaskTimings(targets: Array<TaskTarget>): Record<string, number>
|
|
93
94
|
}
|
|
94
95
|
|
|
96
|
+
/**
|
|
97
|
+
* High-performance metrics collector for Nx tasks
|
|
98
|
+
* Thread-safe and designed for minimal overhead
|
|
99
|
+
*/
|
|
100
|
+
export declare class ProcessMetricsCollector {
|
|
101
|
+
/** Create a new ProcessMetricsCollector with default configuration */
|
|
102
|
+
constructor()
|
|
103
|
+
/**
|
|
104
|
+
* Start metrics collection
|
|
105
|
+
* Idempotent - safe to call multiple times
|
|
106
|
+
*/
|
|
107
|
+
startCollection(): void
|
|
108
|
+
/**
|
|
109
|
+
* Stop metrics collection
|
|
110
|
+
* Returns true if collection was stopped, false if not running
|
|
111
|
+
*/
|
|
112
|
+
stopCollection(): boolean
|
|
113
|
+
/**
|
|
114
|
+
* Get system information (CPU cores and total memory)
|
|
115
|
+
* This is separate from the collection interval and meant to be called imperatively
|
|
116
|
+
*/
|
|
117
|
+
getSystemInfo(): SystemInfo
|
|
118
|
+
/** Register the main CLI process for metrics collection */
|
|
119
|
+
registerMainCliProcess(pid: number): void
|
|
120
|
+
/** Register the daemon process for metrics collection */
|
|
121
|
+
registerDaemonProcess(pid: number): void
|
|
122
|
+
/**
|
|
123
|
+
* Register a process for a specific task
|
|
124
|
+
* Automatically creates the task if it doesn't exist
|
|
125
|
+
*/
|
|
126
|
+
registerTaskProcess(taskId: string, pid: number): void
|
|
127
|
+
/** Register a batch with multiple tasks sharing a worker */
|
|
128
|
+
registerBatch(batchId: string, taskIds: Array<string>, pid: number): void
|
|
129
|
+
/** Register a subprocess of the main CLI for metrics collection */
|
|
130
|
+
registerMainCliSubprocess(pid: number): void
|
|
131
|
+
/** Subscribe to push-based metrics notifications from TypeScript */
|
|
132
|
+
subscribe(callback: (err: Error | null, event: MetricsUpdate) => void): void
|
|
133
|
+
}
|
|
134
|
+
|
|
95
135
|
export declare class RunningTasksService {
|
|
96
136
|
constructor(db: ExternalObject<NxDbConnection>)
|
|
97
137
|
getRunningTasks(ids: Array<string>): Array<string>
|
|
@@ -153,6 +193,13 @@ export declare class WorkspaceContext {
|
|
|
153
193
|
getFilesInDirectory(directory: string): Array<string>
|
|
154
194
|
}
|
|
155
195
|
|
|
196
|
+
/** Batch metrics snapshot */
|
|
197
|
+
export interface BatchMetricsSnapshot {
|
|
198
|
+
batchId: string
|
|
199
|
+
taskIds: Array<string>
|
|
200
|
+
processes: Array<ProcessMetrics>
|
|
201
|
+
}
|
|
202
|
+
|
|
156
203
|
export interface CachedResult {
|
|
157
204
|
code: number
|
|
158
205
|
terminalOutput?: string
|
|
@@ -264,6 +311,12 @@ export declare export declare function isEditorInstalled(editor: SupportedEditor
|
|
|
264
311
|
|
|
265
312
|
export declare export declare function logDebug(message: string): void
|
|
266
313
|
|
|
314
|
+
/** Metrics update sent every collection cycle */
|
|
315
|
+
export interface MetricsUpdate {
|
|
316
|
+
metrics: ProcessMetricsSnapshot
|
|
317
|
+
metadata?: Record<string, ProcessMetadata>
|
|
318
|
+
}
|
|
319
|
+
|
|
267
320
|
/** Stripped version of the NxJson interface for use in rust */
|
|
268
321
|
export interface NxJson {
|
|
269
322
|
namedInputs?: Record<string, Array<JsInputs>>
|
|
@@ -283,6 +336,37 @@ export interface NxWorkspaceFilesExternals {
|
|
|
283
336
|
|
|
284
337
|
export declare export declare function parseTaskStatus(stringStatus: string): TaskStatus
|
|
285
338
|
|
|
339
|
+
/** Process metadata (static, doesn't change during process lifetime) */
|
|
340
|
+
export interface ProcessMetadata {
|
|
341
|
+
ppid: number
|
|
342
|
+
name: string
|
|
343
|
+
command: string
|
|
344
|
+
exePath: string
|
|
345
|
+
cwd: string
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
/** Process metrics (dynamic, changes every collection) */
|
|
349
|
+
export interface ProcessMetrics {
|
|
350
|
+
pid: number
|
|
351
|
+
cpu: number
|
|
352
|
+
memory: number
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
/** Organized collection of process metrics with timestamp */
|
|
356
|
+
export interface ProcessMetricsSnapshot {
|
|
357
|
+
timestamp: number
|
|
358
|
+
mainCli?: ProcessTreeMetrics
|
|
359
|
+
daemon?: ProcessTreeMetrics
|
|
360
|
+
tasks: Record<string, Array<ProcessMetrics>>
|
|
361
|
+
batches: Record<string, BatchMetricsSnapshot>
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
/** Metrics for a process and its subprocesses (used for both CLI and daemon) */
|
|
365
|
+
export interface ProcessTreeMetrics {
|
|
366
|
+
main: ProcessMetrics
|
|
367
|
+
subprocesses: Array<ProcessMetrics>
|
|
368
|
+
}
|
|
369
|
+
|
|
286
370
|
export interface Project {
|
|
287
371
|
root: string
|
|
288
372
|
namedInputs?: Record<string, Array<JsInputs>>
|
|
@@ -318,6 +402,12 @@ export declare const enum SupportedEditor {
|
|
|
318
402
|
Unknown = 5
|
|
319
403
|
}
|
|
320
404
|
|
|
405
|
+
/** System information (static system-level data) */
|
|
406
|
+
export interface SystemInfo {
|
|
407
|
+
cpuCores: number
|
|
408
|
+
totalMemory: number
|
|
409
|
+
}
|
|
410
|
+
|
|
321
411
|
export interface Target {
|
|
322
412
|
executor?: string
|
|
323
413
|
inputs?: Array<JsInputs>
|
|
@@ -371,6 +371,7 @@ module.exports.ImportResult = nativeBinding.ImportResult
|
|
|
371
371
|
module.exports.NxCache = nativeBinding.NxCache
|
|
372
372
|
module.exports.NxConsolePreferences = nativeBinding.NxConsolePreferences
|
|
373
373
|
module.exports.NxTaskHistory = nativeBinding.NxTaskHistory
|
|
374
|
+
module.exports.ProcessMetricsCollector = nativeBinding.ProcessMetricsCollector
|
|
374
375
|
module.exports.RunningTasksService = nativeBinding.RunningTasksService
|
|
375
376
|
module.exports.RustPseudoTerminal = nativeBinding.RustPseudoTerminal
|
|
376
377
|
module.exports.TaskDetails = nativeBinding.TaskDetails
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-pool.d.ts","sourceRoot":"","sources":["../../../../../../../packages/nx/src/project-graph/plugins/isolation/plugin-pool.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAK9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AA8C1D,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,mBAAmB,EAC3B,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"plugin-pool.d.ts","sourceRoot":"","sources":["../../../../../../../packages/nx/src/project-graph/plugins/isolation/plugin-pool.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAK9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AA8C1D,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,mBAAmB,EAC3B,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC,CAAC,CAgFhD"}
|
|
@@ -33,6 +33,22 @@ async function loadRemoteNxPlugin(plugin, root) {
|
|
|
33
33
|
const moduleName = typeof plugin === 'string' ? plugin : plugin.plugin;
|
|
34
34
|
const { name, pluginPath, shouldRegisterTSTranspiler } = await (0, resolve_plugin_1.resolveNxPlugin)(moduleName, root, (0, installation_directory_1.getNxRequirePaths)(root));
|
|
35
35
|
const { worker, socket } = await startPluginWorker();
|
|
36
|
+
// Register plugin worker as a subprocess of the main CLI
|
|
37
|
+
// This allows metrics collection when the daemon is not used
|
|
38
|
+
if (worker.pid) {
|
|
39
|
+
try {
|
|
40
|
+
const { isDaemonEnabled } = await Promise.resolve().then(() => require('../../../daemon/client/client'));
|
|
41
|
+
// Only register if daemon is not enabled - when daemon is enabled,
|
|
42
|
+
// plugin workers are spawned as children of the daemon and tracked automatically
|
|
43
|
+
if (!isDaemonEnabled()) {
|
|
44
|
+
const { getProcessMetricsService } = await Promise.resolve().then(() => require('../../../tasks-runner/process-metrics-service'));
|
|
45
|
+
getProcessMetricsService().registerMainCliSubprocess(worker.pid);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
catch {
|
|
49
|
+
// Silently ignore - metrics collection is optional
|
|
50
|
+
}
|
|
51
|
+
}
|
|
36
52
|
const pendingPromises = new Map();
|
|
37
53
|
const exitHandler = createWorkerExitHandler(worker, pendingPromises);
|
|
38
54
|
const cleanupFunction = () => {
|
|
@@ -271,7 +287,7 @@ async function startPluginWorker() {
|
|
|
271
287
|
}
|
|
272
288
|
: {}),
|
|
273
289
|
};
|
|
274
|
-
const ipcPath = (0, socket_utils_1.getPluginOsSocketPath)([process.pid, global.nxPluginWorkerCount
|
|
290
|
+
const ipcPath = (0, socket_utils_1.getPluginOsSocketPath)([process.pid, global.nxPluginWorkerCount++, performance.now()].join('-'));
|
|
275
291
|
const worker = (0, child_process_1.spawn)(process.execPath, [
|
|
276
292
|
...(isWorkerTypescript ? ['--require', 'ts-node/register'] : []),
|
|
277
293
|
workerPath,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-task-graph.d.ts","sourceRoot":"","sources":["../../../../../packages/nx/src/tasks-runner/create-task-graph.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"create-task-graph.d.ts","sourceRoot":"","sources":["../../../../../packages/nx/src/tasks-runner/create-task-graph.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAWhF,OAAO,EA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O,EAAE,uBAAuB,EAChC,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,MAAM,GAAG,SAAS;CASpC;AAED,wBAAgB,eAAe,CAC7B,YAAY,EAAE,YAAY,EAC1B,uBAAuB,EAAE,kBAAkB,EAC3C,YAAY,EAAE,MAAM,EAAE,EACtB,OAAO,EAAE,MAAM,EAAE,EACjB,aAAa,EAAE,MAAM,GAAG,SAAS,EACjC,SAAS,EAAE,MAAM,EACjB,uBAAuB,GAAE,OAAe,GACvC,SAAS,CAgBX;AAED,wBAAgB,+BAA+B,CAC7C,QAAQ,EAAE,cAAc,GAAG,SAAS,GACnC,kBAAkB,CAOpB;AAsBD;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,YAAY,EAAE;IAAE,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;CAAE,QAoBvE;AAED;;GAEG;AACH,wBAAgB,eAAe,CAC7B,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE;IAAE,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;CAAE,EACvC,MAAM,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,EACpB,IAAI,GAAE,GAAG,CAAC,MAAM,CAAa,GAC5B,MAAM,EAAE,CAkBV"}
|
|
@@ -33,7 +33,7 @@ class ProcessTasks {
|
|
|
33
33
|
const project = this.projectGraph.nodes[projectName];
|
|
34
34
|
if (targets.length === 1 || project.data.targets[target]) {
|
|
35
35
|
const resolvedConfiguration = this.resolveConfiguration(project, target, configuration);
|
|
36
|
-
const id = createTaskId(projectName, target, resolvedConfiguration);
|
|
36
|
+
const id = (0, utils_1.createTaskId)(projectName, target, resolvedConfiguration);
|
|
37
37
|
const task = this.createTask(id, project, target, resolvedConfiguration, overrides);
|
|
38
38
|
this.tasks[task.id] = task;
|
|
39
39
|
this.dependencies[task.id] = [];
|
|
@@ -118,7 +118,7 @@ class ProcessTasks {
|
|
|
118
118
|
const selfProject = this.projectGraph.nodes[projectName];
|
|
119
119
|
if ((0, project_graph_utils_1.projectHasTarget)(selfProject, dependencyConfig.target)) {
|
|
120
120
|
const resolvedConfiguration = this.resolveConfiguration(selfProject, dependencyConfig.target, configuration);
|
|
121
|
-
const selfTaskId = createTaskId(selfProject.name, dependencyConfig.target, resolvedConfiguration);
|
|
121
|
+
const selfTaskId = (0, utils_1.createTaskId)(selfProject.name, dependencyConfig.target, resolvedConfiguration);
|
|
122
122
|
if (!this.tasks[selfTaskId]) {
|
|
123
123
|
const newTask = this.createTask(selfTaskId, selfProject, dependencyConfig.target, resolvedConfiguration, taskOverrides);
|
|
124
124
|
this.tasks[selfTaskId] = newTask;
|
|
@@ -147,7 +147,7 @@ class ProcessTasks {
|
|
|
147
147
|
continue;
|
|
148
148
|
if ((0, project_graph_utils_1.projectHasTarget)(depProject, dependencyConfig.target)) {
|
|
149
149
|
const resolvedConfiguration = this.resolveConfiguration(depProject, dependencyConfig.target, configuration);
|
|
150
|
-
const depTargetId = createTaskId(depProject.name, dependencyConfig.target, resolvedConfiguration);
|
|
150
|
+
const depTargetId = (0, utils_1.createTaskId)(depProject.name, dependencyConfig.target, resolvedConfiguration);
|
|
151
151
|
const depTargetConfiguration = this.projectGraph.nodes[depProject.name].data.targets[dependencyConfig.target];
|
|
152
152
|
if (task.id !== depTargetId) {
|
|
153
153
|
if (depTargetConfiguration.continuous) {
|
|
@@ -167,7 +167,7 @@ class ProcessTasks {
|
|
|
167
167
|
}
|
|
168
168
|
else {
|
|
169
169
|
// Create a dummy task for task.target.project... which simulates if depProject had dependencyConfig.target
|
|
170
|
-
const dummyId = createTaskId(depProject.name, task.target.project +
|
|
170
|
+
const dummyId = (0, utils_1.createTaskId)(depProject.name, task.target.project +
|
|
171
171
|
task.target.target +
|
|
172
172
|
'__' +
|
|
173
173
|
dependencyConfig.target +
|
|
@@ -307,10 +307,3 @@ function createTaskOverrides(dependencyConfig, cliOverrides, sourceTask, project
|
|
|
307
307
|
? { ...optionsToForward, ...cliOverrides }
|
|
308
308
|
: { ...optionsToForward, __overrides_unparsed__: [] };
|
|
309
309
|
}
|
|
310
|
-
function createTaskId(project, target, configuration) {
|
|
311
|
-
let id = `${project}:${target}`;
|
|
312
|
-
if (configuration) {
|
|
313
|
-
id += `:${configuration}`;
|
|
314
|
-
}
|
|
315
|
-
return id;
|
|
316
|
-
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"forked-process-task-runner.d.ts","sourceRoot":"","sources":["../../../../../packages/nx/src/tasks-runner/forked-process-task-runner.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AAGnE,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAIzC,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAkB,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAErE,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAKvD,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"forked-process-task-runner.d.ts","sourceRoot":"","sources":["../../../../../packages/nx/src/tasks-runner/forked-process-task-runner.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AAGnE,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAIzC,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAkB,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAErE,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAKvD,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAQ3D,qBAAa,uBAAuB;IA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,CAAC,8BAA8B;IAmEtC,OAAO,CAAC,8BAA8B;IA2EtC,OAAO,CAAC,mBAAmB;IAI3B,OAAO,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,OAAO;IAO/B,OAAO,CAAC,0BAA0B;CAwCnC"}
|
|
@@ -13,6 +13,7 @@ const exit_codes_1 = require("../utils/exit-codes");
|
|
|
13
13
|
const node_child_process_1 = require("./running-tasks/node-child-process");
|
|
14
14
|
const batch_process_1 = require("./running-tasks/batch-process");
|
|
15
15
|
const native_1 = require("../native");
|
|
16
|
+
const process_metrics_service_1 = require("./process-metrics-service");
|
|
16
17
|
const forkScript = (0, path_1.join)(__dirname, './fork.js');
|
|
17
18
|
const workerPath = (0, path_1.join)(__dirname, './batch/run-batch.js');
|
|
18
19
|
class ForkedProcessTaskRunner {
|
|
@@ -40,8 +41,17 @@ class ForkedProcessTaskRunner {
|
|
|
40
41
|
}
|
|
41
42
|
const p = (0, child_process_1.fork)(workerPath, {
|
|
42
43
|
stdio: ['inherit', 'inherit', 'inherit', 'ipc'],
|
|
43
|
-
env
|
|
44
|
+
env: {
|
|
45
|
+
...env,
|
|
46
|
+
NX_FORKED_TASK_EXECUTOR: 'true',
|
|
47
|
+
},
|
|
44
48
|
});
|
|
49
|
+
// Register batch worker process with all tasks
|
|
50
|
+
if (p.pid) {
|
|
51
|
+
const batchId = `${executorName}-${p.pid}`;
|
|
52
|
+
const taskIds = Object.keys(batchTaskGraph.tasks);
|
|
53
|
+
(0, process_metrics_service_1.getProcessMetricsService)().registerBatch(batchId, taskIds, p.pid);
|
|
54
|
+
}
|
|
45
55
|
const cp = new batch_process_1.BatchProcess(p, executorName);
|
|
46
56
|
this.processes.add(cp);
|
|
47
57
|
cp.onExit(() => {
|
|
@@ -124,10 +134,18 @@ class ForkedProcessTaskRunner {
|
|
|
124
134
|
const p = await pseudoTerminal.fork(childId, forkScript, {
|
|
125
135
|
cwd: process.cwd(),
|
|
126
136
|
execArgv: process.execArgv,
|
|
127
|
-
jsEnv:
|
|
137
|
+
jsEnv: {
|
|
138
|
+
...env,
|
|
139
|
+
NX_FORKED_TASK_EXECUTOR: 'true',
|
|
140
|
+
},
|
|
128
141
|
quiet: !streamOutput,
|
|
129
142
|
commandLabel: `nx run ${task.id}`,
|
|
130
143
|
});
|
|
144
|
+
// Register forked process for metrics collection
|
|
145
|
+
const pid = p.getPid();
|
|
146
|
+
if (pid) {
|
|
147
|
+
(0, process_metrics_service_1.getProcessMetricsService)().registerTaskProcess(task.id, pid);
|
|
148
|
+
}
|
|
131
149
|
p.send({
|
|
132
150
|
targetDescription: task.target,
|
|
133
151
|
overrides: task.overrides,
|
|
@@ -160,8 +178,15 @@ class ForkedProcessTaskRunner {
|
|
|
160
178
|
}
|
|
161
179
|
const p = (0, child_process_1.fork)(this.cliPath, {
|
|
162
180
|
stdio: ['inherit', 'pipe', 'pipe', 'ipc'],
|
|
163
|
-
env
|
|
181
|
+
env: {
|
|
182
|
+
...env,
|
|
183
|
+
NX_FORKED_TASK_EXECUTOR: 'true',
|
|
184
|
+
},
|
|
164
185
|
});
|
|
186
|
+
// Register forked process for metrics collection
|
|
187
|
+
if (p.pid) {
|
|
188
|
+
(0, process_metrics_service_1.getProcessMetricsService)().registerTaskProcess(task.id, p.pid);
|
|
189
|
+
}
|
|
165
190
|
// Send message to run the executor
|
|
166
191
|
p.send({
|
|
167
192
|
targetDescription: task.target,
|
|
@@ -196,8 +221,15 @@ class ForkedProcessTaskRunner {
|
|
|
196
221
|
}
|
|
197
222
|
const p = (0, child_process_1.fork)(this.cliPath, {
|
|
198
223
|
stdio: ['inherit', 'inherit', 'inherit', 'ipc'],
|
|
199
|
-
env
|
|
224
|
+
env: {
|
|
225
|
+
...env,
|
|
226
|
+
NX_FORKED_TASK_EXECUTOR: 'true',
|
|
227
|
+
},
|
|
200
228
|
});
|
|
229
|
+
// Register forked process for metrics collection
|
|
230
|
+
if (p.pid) {
|
|
231
|
+
(0, process_metrics_service_1.getProcessMetricsService)().registerTaskProcess(task.id, p.pid);
|
|
232
|
+
}
|
|
201
233
|
const cp = new node_child_process_1.NodeChildProcessWithDirectOutput(p, temporaryOutputPath);
|
|
202
234
|
this.processes.add(cp);
|
|
203
235
|
// Send message to run the executor
|