Skip to content

Commit

Permalink
prevent creating checkpoints for outdated batch waits
Browse files Browse the repository at this point in the history
  • Loading branch information
nicktrn committed Oct 17, 2024
1 parent 11066b4 commit f2b5c2a
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions apps/webapp/app/v3/services/createCheckpoint.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ export class CreateCheckpointService extends BaseService {
logger.error("CreateCheckpointService: Checkpoint not for most recent child run", {
attemptId: attempt.id,
runId: attempt.taskRunId,
lastChild: lastChildRun.friendlyId,
checkpointFor: reason.friendlyId,
params,
});

Expand All @@ -134,6 +136,33 @@ export class CreateCheckpointService extends BaseService {
break;
}
case "WAIT_FOR_BATCH": {
const lastChildRun = attempt.taskRun.childRuns[0];

if (!lastChildRun) {
logger.warn("CreateCheckpointService: No child runs, creating checkpoint regardless", {
attemptId: attempt.id,
runId: attempt.taskRunId,
params,
});

break;
}

if (!reason.runFriendlyIds.includes(lastChildRun.friendlyId)) {
logger.error("CreateCheckpointService: Checkpoint not for most recent batch", {
attemptId: attempt.id,
runId: attempt.taskRunId,
lastChild: lastChildRun.friendlyId,
checkpointFor: reason.runFriendlyIds,
params,
});

return {
success: false,
keepRunAlive: true,
};
}

break;
}
default: {
Expand Down

0 comments on commit f2b5c2a

Please sign in to comment.