Skip to content

Commit eea6ce3

Browse files
committed
don't throw afet abort cleanup
1 parent 1643743 commit eea6ce3

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

packages/cli-v3/src/entryPoints/managed/execution.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import { RunExecutionHeartbeat } from "./heartbeat.js";
1818
import { RunExecutionSnapshotPoller } from "./poller.js";
1919
import { assertExhaustive, tryCatch } from "@trigger.dev/core/utils";
2020
import { MetadataClient } from "./overrides.js";
21+
import { randomBytes } from "node:crypto";
2122

2223
class ExecutionAbortError extends Error {
2324
constructor(message: string) {
@@ -46,6 +47,7 @@ type RunExecutionRunOptions = {
4647
};
4748

4849
export class RunExecution {
50+
private id: string;
4951
private executionAbortController: AbortController;
5052

5153
private _runFriendlyId?: string;
@@ -65,6 +67,7 @@ export class RunExecution {
6567
private snapshotPoller?: RunExecutionSnapshotPoller;
6668

6769
constructor(opts: RunExecutionOptions) {
70+
this.id = randomBytes(4).toString("hex");
6871
this.workerManifest = opts.workerManifest;
6972
this.env = opts.env;
7073
this.httpClient = opts.httpClient;
@@ -578,20 +581,15 @@ export class RunExecution {
578581
this.taskRunProcess = this.createTaskRunProcess({ envVars, isWarmStart });
579582
}
580583

581-
this.sendDebugLog("executing task run process", {
582-
attemptId: execution.attempt.id,
583-
runId: execution.run.id,
584-
});
584+
this.sendDebugLog("executing task run process", { runId: execution.run.id });
585585

586586
// Set up an abort handler that will cleanup the task run process
587587
this.executionAbortController.signal.addEventListener("abort", async () => {
588588
this.sendDebugLog("Execution aborted during task run, cleaning up process", {
589-
attemptId: execution.attempt.id,
590589
runId: execution.run.id,
591590
});
592591

593592
await this.taskRunProcess?.cleanup(true);
594-
throw new ExecutionAbortError("Execution aborted during task run");
595593
});
596594

597595
const completion = await this.taskRunProcess.execute(
@@ -871,6 +869,7 @@ export class RunExecution {
871869
...properties,
872870
runId: this.runFriendlyId,
873871
snapshotId: this.currentSnapshotId,
872+
executionId: this.id,
874873
executionRestoreCount: this.restoreCount,
875874
},
876875
});

0 commit comments

Comments
 (0)