Skip to content

Commit 4465c0b

Browse files
committed
transfer final attempt output to the task run
1 parent bcbe9f6 commit 4465c0b

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

apps/webapp/app/v3/services/finalizeTaskRun.server.ts

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,29 @@ export class FinalizeTaskRunService extends BaseService {
6060
completedAt,
6161
});
6262

63+
let output: string | undefined = undefined;
64+
let outputType: string | undefined = undefined;
65+
66+
if (status === "COMPLETED_SUCCESSFULLY") {
67+
// We need to get the output from the attempt
68+
const attempt = await this._prisma.taskRunAttempt.findFirst({
69+
where: { taskRunId: id, status: "COMPLETED", output: { not: null } },
70+
orderBy: { id: "desc" },
71+
select: {
72+
output: true,
73+
outputType: true,
74+
},
75+
});
76+
77+
if (attempt) {
78+
output = attempt.output ?? undefined;
79+
outputType = attempt.outputType;
80+
}
81+
}
82+
6383
const run = await this._prisma.taskRun.update({
6484
where: { id },
65-
data: { status, expiredAt, completedAt },
85+
data: { status, expiredAt, completedAt, output, outputType },
6686
...(include ? { include } : {}),
6787
});
6888

references/v3-catalog/src/trigger/runMetadata.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ export const runMetadataChildTask = task({
4242
await runMetadataChildTask2.triggerAndWait(payload, {
4343
metadata: metadata.current(),
4444
});
45+
46+
return metadata.current();
4547
},
4648
onStart: async () => {
4749
logger.info("metadata", { metadata: metadata.current() });

0 commit comments

Comments
 (0)