Skip to content

Commit 93bc32c

Browse files
committed
Checkpoint restoring should of triggerAndWait should use the child run
1 parent 36397d0 commit 93bc32c

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

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

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,21 +169,43 @@ export class CreateCheckpointService extends BaseService {
169169
attemptId: attempt.id,
170170
taskRunId: attempt.taskRunId,
171171
type: "WAIT_FOR_TASK",
172+
reason,
172173
});
173174
await marqs?.cancelHeartbeat(attempt.taskRunId);
174175

176+
const childRun = await this._prisma.taskRun.findFirst({
177+
where: {
178+
friendlyId: reason.friendlyId,
179+
},
180+
});
181+
182+
if (!childRun) {
183+
logger.error("CreateCheckpointService: WAIT_FOR_TASK child run not found", {
184+
friendlyId: reason.friendlyId,
185+
});
186+
187+
return {
188+
success: true,
189+
checkpoint,
190+
event: checkpointEvent,
191+
keepRunAlive: false,
192+
};
193+
}
194+
175195
const resumeService = new ResumeDependentParentsService(this._prisma);
176-
const result = await resumeService.call({ id: attempt.taskRunId });
196+
const result = await resumeService.call({ id: childRun.id });
177197

178198
if (result.success) {
179199
logger.log("CreateCheckpointService: Resumed dependent parents", {
180200
result,
201+
childRun,
181202
attempt,
182203
checkpointEvent,
183204
});
184205
} else {
185206
logger.error("CreateCheckpointService: Failed to resume dependent parents", {
186207
result,
208+
childRun,
187209
attempt,
188210
checkpointEvent,
189211
});

0 commit comments

Comments
 (0)