-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
perf(run-engine): optimize waitpoint mapping in executionSnapshotSystem #4467
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
Changes from all commits
6b9289d
d6dca75
152c383
4b1f911
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -262,7 +262,7 @@ export class SharedQueueConsumer { | |
|
|
||
| console.log("✅ Started the SharedQueueConsumer"); | ||
|
|
||
| this.#doWork().finally(() => {}); | ||
| this.#doWork().finally(() => { }); | ||
| } | ||
|
|
||
| #endCurrentSpan() { | ||
|
|
@@ -417,7 +417,7 @@ export class SharedQueueConsumer { | |
| span.end(); | ||
|
|
||
| setTimeout(() => { | ||
| this.#doWork().finally(() => {}); | ||
| this.#doWork().finally(() => { }); | ||
| }, nextInterval); | ||
| } | ||
| }); | ||
|
|
@@ -620,8 +620,8 @@ export class SharedQueueConsumer { | |
| return existingTaskRun.lockedById | ||
| ? await getWorkerDeploymentFromWorkerTask(existingTaskRun.lockedById) | ||
| : existingTaskRun.lockedToVersionId | ||
| ? await getWorkerDeploymentFromWorker(existingTaskRun.lockedToVersionId) | ||
| : await findCurrentWorkerDeployment({ | ||
| ? await getWorkerDeploymentFromWorker(existingTaskRun.lockedToVersionId) | ||
| : await findCurrentWorkerDeployment({ | ||
| environmentId: existingTaskRun.runtimeEnvironmentId, | ||
| type: "V1", | ||
| }); | ||
|
|
@@ -1650,6 +1650,12 @@ export const AttemptForExecutionGetPayload = { | |
| maxDurationInSeconds: true, | ||
| tags: true, | ||
| taskEventStore: true, | ||
| batch: { | ||
| select: { | ||
| id: true, | ||
| friendlyId: true, | ||
| }, | ||
| }, | ||
|
Comment on lines
+1653
to
+1658
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔍 PR contains three unrelated changes across two subsystems The stated scope is a waitpoint-mapping optimization in the run engine, but the branch also re-adds batch context to the legacy shared-queue execution payload ( Was this helpful? React with 👍 or 👎 to provide feedback. |
||
| }, | ||
| }, | ||
| queue: { | ||
|
|
@@ -1754,7 +1760,11 @@ class SharedQueueTasks { | |
| slug: attempt.runtimeEnvironment.project.slug, | ||
| name: attempt.runtimeEnvironment.project.name, | ||
| }, | ||
| batch: undefined, // TODO: Removing this for now until we can do it more efficiently | ||
| batch: attempt.taskRun.batch | ||
| ? { | ||
| id: attempt.taskRun.batch.friendlyId, | ||
| } | ||
| : undefined, | ||
|
Comment on lines
+1763
to
+1767
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔍 Batch id semantics in the restored execution payload match the attempt-creation path
Was this helpful? React with 👍 or 👎 to provide feedback. |
||
| worker: { | ||
| id: attempt.backgroundWorkerId, | ||
| contentHash: attempt.backgroundWorker.contentHash, | ||
|
|
@@ -1900,9 +1910,9 @@ class SharedQueueTasks { | |
|
|
||
| async getResumePayload(attemptId: string): Promise< | ||
| | { | ||
| execution: V3ProdTaskRunExecution; | ||
| completion: TaskRunExecutionResult; | ||
| } | ||
| execution: V3ProdTaskRunExecution; | ||
| completion: TaskRunExecutionResult; | ||
| } | ||
| | undefined | ||
| > { | ||
| const attempt = await prisma.taskRunAttempt.findFirst({ | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -274,14 +274,14 @@ async function createWorkerTask( | |||||||||||||||||||||||||||||||||||
| description: task.description, | ||||||||||||||||||||||||||||||||||||
| filePath: task.filePath, | ||||||||||||||||||||||||||||||||||||
| exportName: task.exportName, | ||||||||||||||||||||||||||||||||||||
| retryConfig: task.retry, | ||||||||||||||||||||||||||||||||||||
| queueConfig: task.queue, | ||||||||||||||||||||||||||||||||||||
| machineConfig: task.machine, | ||||||||||||||||||||||||||||||||||||
| retryConfig: task.retry ?? null, | ||||||||||||||||||||||||||||||||||||
| queueConfig: task.queue ?? null, | ||||||||||||||||||||||||||||||||||||
| machineConfig: task.machine ?? null, | ||||||||||||||||||||||||||||||||||||
| triggerSource: task.triggerSource === "schedule" ? "SCHEDULED" : "STANDARD", | ||||||||||||||||||||||||||||||||||||
| fileId: tasksToBackgroundFiles?.get(task.id) ?? null, | ||||||||||||||||||||||||||||||||||||
| maxDurationInSeconds: task.maxDuration ? clampMaxDuration(task.maxDuration) : null, | ||||||||||||||||||||||||||||||||||||
| queueId: queue.id, | ||||||||||||||||||||||||||||||||||||
| payloadSchema: task.payloadSchema as any, | ||||||||||||||||||||||||||||||||||||
| payloadSchema: (task.payloadSchema as any) ?? null, | ||||||||||||||||||||||||||||||||||||
|
Comment on lines
+277
to
+284
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔴 Deployed task registration fails when a task has no retry, queue, machine or schema settings Task records are created with explicit empty values ( Prisma rejects plain null for nullable Json fields
Also note this is a create, not an update: omitting the field (the previous
Suggested change
Was this helpful? React with 👍 or 👎 to provide feedback. |
||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||
| } catch (error) { | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟡 Several touched files are no longer formatted per the repository's required formatter
Code in the changed files is re-indented into a style the project's mandated formatter does not produce (e.g.
() => { }atapps/webapp/app/v3/marqs/sharedQueueConsumer.server.ts:265), so the required formatting check is violated.Impact: The repository's formatting requirement is broken, producing noisy unrelated diffs and failing format checks.
Prettier-enforced style per AGENTS.md
AGENTS.md ("Coding style") states: "Formatting is enforced using Prettier. Run
pnpm run formatbefore committing." The PR introduces non-Prettier output in multiple places:.finally(() => { })atapps/webapp/app/v3/marqs/sharedQueueConsumer.server.ts:265and:420, the re-indented nested ternary atapps/webapp/app/v3/marqs/sharedQueueConsumer.server.ts:623-624and:1763-1767, the return-type object at:1913-1915, and the object-literal re-indentation ininternal-packages/run-engine/src/engine/systems/executionSnapshotSystem.ts:89-104and:233-245. Runningpnpm run formatwill revert these.Was this helpful? React with 👍 or 👎 to provide feedback.