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) => {
|
||||
for (let t of taskResults) {
|
||||
totalCompletedTasks++;
|
||||
const matchingTaskRow = taskRows.find((r) => r.task === t.task);
|
||||
const matchingTaskRow = taskRows.find((r) => r.task.id === t.task.id);
|
||||
if (matchingTaskRow) {
|
||||
matchingTaskRow.status = t.status;
|
||||
}
|
||||
|
||||
@ -16,7 +16,7 @@ import { formatFlags, formatTargetsAndProjects } from './formatting-utils';
|
||||
export class StaticRunManyTerminalOutputLifeCycle implements LifeCycle {
|
||||
failedTasks = [] as Task[];
|
||||
cachedTasks = [] as Task[];
|
||||
allCompletedTasks = new Set<Task>();
|
||||
allCompletedTasks = new Map<string, Task>();
|
||||
|
||||
constructor(
|
||||
private readonly projectNames: string[],
|
||||
@ -123,14 +123,14 @@ export class StaticRunManyTerminalOutputLifeCycle implements LifeCycle {
|
||||
}
|
||||
|
||||
private skippedTasks() {
|
||||
return this.tasks.filter((t) => !this.allCompletedTasks.has(t));
|
||||
return this.tasks.filter((t) => !this.allCompletedTasks.has(t.id));
|
||||
}
|
||||
|
||||
endTasks(
|
||||
taskResults: { task: Task; status: TaskStatus; code: number }[]
|
||||
): void {
|
||||
for (let t of taskResults) {
|
||||
this.allCompletedTasks.add(t.task);
|
||||
this.allCompletedTasks.set(t.task.id, t.task);
|
||||
if (t.status === 'failure') {
|
||||
this.failedTasks.push(t.task);
|
||||
} else if (t.status === 'local-cache') {
|
||||
|
||||
@ -144,7 +144,7 @@ export class TaskOrchestrator {
|
||||
task: Task;
|
||||
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);
|
||||
if (!cachedResult || cachedResult.code !== 0) return null;
|
||||
|
||||
@ -155,6 +155,7 @@ export class TaskOrchestrator {
|
||||
if (shouldCopyOutputsFromCache) {
|
||||
await this.cache.copyFilesFromCache(task.hash, cachedResult, outputs);
|
||||
}
|
||||
task.endTime = Date.now();
|
||||
const status = cachedResult.remote
|
||||
? 'remote-cache'
|
||||
: shouldCopyOutputsFromCache
|
||||
@ -166,11 +167,7 @@ export class TaskOrchestrator {
|
||||
cachedResult.terminalOutput
|
||||
);
|
||||
return {
|
||||
task: {
|
||||
...task,
|
||||
startTime,
|
||||
endTime: Date.now(),
|
||||
},
|
||||
task,
|
||||
status,
|
||||
};
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user