Skip to content

Set taskRunAttemptId on batch task run items on completion #1658

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion apps/webapp/app/v3/services/batchTriggerV3.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -904,7 +904,8 @@ export async function completeBatchTaskRunItemV3(
itemId: string,
batchTaskRunId: string,
tx: PrismaClientOrTransaction,
scheduleResumeOnComplete = false
scheduleResumeOnComplete = false,
taskRunAttemptId?: string
) {
await $transaction(tx, "completeBatchTaskRunItemV3", async (tx, span) => {
span?.setAttribute("batch_id", batchTaskRunId);
Expand All @@ -917,6 +918,7 @@ export async function completeBatchTaskRunItemV3(
},
data: {
status: "COMPLETED",
taskRunAttemptId,
},
});

Expand Down
3 changes: 0 additions & 3 deletions apps/webapp/app/v3/services/resumeBatchRun.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ const finishedBatchRunStatuses = ["COMPLETED", "FAILED", "CANCELED"];

type RetrieveBatchRunResult = NonNullable<Awaited<ReturnType<typeof retrieveBatchRun>>>;

// {"batchRunId":"cm6l2qfs400d0dyiczcwiuwrp","dependentTaskAttempt":{"status":"PAUSED","id":"cm6l2qcqf00cydyicryir6xlu","taskRun":{"id":"cm6l2qaw200cudyicktkfh4k9","queue":"task/batch-trigger-sequentially","taskIdentifier":"batch-trigger-sequentially","concurrencyKey":null}},"checkpointEventId":"cm6l2qg7400dgdyicy6qx9s8u","timestamp":"2025-01-31T18:04:52.869Z","name":"webapp","message":"ResumeBatchRunService: Attempt is paused and has a checkpoint event","level":"debug","skipForwarding":true}
// {"batchRunId":"cm6l2qfs400d0dyiczcwiuwrp","dependentTaskAttempt":{"status":"PAUSED","id":"cm6l2qcqf00cydyicryir6xlu","taskRun":{"id":"cm6l2qaw200cudyicktkfh4k9","queue":"task/batch-trigger-sequentially","taskIdentifier":"batch-trigger-sequentially","concurrencyKey":null}},"checkpointEventId":"cm6l2qg7400dgdyicy6qx9s8u","hasCheckpointEvent":true,"timestamp":"2025-01-31T18:04:52.871Z","name":"webapp","message":"ResumeBatchRunService: with checkpoint was already completed","level":"debug","skipForwarding":true}

export class ResumeBatchRunService extends BaseService {
public async call(batchRunId: string) {
const batchRun = await this._prisma.batchTaskRun.findFirst({
Expand Down
3 changes: 2 additions & 1 deletion apps/webapp/app/v3/services/resumeDependentParents.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,8 @@ export class ResumeDependentParentsService extends BaseService {
batchTaskRunItem.id,
batchTaskRunItem.batchTaskRunId,
this._prisma,
true
true,
lastAttempt.id
);
} else {
logger.debug(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,13 @@ export class ResumeTaskRunDependenciesService extends BaseService {
taskAttempt: TaskRunAttempt
) {
if (batchTaskRun.batchVersion === "v3") {
await completeBatchTaskRunItemV3(batchItem.id, batchTaskRun.id, this._prisma, true);
await completeBatchTaskRunItemV3(
batchItem.id,
batchTaskRun.id,
this._prisma,
true,
taskAttempt.id
);
} else {
await $transaction(this._prisma, async (tx) => {
await tx.batchTaskRunItem.update({
Expand Down
Loading