Skip to content

Commit 00eb405

Browse files
leosvelperezFrozenPandaz
authored andcommitted
fix(core): use a consistent batch id between scheduler and task runner (#34392)
## Current Behavior Batch IDs are generated in two places: the task scheduler uses an incremental counter (`executorName N`) while the forked process task runner generates its own using the process PID (`executorName-pid`). This means the batch ID registered in metrics doesn't match the one used everywhere else. ## Expected Behavior Batch IDs are only created by the task scheduler. The forked process task runner uses the scheduler-assigned ID to ensure consistency across the system. (cherry picked from commit 5ae53ec)
1 parent 3badb93 commit 00eb405

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

packages/nx/src/tasks-runner/forked-process-task-runner.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export class ForkedProcessTaskRunner {
4444

4545
// TODO: vsavkin delegate terminal output printing
4646
public async forkProcessForBatch(
47-
{ executorName, taskGraph: batchTaskGraph }: Batch,
47+
{ id: batchId, executorName, taskGraph: batchTaskGraph }: Batch,
4848
projectGraph: ProjectGraph,
4949
fullTaskGraph: TaskGraph,
5050
env: NodeJS.ProcessEnv
@@ -73,7 +73,6 @@ export class ForkedProcessTaskRunner {
7373

7474
// Register batch worker process with all tasks
7575
if (p.pid) {
76-
const batchId = `${executorName}-${p.pid}`;
7776
const taskIds = Object.keys(batchTaskGraph.tasks);
7877
getProcessMetricsService().registerBatch(batchId, taskIds, p.pid);
7978
}

0 commit comments

Comments
 (0)