trigger.dev 4.0.0-v4-beta.0 → 4.0.0-v4-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/dist/esm/build/bundle.js +7 -4
  2. package/dist/esm/build/bundle.js.map +1 -1
  3. package/dist/esm/commands/init.js +6 -3
  4. package/dist/esm/commands/init.js.map +1 -1
  5. package/dist/esm/dev/devSupervisor.js +14 -10
  6. package/dist/esm/dev/devSupervisor.js.map +1 -1
  7. package/dist/esm/entryPoints/dev-run-controller.js +6 -6
  8. package/dist/esm/entryPoints/dev-run-controller.js.map +1 -1
  9. package/dist/esm/entryPoints/dev-run-worker.js +28 -1
  10. package/dist/esm/entryPoints/dev-run-worker.js.map +1 -1
  11. package/dist/esm/entryPoints/managed/controller.d.ts +50 -0
  12. package/dist/esm/entryPoints/managed/controller.js +441 -0
  13. package/dist/esm/entryPoints/managed/controller.js.map +1 -0
  14. package/dist/esm/entryPoints/managed/env.d.ts +170 -0
  15. package/dist/esm/entryPoints/managed/env.js +191 -0
  16. package/dist/esm/entryPoints/managed/env.js.map +1 -0
  17. package/dist/esm/entryPoints/managed/execution.d.ts +94 -0
  18. package/dist/esm/entryPoints/managed/execution.js +638 -0
  19. package/dist/esm/entryPoints/managed/execution.js.map +1 -0
  20. package/dist/esm/entryPoints/managed/heartbeat.d.ts +23 -0
  21. package/dist/esm/entryPoints/managed/heartbeat.js +68 -0
  22. package/dist/esm/entryPoints/managed/heartbeat.js.map +1 -0
  23. package/dist/esm/entryPoints/managed/logger.d.ts +19 -0
  24. package/dist/esm/entryPoints/managed/logger.js +31 -0
  25. package/dist/esm/entryPoints/managed/logger.js.map +1 -0
  26. package/dist/esm/entryPoints/managed/overrides.d.ts +16 -0
  27. package/dist/esm/entryPoints/managed/overrides.js +17 -0
  28. package/dist/esm/entryPoints/managed/overrides.js.map +1 -0
  29. package/dist/esm/entryPoints/managed/poller.d.ts +26 -0
  30. package/dist/esm/entryPoints/managed/poller.js +94 -0
  31. package/dist/esm/entryPoints/managed/poller.js.map +1 -0
  32. package/dist/esm/entryPoints/managed-run-controller.js +8 -1347
  33. package/dist/esm/entryPoints/managed-run-controller.js.map +1 -1
  34. package/dist/esm/executions/taskRunProcess.d.ts +2 -2
  35. package/dist/esm/executions/taskRunProcess.js +1 -1
  36. package/dist/esm/executions/taskRunProcess.js.map +1 -1
  37. package/dist/esm/version.js +1 -1
  38. package/package.json +4 -4
