Skip to content

Commit 71cd80e

Browse files
committed
pull out run execution logic
1 parent fa6866e commit 71cd80e

File tree

9 files changed

+1138
-1081
lines changed

9 files changed

+1138
-1081
lines changed

internal-packages/run-engine/src/engine/db/worker.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ export async function getWorkerDeploymentFromWorker(
193193
prisma: PrismaClientOrTransaction,
194194
workerId: string
195195
): Promise<WorkerDeploymentWithWorkerTasks | null> {
196-
const worker = await prisma.backgroundWorker.findUnique({
196+
const worker = await prisma.backgroundWorker.findFirst({
197197
where: {
198198
id: workerId,
199199
},
@@ -264,6 +264,7 @@ export async function getWorkerFromCurrentlyPromotedDeployment(
264264
prisma: PrismaClientOrTransaction,
265265
environmentId: string
266266
): Promise<WorkerDeploymentWithWorkerTasks | null> {
267+
// TODO: fixme
267268
const promotion = await prisma.workerDeploymentPromotion.findUnique({
268269
where: {
269270
environmentId_label: {

packages/cli-v3/e2e/utils.ts

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { TaskRunProcess } from "../src/executions/taskRunProcess.js";
88
import { createTestHttpServer } from "@epic-web/test-server/http";
99
import { TestCase, TestCaseRun } from "./fixtures.js";
1010
import { access } from "node:fs/promises";
11+
import { MachinePreset } from "@trigger.dev/core/v3";
1112

1213
export type PackageManager = "npm" | "pnpm" | "yarn";
1314

@@ -295,6 +296,13 @@ export async function executeTestCaseRun({
295296
},
296297
});
297298

299+
const machine = {
300+
name: "small-1x",
301+
cpu: 1,
302+
memory: 256,
303+
centsPerMs: 0.0000001,
304+
} satisfies MachinePreset;
305+
298306
try {
299307
const taskRunProcess = new TaskRunProcess({
300308
workerManifest: workerManifest!,
@@ -314,12 +322,7 @@ export async function executeTestCaseRun({
314322
version: "1.0.0",
315323
contentHash,
316324
},
317-
machine: {
318-
name: "small-1x",
319-
cpu: 1,
320-
memory: 256,
321-
centsPerMs: 0.0000001,
322-
},
325+
machineResources: machine,
323326
}).initialize();
324327

325328
const result = await taskRunProcess.execute({
@@ -372,12 +375,7 @@ export async function executeTestCaseRun({
372375
ref: "main",
373376
name: "test",
374377
},
375-
machine: {
376-
name: "small-1x",
377-
cpu: 1,
378-
memory: 256,
379-
centsPerMs: 0.0000001,
380-
},
378+
machine,
381379
},
382380
},
383381
messageId: "run_1234",

packages/cli-v3/src/entryPoints/dev-run-controller.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,7 @@ export class DevRunController {
619619
version: this.opts.worker.serverWorker?.version,
620620
engine: "V2",
621621
},
622-
machine: execution.machine,
622+
machineResources: execution.machine,
623623
}).initialize();
624624

625625
logger.debug("executing task run process", {

0 commit comments

Comments
 (0)