-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
feat(marqs): optimize batch context fetching in sharedQueueConsumer #4466
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
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, | ||||||||||||||||||||||
| }, | ||||||||||||||||||||||
| }, | ||||||||||||||||||||||
| }, | ||||||||||||||||||||||
| }, | ||||||||||||||||||||||
| 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. 🟡 New conditional block is indented differently from what the project formatter produces The newly added conditional value is written with hand-rolled indentation ( Impact: The formatting check will flag the file and re-indent these lines, producing avoidable churn. Expected Prettier output and other affected spots
The same unformatted-indentation issue appears in the reflowed deployment ternary (
Suggested change
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. 🟡 Pull request bundles an unrelated change alongside the stated feature A separate, unrelated change to how missing task configuration is stored ( Impact: Reviewers must evaluate two unrelated changes at once, which the project's contribution rules disallow. Contribution rule and note on the change itself
Additionally, these fields are only ever supplied to 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.
🟡 Code committed without running the required formatter
Empty callback bodies were rewritten with a stray space inside the braces (
() => { }atapps/webapp/app/v3/marqs/sharedQueueConsumer.server.ts:265and again at line 420) instead of the formatter's output, so the committed file no longer matches the repository's enforced formatting.Impact: Formatting checks /
pnpm run formatwill rewrite these lines, adding noise to the diff and to subsequent PRs.Prettier rule from AGENTS.md and the exact deviations
AGENTS.md("Coding style") states: "Formatting is enforced using Prettier. Runpnpm run formatbefore committing." Prettier always emits() => {}for an empty arrow body, never() => { }. Both occurrences (apps/webapp/app/v3/marqs/sharedQueueConsumer.server.ts:265andapps/webapp/app/v3/marqs/sharedQueueConsumer.server.ts:420) are purely incidental reformatting unrelated to the PR's purpose.Was this helpful? React with 👍 or 👎 to provide feedback.