@@ -0,0 +1,638 @@
1
+ import { SuspendedProcessError, } from "@trigger.dev/core/v3";
2
+ import { TaskRunProcess } from "../../executions/taskRunProcess.js";
3
+ import { setTimeout as sleep } from "timers/promises";
4
+ import { RunExecutionHeartbeat } from "./heartbeat.js";
5
+ import { RunExecutionSnapshotPoller } from "./poller.js";
6
+ import { assertExhaustive, tryCatch } from "@trigger.dev/core/utils";
7
+ import { MetadataClient } from "./overrides.js";
8
+ import { randomBytes } from "node:crypto";
9
+ class ExecutionAbortError extends Error {
10
+ constructor(message) {
11
+ super(message);
12
+ this.name = "ExecutionAbortError";
13
+ }
14
+ }
15
+ export class RunExecution {
16
+ id;
17
+ executionAbortController;
18
+ _runFriendlyId;
19
+ currentSnapshotId;
20
+ currentTaskRunEnv;
21
+ dequeuedAt;
22
+ podScheduledAt;
23
+ workerManifest;
24
+ env;
25
+ httpClient;
26
+ logger;
27
+ restoreCount;
28
+ taskRunProcess;
29
+ runHeartbeat;
30
+ snapshotPoller;
31
+ constructor(opts) {
32
+ this.id = randomBytes(4).toString("hex");
33
+ this.workerManifest = opts.workerManifest;
34
+ this.env = opts.env;
35
+ this.httpClient = opts.httpClient;
36
+ this.logger = opts.logger;
37
+ this.restoreCount = 0;
38
+ this.executionAbortController = new AbortController();
39
+ }
40
+ /**
41
+ * Prepares the execution with task run environment variables.
42
+ * This should be called before executing, typically after a successful run to prepare for the next one.
43
+ */
44
+ prepareForExecution(opts) {
45
+ if (this.taskRunProcess) {
46
+ throw new Error("prepareForExecution called after process was already created");
47
+ }
48
+ if (this.isPreparedForNextRun) {
49
+ throw new Error("prepareForExecution called after execution was already prepared");
50
+ }
51
+ this.taskRunProcess = this.createTaskRunProcess({
52
+ envVars: opts.taskRunEnv,
53
+ isWarmStart: true,
54
+ });
55
+ return this;
56
+ }
57
+ createTaskRunProcess({ envVars, isWarmStart, }) {
58
+ return new TaskRunProcess({
59
+ workerManifest: this.workerManifest,
60
+ env: {
61
+ ...envVars,
62
+ ...this.env.gatherProcessEnv(),
63
+ },
64
+ serverWorker: {
65
+ id: "managed",
66
+ contentHash: this.env.TRIGGER_CONTENT_HASH,
67
+ version: this.env.TRIGGER_DEPLOYMENT_VERSION,
68
+ engine: "V2",
69
+ },
70
+ machineResources: {
71
+ cpu: Number(this.env.TRIGGER_MACHINE_CPU),
72
+ memory: Number(this.env.TRIGGER_MACHINE_MEMORY),
73
+ },
74
+ isWarmStart,
75
+ }).initialize();
76
+ }
77
+ /**
78
+ * Returns true if the execution has been prepared with task run env.
79
+ */
80
+ get isPreparedForNextRun() {
81
+ return !!this.taskRunProcess?.isPreparedForNextRun;
82
+ }
83
+ /**
84
+ * Called by the RunController when it receives a websocket notification
85
+ * or when the snapshot poller detects a change
86
+ */
87
+ async handleSnapshotChange(runData) {
88
+ const { run, snapshot, completedWaitpoints } = runData;
89
+ const snapshotMetadata = {
90
+ incomingRunId: run.friendlyId,
91
+ incomingSnapshotId: snapshot.friendlyId,
92
+ completedWaitpoints: completedWaitpoints.length,
93
+ };
94
+ // Ensure we have run details
95
+ if (!this.runFriendlyId || !this.currentSnapshotId) {
96
+ this.sendDebugLog("handleSnapshotChange: missing run or snapshot ID", snapshotMetadata, run.friendlyId);
97
+ return;
98
+ }
99
+ // Ensure the run ID matches
100
+ if (run.friendlyId !== this.runFriendlyId) {
101
+ // Send debug log to both runs
102
+ this.sendDebugLog("handleSnapshotChange: mismatched run IDs", snapshotMetadata);
103
+ this.sendDebugLog("handleSnapshotChange: mismatched run IDs", snapshotMetadata, run.friendlyId);
104
+ return;
105
+ }
106
+ this.sendDebugLog(`enqueued snapshot change: ${snapshot.executionStatus}`, snapshotMetadata);
107
+ this.snapshotChangeQueue.push(runData);
108
+ await this.processSnapshotChangeQueue();
109
+ }
110
+ snapshotChangeQueue = [];
111
+ snapshotChangeQueueLock = false;
112
+ async processSnapshotChangeQueue() {
113
+ if (this.snapshotChangeQueueLock) {
114
+ return;
115
+ }
116
+ this.snapshotChangeQueueLock = true;
117
+ while (this.snapshotChangeQueue.length > 0) {
118
+ const runData = this.snapshotChangeQueue.shift();
119
+ if (!runData) {
120
+ continue;
121
+ }
122
+ const [error] = await tryCatch(this.processSnapshotChange(runData));
123
+ if (error) {
124
+ this.sendDebugLog("Failed to process snapshot change", { error: error.message });
125
+ }
126
+ }
127
+ this.snapshotChangeQueueLock = false;
128
+ }
129
+ async processSnapshotChange(runData) {
130
+ const { run, snapshot, completedWaitpoints } = runData;
131
+ const snapshotMetadata = {
132
+ incomingSnapshotId: snapshot.friendlyId,
133
+ completedWaitpoints: completedWaitpoints.length,
134
+ };
135
+ // Check if the incoming snapshot is newer than the current one
136
+ if (!this.currentSnapshotId || snapshot.friendlyId < this.currentSnapshotId) {
137
+ this.sendDebugLog("handleSnapshotChange: received older snapshot, skipping", snapshotMetadata);
138
+ return;
139
+ }
140
+ if (snapshot.friendlyId === this.currentSnapshotId) {
141
+ this.sendDebugLog("handleSnapshotChange: snapshot not changed", snapshotMetadata);
142
+ return;
143
+ }
144
+ this.sendDebugLog(`snapshot change: ${snapshot.executionStatus}`, snapshotMetadata);
145
+ // Reset the snapshot poll interval so we don't do unnecessary work
146
+ this.snapshotPoller?.resetCurrentInterval();
147
+ // Update internal state
148
+ this.currentSnapshotId = snapshot.friendlyId;
149
+ // Update services
150
+ this.runHeartbeat?.updateSnapshotId(snapshot.friendlyId);
151
+ this.snapshotPoller?.updateSnapshotId(snapshot.friendlyId);
152
+ switch (snapshot.executionStatus) {
153
+ case "PENDING_CANCEL": {
154
+ const [error] = await tryCatch(this.cancel());
155
+ if (error) {
156
+ this.sendDebugLog("snapshot change: failed to cancel attempt", {
157
+ ...snapshotMetadata,
158
+ error: error.message,
159
+ });
160
+ }
161
+ this.abortExecution();
162
+ return;
163
+ }
164
+ case "FINISHED": {
165
+ this.sendDebugLog("Run is finished", snapshotMetadata);
166
+ // Pretend we've just suspended the run. This will kill the process without failing the run.
167
+ await this.taskRunProcess?.suspend();
168
+ return;
169
+ }
170
+ case "QUEUED_EXECUTING":
171
+ case "EXECUTING_WITH_WAITPOINTS": {
172
+ this.sendDebugLog("Run is executing with waitpoints", snapshotMetadata);
173
+ const [error] = await tryCatch(this.taskRunProcess?.cleanup(false));
174
+ if (error) {
175
+ this.sendDebugLog("Failed to cleanup task run process, carrying on", {
176
+ ...snapshotMetadata,
177
+ error: error.message,
178
+ });
179
+ }
180
+ if (snapshot.friendlyId !== this.currentSnapshotId) {
181
+ this.sendDebugLog("Snapshot changed after cleanup, abort", snapshotMetadata);
182
+ this.abortExecution();
183
+ return;
184
+ }
185
+ await sleep(this.env.TRIGGER_PRE_SUSPEND_WAIT_MS);
186
+ if (snapshot.friendlyId !== this.currentSnapshotId) {
187
+ this.sendDebugLog("Snapshot changed after suspend threshold, abort", snapshotMetadata);
188
+ this.abortExecution();
189
+ return;
190
+ }
191
+ if (!this.runFriendlyId || !this.currentSnapshotId) {
192
+ this.sendDebugLog("handleSnapshotChange: Missing run ID or snapshot ID after suspension, abort", snapshotMetadata);
193
+ this.abortExecution();
194
+ return;
195
+ }
196
+ const suspendResult = await this.httpClient.suspendRun(this.runFriendlyId, this.currentSnapshotId);
197
+ if (!suspendResult.success) {
198
+ this.sendDebugLog("Failed to suspend run, staying alive 🎶", {
199
+ ...snapshotMetadata,
200
+ error: suspendResult.error,
201
+ });
202
+ this.sendDebugLog("checkpoint: suspend request failed", {
203
+ ...snapshotMetadata,
204
+ error: suspendResult.error,
205
+ });
206
+ // This is fine, we'll wait for the next status change
207
+ return;
208
+ }
209
+ if (!suspendResult.data.ok) {
210
+ this.sendDebugLog("checkpoint: failed to suspend run", {
211
+ snapshotId: this.currentSnapshotId,
212
+ error: suspendResult.data.error,
213
+ });
214
+ // This is fine, we'll wait for the next status change
215
+ return;
216
+ }
217
+ this.sendDebugLog("Suspending, any day now 🚬", snapshotMetadata);
218
+ // Wait for next status change
219
+ return;
220
+ }
221
+ case "SUSPENDED": {
222
+ this.sendDebugLog("Run was suspended, kill the process", snapshotMetadata);
223
+ // This will kill the process and fail the execution with a SuspendedProcessError
224
+ await this.taskRunProcess?.suspend();
225
+ return;
226
+ }
227
+ case "PENDING_EXECUTING": {
228
+ this.sendDebugLog("Run is pending execution", snapshotMetadata);
229
+ if (completedWaitpoints.length === 0) {
230
+ this.sendDebugLog("No waitpoints to complete, nothing to do", snapshotMetadata);
231
+ return;
232
+ }
233
+ const [error] = await tryCatch(this.restore());
234
+ if (error) {
235
+ this.sendDebugLog("Failed to restore execution", {
236
+ ...snapshotMetadata,
237
+ error: error.message,
238
+ });
239
+ this.abortExecution();
240
+ return;
241
+ }
242
+ return;
243
+ }
244
+ case "EXECUTING": {
245
+ this.sendDebugLog("Run is now executing", snapshotMetadata);
246
+ if (completedWaitpoints.length === 0) {
247
+ return;
248
+ }
249
+ this.sendDebugLog("Processing completed waitpoints", snapshotMetadata);
250
+ if (!this.taskRunProcess) {
251
+ this.sendDebugLog("No task run process, ignoring completed waitpoints", snapshotMetadata);
252
+ this.abortExecution();
253
+ return;
254
+ }
255
+ for (const waitpoint of completedWaitpoints) {
256
+ this.taskRunProcess.waitpointCompleted(waitpoint);
257
+ }
258
+ return;
259
+ }
260
+ case "RUN_CREATED":
261
+ case "QUEUED": {
262
+ this.sendDebugLog("Invalid status change", snapshotMetadata);
263
+ this.abortExecution();
264
+ return;
265
+ }
266
+ default: {
267
+ assertExhaustive(snapshot.executionStatus);
268
+ }
269
+ }
270
+ }
271
+ async startAttempt({ isWarmStart, }) {
272
+ if (!this.runFriendlyId || !this.currentSnapshotId) {
273
+ throw new Error("Cannot start attempt: missing run or snapshot ID");
274
+ }
275
+ this.sendDebugLog("Starting attempt");
276
+ const attemptStartedAt = Date.now();
277
+ // Check for abort before each major async operation
278
+ if (this.executionAbortController.signal.aborted) {
279
+ throw new ExecutionAbortError("Execution aborted before start");
280
+ }
281
+ const start = await this.httpClient.startRunAttempt(this.runFriendlyId, this.currentSnapshotId, { isWarmStart });
282
+ if (this.executionAbortController.signal.aborted) {
283
+ throw new ExecutionAbortError("Execution aborted after start");
284
+ }
285
+ if (!start.success) {
286
+ throw new Error(`Start API call failed: ${start.error}`);
287
+ }
288
+ // A snapshot was just created, so update the snapshot ID
289
+ this.currentSnapshotId = start.data.snapshot.friendlyId;
290
+ const metrics = this.measureExecutionMetrics({
291
+ attemptCreatedAt: attemptStartedAt,
292
+ dequeuedAt: this.dequeuedAt?.getTime(),
293
+ podScheduledAt: this.podScheduledAt?.getTime(),
294
+ });
295
+ this.sendDebugLog("Started attempt");
296
+ return { ...start.data, metrics };
297
+ }
298
+ /**
299
+ * Executes the run. This will return when the execution is complete and we should warm start.
300
+ * When this returns, the child process will have been cleaned up.
301
+ */
302
+ async execute(runOpts) {
303
+ // Setup initial state
304
+ this.runFriendlyId = runOpts.runFriendlyId;
305
+ this.currentSnapshotId = runOpts.snapshotFriendlyId;
306
+ this.dequeuedAt = runOpts.dequeuedAt;
307
+ this.podScheduledAt = runOpts.podScheduledAt;
308
+ // Create and start services
309
+ this.runHeartbeat = new RunExecutionHeartbeat({
310
+ runFriendlyId: this.runFriendlyId,
311
+ snapshotFriendlyId: this.currentSnapshotId,
312
+ httpClient: this.httpClient,
313
+ logger: this.logger,
314
+ heartbeatIntervalSeconds: this.env.TRIGGER_HEARTBEAT_INTERVAL_SECONDS,
315
+ });
316
+ this.snapshotPoller = new RunExecutionSnapshotPoller({
317
+ runFriendlyId: this.runFriendlyId,
318
+ snapshotFriendlyId: this.currentSnapshotId,
319
+ httpClient: this.httpClient,
320
+ logger: this.logger,
321
+ snapshotPollIntervalSeconds: this.env.TRIGGER_SNAPSHOT_POLL_INTERVAL_SECONDS,
322
+ handleSnapshotChange: this.handleSnapshotChange.bind(this),
323
+ });
324
+ this.runHeartbeat.start();
325
+ this.snapshotPoller.start();
326
+ const [startError, start] = await tryCatch(this.startAttempt({ isWarmStart: runOpts.isWarmStart }));
327
+ if (startError) {
328
+ this.sendDebugLog("Failed to start attempt", { error: startError.message });
329
+ this.stopServices();
330
+ return;
331
+ }
332
+ const [executeError] = await tryCatch(this.executeRunWrapper(start));
333
+ if (executeError) {
334
+ this.sendDebugLog("Failed to execute run", { error: executeError.message });
335
+ this.stopServices();
336
+ return;
337
+ }
338
+ this.stopServices();
339
+ }
340
+ async executeRunWrapper({ run, snapshot, envVars, execution, metrics, isWarmStart, }) {
341
+ this.currentTaskRunEnv = envVars;
342
+ const [executeError] = await tryCatch(this.executeRun({
343
+ run,
344
+ snapshot,
345
+ envVars,
346
+ execution,
347
+ metrics,
348
+ isWarmStart,
349
+ }));
350
+ this.sendDebugLog("Run execution completed", { error: executeError?.message });
351
+ if (!executeError) {
352
+ this.stopServices();
353
+ return;
354
+ }
355
+ if (executeError instanceof SuspendedProcessError) {
356
+ this.sendDebugLog("Run was suspended", {
357
+ run: run.friendlyId,
358
+ snapshot: snapshot.friendlyId,
359
+ error: executeError.message,
360
+ });
361
+ return;
362
+ }
363
+ if (executeError instanceof ExecutionAbortError) {
364
+ this.sendDebugLog("Run was interrupted", {
365
+ run: run.friendlyId,
366
+ snapshot: snapshot.friendlyId,
367
+ error: executeError.message,
368
+ });
369
+ return;
370
+ }
371
+ this.sendDebugLog("Error while executing attempt", {
372
+ error: executeError.message,
373
+ runId: run.friendlyId,
374
+ snapshotId: snapshot.friendlyId,
375
+ });
376
+ const completion = {
377
+ id: execution.run.id,
378
+ ok: false,
379
+ retry: undefined,
380
+ error: TaskRunProcess.parseExecuteError(executeError),
381
+ };
382
+ const [completeError] = await tryCatch(this.complete({ completion }));
383
+ if (completeError) {
384
+ this.sendDebugLog("Failed to complete run", { error: completeError.message });
385
+ }
386
+ this.stopServices();
387
+ }
388
+ async executeRun({ run, snapshot, envVars, execution, metrics, isWarmStart, }) {
389
+ // To skip this step and eagerly create the task run process, run prepareForExecution first
390
+ if (!this.taskRunProcess || !this.isPreparedForNextRun) {
391
+ this.taskRunProcess = this.createTaskRunProcess({ envVars, isWarmStart });
392
+ }
393
+ this.sendDebugLog("executing task run process", { runId: execution.run.id });
394
+ // Set up an abort handler that will cleanup the task run process
395
+ this.executionAbortController.signal.addEventListener("abort", async () => {
396
+ this.sendDebugLog("Execution aborted during task run, cleaning up process", {
397
+ runId: execution.run.id,
398
+ });
399
+ await this.taskRunProcess?.cleanup(true);
400
+ });
401
+ const completion = await this.taskRunProcess.execute({
402
+ payload: {
403
+ execution,
404
+ traceContext: execution.run.traceContext ?? {},
405
+ metrics,
406
+ },
407
+ messageId: run.friendlyId,
408
+ env: envVars,
409
+ }, isWarmStart);
410
+ // If we get here, the task completed normally
411
+ this.sendDebugLog("Completed run attempt", { attemptSuccess: completion.ok });
412
+ // The execution has finished, so we can cleanup the task run process. Killing it should be safe.
413
+ const [error] = await tryCatch(this.taskRunProcess.cleanup(true));
414
+ if (error) {
415
+ this.sendDebugLog("Failed to cleanup task run process, submitting completion anyway", {
416
+ error: error.message,
417
+ });
418
+ }
419
+ const [completionError] = await tryCatch(this.complete({ completion }));
420
+ if (completionError) {
421
+ this.sendDebugLog("Failed to complete run", { error: completionError.message });
422
+ }
423
+ }
424
+ /**
425
+ * Cancels the current execution.
426
+ */
427
+ async cancel() {
428
+ this.sendDebugLog("cancelling attempt", { runId: this.runFriendlyId });
429
+ await this.taskRunProcess?.cancel();
430
+ }
431
+ exit() {
432
+ if (this.isPreparedForNextRun) {
433
+ this.taskRunProcess?.forceExit();
434
+ }
435
+ }
436
+ async complete({ completion }) {
437
+ if (!this.runFriendlyId || !this.currentSnapshotId) {
438
+ throw new Error("Cannot complete run: missing run or snapshot ID");
439
+ }
440
+ const completionResult = await this.httpClient.completeRunAttempt(this.runFriendlyId, this.currentSnapshotId, { completion });
441
+ if (!completionResult.success) {
442
+ throw new Error(`failed to submit completion: ${completionResult.error}`);
443
+ }
444
+ await this.handleCompletionResult({
445
+ completion,
446
+ result: completionResult.data.result,
447
+ });
448
+ }
449
+ async handleCompletionResult({ completion, result, }) {
450
+ this.sendDebugLog("Handling completion result", {
451
+ attemptSuccess: completion.ok,
452
+ attemptStatus: result.attemptStatus,
453
+ snapshotId: result.snapshot.friendlyId,
454
+ runId: result.run.friendlyId,
455
+ });
456
+ // Update our snapshot ID to match the completion result
457
+ // This ensures any subsequent API calls use the correct snapshot
458
+ this.currentSnapshotId = result.snapshot.friendlyId;
459
+ const { attemptStatus } = result;
460
+ if (attemptStatus === "RUN_FINISHED") {
461
+ this.sendDebugLog("Run finished");
462
+ return;
463
+ }
464
+ if (attemptStatus === "RUN_PENDING_CANCEL") {
465
+ this.sendDebugLog("Run pending cancel");
466
+ return;
467
+ }
468
+ if (attemptStatus === "RETRY_QUEUED") {
469
+ this.sendDebugLog("Retry queued");
470
+ return;
471
+ }
472
+ if (attemptStatus === "RETRY_IMMEDIATELY") {
473
+ if (completion.ok) {
474
+ throw new Error("Should retry but completion OK.");
475
+ }
476
+ if (!completion.retry) {
477
+ throw new Error("Should retry but missing retry params.");
478
+ }
479
+ await this.retryImmediately({ retryOpts: completion.retry });
480
+ return;
481
+ }
482
+ assertExhaustive(attemptStatus);
483
+ }
484
+ measureExecutionMetrics({ attemptCreatedAt, dequeuedAt, podScheduledAt, }) {
485
+ const metrics = [
486
+ {
487
+ name: "start",
488
+ event: "create_attempt",
489
+ timestamp: attemptCreatedAt,
490
+ duration: Date.now() - attemptCreatedAt,
491
+ },
492
+ ];
493
+ if (dequeuedAt) {
494
+ metrics.push({
495
+ name: "start",
496
+ event: "dequeue",
497
+ timestamp: dequeuedAt,
498
+ duration: 0,
499
+ });
500
+ }
501
+ if (podScheduledAt) {
502
+ metrics.push({
503
+ name: "start",
504
+ event: "pod_scheduled",
505
+ timestamp: podScheduledAt,
506
+ duration: 0,
507
+ });
508
+ }
509
+ return metrics;
510
+ }
511
+ async retryImmediately({ retryOpts }) {
512
+ this.sendDebugLog("Retrying run immediately", {
513
+ timestamp: retryOpts.timestamp,
514
+ delay: retryOpts.delay,
515
+ });
516
+ const delay = retryOpts.timestamp - Date.now();
517
+ if (delay > 0) {
518
+ // Wait for retry delay to pass
519
+ await sleep(delay);
520
+ }
521
+ // Start and execute next attempt
522
+ const [startError, start] = await tryCatch(this.startAttempt({ isWarmStart: true }));
523
+ if (startError) {
524
+ this.sendDebugLog("Failed to start attempt for retry", { error: startError.message });
525
+ this.stopServices();
526
+ return;
527
+ }
528
+ const [executeError] = await tryCatch(this.executeRunWrapper({ ...start, isWarmStart: true }));
529
+ if (executeError) {
530
+ this.sendDebugLog("Failed to execute run for retry", { error: executeError.message });
531
+ this.stopServices();
532
+ return;
533
+ }
534
+ this.stopServices();
535
+ }
536
+ /**
537
+ * Restores a suspended execution from PENDING_EXECUTING
538
+ */
539
+ async restore() {
540
+ this.sendDebugLog("Restoring execution");
541
+ if (!this.runFriendlyId || !this.currentSnapshotId) {
542
+ throw new Error("Cannot restore: missing run or snapshot ID");
543
+ }
544
+ // Short delay to give websocket time to reconnect
545
+ await sleep(100);
546
+ // Process any env overrides
547
+ await this.processEnvOverrides();
548
+ const continuationResult = await this.httpClient.continueRunExecution(this.runFriendlyId, this.currentSnapshotId);
549
+ if (!continuationResult.success) {
550
+ throw new Error(continuationResult.error);
551
+ }
552
+ // Track restore count
553
+ this.restoreCount++;
554
+ }
555
+ /**
556
+ * Processes env overrides from the metadata service. Generally called when we're resuming from a suspended state.
557
+ */
558
+ async processEnvOverrides() {
559
+ if (!this.env.TRIGGER_METADATA_URL) {
560
+ this.sendDebugLog("No metadata URL, skipping env overrides");
561
+ return;
562
+ }
563
+ const metadataClient = new MetadataClient(this.env.TRIGGER_METADATA_URL);
564
+ const overrides = await metadataClient.getEnvOverrides();
565
+ if (!overrides) {
566
+ this.sendDebugLog("No env overrides, skipping");
567
+ return;
568
+ }
569
+ this.sendDebugLog("Processing env overrides", overrides);
570
+ // Override the env with the new values
571
+ this.env.override(overrides);
572
+ // Update services with new values
573
+ if (overrides.TRIGGER_HEARTBEAT_INTERVAL_SECONDS) {
574
+ this.runHeartbeat?.updateInterval(this.env.TRIGGER_HEARTBEAT_INTERVAL_SECONDS * 1000);
575
+ }
576
+ if (overrides.TRIGGER_SNAPSHOT_POLL_INTERVAL_SECONDS) {
577
+ this.snapshotPoller?.updateInterval(this.env.TRIGGER_SNAPSHOT_POLL_INTERVAL_SECONDS * 1000);
578
+ }
579
+ if (overrides.TRIGGER_SUPERVISOR_API_PROTOCOL ||
580
+ overrides.TRIGGER_SUPERVISOR_API_DOMAIN ||
581
+ overrides.TRIGGER_SUPERVISOR_API_PORT) {
582
+ this.httpClient.updateApiUrl(this.env.TRIGGER_SUPERVISOR_API_URL);
583
+ }
584
+ if (overrides.TRIGGER_RUNNER_ID) {
585
+ this.httpClient.updateRunnerId(this.env.TRIGGER_RUNNER_ID);
586
+ }
587
+ }
588
+ sendDebugLog(message, properties, runIdOverride) {
589
+ this.logger.sendDebugLog({
590
+ runId: runIdOverride ?? this.runFriendlyId,
591
+ message: `[execution] ${message}`,
592
+ properties: {
593
+ ...properties,
594
+ runId: this.runFriendlyId,
595
+ snapshotId: this.currentSnapshotId,
596
+ executionId: this.id,
597
+ executionRestoreCount: this.restoreCount,
598
+ },
599
+ });
600
+ }
601
+ // Ensure we can only set this once
602
+ set runFriendlyId(id) {
603
+ if (this._runFriendlyId) {
604
+ throw new Error("Run ID already set");
605
+ }
606
+ this._runFriendlyId = id;
607
+ }
608
+ get runFriendlyId() {
609
+ return this._runFriendlyId;
610
+ }
611
+ get currentSnapshotFriendlyId() {
612
+ return this.currentSnapshotId;
613
+ }
614
+ get taskRunEnv() {
615
+ return this.currentTaskRunEnv;
616
+ }
617
+ get metrics() {
618
+ return {
619
+ restoreCount: this.restoreCount,
620
+ };
621
+ }
622
+ get isAborted() {
623
+ return this.executionAbortController.signal.aborted;
624
+ }
625
+ abortExecution() {
626
+ if (this.isAborted) {
627
+ this.sendDebugLog("Execution already aborted");
628
+ return;
629
+ }
630
+ this.executionAbortController.abort();
631
+ this.stopServices();
632
+ }
633
+ stopServices() {
634
+ this.runHeartbeat?.stop();
635
+ this.snapshotPoller?.stop();
636
+ }
637
+ }
638
+ //# sourceMappingURL=execution.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"execution.js","sourceRoot":"","sources":["../../../../src/entryPoints/managed/execution.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,qBAAqB,GAMtB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAIpE,OAAO,EAAE,UAAU,IAAI,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,MAAM,mBAAoB,SAAQ,KAAK;IACrC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;IACpC,CAAC;CACF;AAqBD,MAAM,OAAO,YAAY;IACf,EAAE,CAAS;IACX,wBAAwB,CAAkB;IAE1C,cAAc,CAAU;IACxB,iBAAiB,CAAU;IAC3B,iBAAiB,CAA0B;IAE3C,UAAU,CAAQ;IAClB,cAAc,CAAQ;IACb,cAAc,CAAiB;IAC/B,GAAG,CAAY;IACf,UAAU,CAAqB;IAC/B,MAAM,CAAY;IAC3B,YAAY,CAAS;IAErB,cAAc,CAA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