fix(core): match tasks by id in run-many terminal output lifecycles (#17460)
This commit is contained in:
parent
f0be962ae5
commit
2d87f77217
@ -437,7 +437,7 @@ export async function createRunManyDynamicOutputRenderer({
|
|||||||
lifeCycle.endTasks = (taskResults) => {
|
lifeCycle.endTasks = (taskResults) => {
|
||||||
for (let t of taskResults) {
|
for (let t of taskResults) {
|
||||||
totalCompletedTasks++;
|
totalCompletedTasks++;
|
||||||
const matchingTaskRow = taskRows.find((r) => r.task === t.task);
|
const matchingTaskRow = taskRows.find((r) => r.task.id === t.task.id);
|
||||||
if (matchingTaskRow) {
|
if (matchingTaskRow) {
|
||||||
matchingTaskRow.status = t.status;
|
matchingTaskRow.status = t.status;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,7 +16,7 @@ import { formatFlags, formatTargetsAndProjects } from './formatting-utils';
|
|||||||
export class StaticRunManyTerminalOutputLifeCycle implements LifeCycle {
|
export class StaticRunManyTerminalOutputLifeCycle implements LifeCycle {
|
||||||
failedTasks = [] as Task[];
|
failedTasks = [] as Task[];
|
||||||
cachedTasks = [] as Task[];
|
cachedTasks = [] as Task[];
|
||||||
allCompletedTasks = new Set<Task>();
|
allCompletedTasks = new Map<string, Task>();
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private readonly projectNames: string[],
|
private readonly projectNames: string[],
|
||||||
@ -123,14 +123,14 @@ export class StaticRunManyTerminalOutputLifeCycle implements LifeCycle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private skippedTasks() {
|
private skippedTasks() {
|
||||||
return this.tasks.filter((t) => !this.allCompletedTasks.has(t));
|
return this.tasks.filter((t) => !this.allCompletedTasks.has(t.id));
|
||||||
}
|
}
|
||||||
|
|
||||||
endTasks(
|
endTasks(
|
||||||
taskResults: { task: Task; status: TaskStatus; code: number }[]
|
taskResults: { task: Task; status: TaskStatus; code: number }[]
|
||||||
): void {
|
): void {
|
||||||
for (let t of taskResults) {
|
for (let t of taskResults) {
|
||||||
this.allCompletedTasks.add(t.task);
|
this.allCompletedTasks.set(t.task.id, t.task);
|
||||||
if (t.status === 'failure') {
|
if (t.status === 'failure') {
|
||||||
this.failedTasks.push(t.task);
|
this.failedTasks.push(t.task);
|
||||||
} else if (t.status === 'local-cache') {
|
} else if (t.status === 'local-cache') {
|
||||||
|
|||||||
@ -144,7 +144,7 @@ export class TaskOrchestrator {
|
|||||||
task: Task;
|
task: Task;
|
||||||
status: 'local-cache' | 'local-cache-kept-existing' | 'remote-cache';
|
status: 'local-cache' | 'local-cache-kept-existing' | 'remote-cache';
|
||||||
}> {
|
}> {
|
||||||
const startTime = new Date().getTime();
|
task.startTime = Date.now();
|
||||||
const cachedResult = await this.cache.get(task);
|
const cachedResult = await this.cache.get(task);
|
||||||
if (!cachedResult || cachedResult.code !== 0) return null;
|
if (!cachedResult || cachedResult.code !== 0) return null;
|
||||||
|
|
||||||
@ -155,6 +155,7 @@ export class TaskOrchestrator {
|
|||||||
if (shouldCopyOutputsFromCache) {
|
if (shouldCopyOutputsFromCache) {
|
||||||
await this.cache.copyFilesFromCache(task.hash, cachedResult, outputs);
|
await this.cache.copyFilesFromCache(task.hash, cachedResult, outputs);
|
||||||
}
|
}
|
||||||
|
task.endTime = Date.now();
|
||||||
const status = cachedResult.remote
|
const status = cachedResult.remote
|
||||||
? 'remote-cache'
|
? 'remote-cache'
|
||||||
: shouldCopyOutputsFromCache
|
: shouldCopyOutputsFromCache
|
||||||
@ -166,11 +167,7 @@ export class TaskOrchestrator {
|
|||||||
cachedResult.terminalOutput
|
cachedResult.terminalOutput
|
||||||
);
|
);
|
||||||
return {
|
return {
|
||||||
task: {
|
task,
|
||||||
...task,
|
|
||||||
startTime,
|
|
||||||
endTime: Date.now(),
|
|
||||||
},
|
|
||||||
status,
|
status,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user