Skip to content

Commit c4e1364

Browse files
authored
Merge pull request #1808 from triggerdotdev/re2-queue-indexing
re2: Queue indexing, queue trigger changes
2 parents 49a3f72 + f1d5886 commit c4e1364

File tree

141 files changed

+5621
-1625
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

141 files changed

+5621
-1625
lines changed

.changeset/config.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,13 @@
1212
"access": "public",
1313
"baseBranch": "main",
1414
"updateInternalDependencies": "patch",
15-
"ignore": ["webapp", "supervisor", "coordinator", "docker-provider", "kubernetes-provider"],
15+
"ignore": [
16+
"webapp",
17+
"coordinator",
18+
"docker-provider",
19+
"kubernetes-provider",
20+
"supervisor"
21+
],
1622
"___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH": {
1723
"onlyUpdatePeerDependentsWhenOutOfRange": true
1824
}

.github/workflows/unit-tests.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
run: pnpm run generate
3939

4040
- name: 🧪 Run Webapp Unit Tests
41-
run: pnpm run test --filter webapp
41+
run: pnpm run test:webapp
4242
env:
4343
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/postgres
4444
DIRECT_URL: postgresql://postgres:postgres@localhost:5432/postgres
@@ -47,7 +47,7 @@ jobs:
4747
ENCRYPTION_KEY: "secret"
4848

4949
- name: 🧪 Run Package Unit Tests
50-
run: pnpm run test --filter "@trigger.dev/*"
50+
run: pnpm run test:packages
5151

5252
- name: 🧪 Run Internal Unit Tests
53-
run: pnpm run test --filter "@internal/*"
53+
run: pnpm run test:internal

apps/webapp/app/components/navigation/SideMenu.tsx

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,12 @@ export function SideMenu({
175175
to={v3EnvironmentPath(organization, project, environment)}
176176
data-action="tasks"
177177
/>
178+
<SideMenuItem
179+
name="Runs"
180+
icon={RunsIcon}
181+
activeIconColor="text-teal-500"
182+
to={v3RunsPath(organization, project, environment)}
183+
/>
178184
<SideMenuItem
179185
name="Batches"
180186
icon={Squares2X2Icon}
@@ -212,22 +218,6 @@ export function SideMenu({
212218
/>
213219
</div>
214220

215-
<SideMenuSection title="Observability">
216-
<SideMenuItem
217-
name="Runs"
218-
icon={RunsIcon}
219-
activeIconColor="text-teal-500"
220-
to={v3RunsPath(organization, project, environment)}
221-
/>
222-
<SideMenuItem
223-
name="Alerts"
224-
icon={BellAlertIcon}
225-
activeIconColor="text-red-500"
226-
to={v3ProjectAlertsPath(organization, project, environment)}
227-
data-action="alerts"
228-
/>
229-
</SideMenuSection>
230-
231221
<SideMenuSection title="Manage">
232222
<SideMenuItem
233223
name="API keys"
@@ -243,6 +233,13 @@ export function SideMenu({
243233
to={v3EnvironmentVariablesPath(organization, project, environment)}
244234
data-action="environment variables"
245235
/>
236+
<SideMenuItem
237+
name="Alerts"
238+
icon={BellAlertIcon}
239+
activeIconColor="text-red-500"
240+
to={v3ProjectAlertsPath(organization, project, environment)}
241+
data-action="alerts"
242+
/>
246243
<SideMenuItem
247244
name="Project settings"
248245
icon={Cog8ToothIcon}

apps/webapp/app/components/primitives/Table.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,12 @@ export const TableHeaderCell = forwardRef<HTMLTableCellElement, TableHeaderCellP
161161
{hiddenLabel ? (
162162
<span className="sr-only">{children}</span>
163163
) : tooltip ? (
164-
<div className="flex items-center gap-1">
164+
<div
165+
className={cn("flex items-center gap-1", {
166+
"justify-center": alignment === "center",
167+
"justify-end": alignment === "right",
168+
})}
169+
>
165170
{children}
166171
<InfoIconTooltip content={tooltip} contentClassName="normal-case tracking-normal" />
167172
</div>

apps/webapp/app/components/runs/v3/TaskPath.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,16 @@ export function TaskPath({ filePath, functionName, className }: TaskPathProps) {
1919
);
2020
}
2121

22-
type TaskFunctionNameProps = {
23-
functionName: string;
22+
type TaskFileNameProps = {
23+
fileName: string;
2424
variant?: InlineCodeVariant;
2525
className?: string;
2626
};
2727

28-
export function TaskFunctionName({ variant, functionName, className }: TaskFunctionNameProps) {
28+
export function TaskFileName({ variant, fileName, className }: TaskFileNameProps) {
2929
return (
3030
<InlineCode variant={variant} className={cn("text-text-dimmed", className)}>
31-
{`${functionName}()`}
31+
{`${fileName}`}
3232
</InlineCode>
3333
);
3434
}

apps/webapp/app/components/runs/v3/TaskRunStatus.tsx

Lines changed: 47 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,14 @@ import { type TaskRunStatus } from "@trigger.dev/database";
1515
import assertNever from "assert-never";
1616
import { HourglassIcon } from "lucide-react";
1717
import { TimedOutIcon } from "~/assets/icons/TimedOutIcon";
18+
import { Callout } from "~/components/primitives/Callout";
1819
import { Spinner } from "~/components/primitives/Spinner";
1920
import { cn } from "~/utils/cn";
2021

2122
export const allTaskRunStatuses = [
2223
"DELAYED",
2324
"WAITING_FOR_DEPLOY",
25+
"PENDING_VERSION",
2426
"PENDING",
2527
"EXECUTING",
2628
"RETRYING_AFTER_FAILURE",
@@ -37,7 +39,7 @@ export const allTaskRunStatuses = [
3739
] as const satisfies Readonly<Array<TaskRunStatus>>;
3840

3941
export const filterableTaskRunStatuses = [
40-
"WAITING_FOR_DEPLOY",
42+
"PENDING_VERSION",
4143
"DELAYED",
4244
"PENDING",
4345
"WAITING_TO_RESUME",
@@ -56,7 +58,8 @@ export const filterableTaskRunStatuses = [
5658
const taskRunStatusDescriptions: Record<TaskRunStatus, string> = {
5759
DELAYED: "Task has been delayed and is waiting to be executed.",
5860
PENDING: "Task is waiting to be executed.",
59-
WAITING_FOR_DEPLOY: "Task needs to be deployed first to start executing.",
61+
PENDING_VERSION: "Run cannot execute until a version includes the task and queue.",
62+
WAITING_FOR_DEPLOY: "Run cannot execute until a version includes the task and queue.",
6063
EXECUTING: "Task is currently being executed.",
6164
RETRYING_AFTER_FAILURE: "Task is being reattempted after a failure.",
6265
WAITING_TO_RESUME: `You have used a "wait" function. When the wait is complete, the task will resume execution.`,
@@ -73,6 +76,7 @@ const taskRunStatusDescriptions: Record<TaskRunStatus, string> = {
7376

7477
export const QUEUED_STATUSES = [
7578
"PENDING",
79+
"PENDING_VERSION",
7680
"WAITING_FOR_DEPLOY",
7781
"DELAYED",
7882
] satisfies TaskRunStatus[];
@@ -104,6 +108,43 @@ export function TaskRunStatusCombo({
104108
);
105109
}
106110

111+
const statusReasonsToDescription: Record<string, string> = {
112+
NO_DEPLOYMENT: "No deployment or deployment image reference found for deployed run",
113+
NO_WORKER: "No worker found for run",
114+
TASK_NEVER_REGISTERED: "Task never registered",
115+
QUEUE_NOT_FOUND: "Queue not found",
116+
TASK_NOT_IN_LATEST: "Task not in latest version",
117+
BACKGROUND_WORKER_MISMATCH: "Background worker mismatch",
118+
};
119+
120+
export function TaskRunStatusReason({
121+
status,
122+
statusReason,
123+
}: {
124+
status: TaskRunStatus;
125+
statusReason?: string;
126+
}) {
127+
if (status !== "PENDING_VERSION") {
128+
return null;
129+
}
130+
131+
if (!statusReason) {
132+
return null;
133+
}
134+
135+
const description = statusReasonsToDescription[statusReason];
136+
137+
if (!description) {
138+
return null;
139+
}
140+
141+
return (
142+
<Callout to="https://trigger.dev/docs" variant="warning" className="text-sm">
143+
{description}
144+
</Callout>
145+
);
146+
}
147+
107148
export function TaskRunStatusLabel({ status }: { status: TaskRunStatus }) {
108149
return <span className={runStatusClassNameColor(status)}>{runStatusTitle(status)}</span>;
109150
}
@@ -120,6 +161,7 @@ export function TaskRunStatusIcon({
120161
return <ClockIcon className={cn(runStatusClassNameColor(status), className)} />;
121162
case "PENDING":
122163
return <RectangleStackIcon className={cn(runStatusClassNameColor(status), className)} />;
164+
case "PENDING_VERSION":
123165
case "WAITING_FOR_DEPLOY":
124166
return <RectangleStackIcon className={cn(runStatusClassNameColor(status), className)} />;
125167
case "EXECUTING":
@@ -158,6 +200,7 @@ export function runStatusClassNameColor(status: TaskRunStatus): string {
158200
case "PENDING":
159201
case "DELAYED":
160202
return "text-charcoal-500";
203+
case "PENDING_VERSION":
161204
case "WAITING_FOR_DEPLOY":
162205
return "text-amber-500";
163206
case "EXECUTING":
@@ -194,8 +237,9 @@ export function runStatusTitle(status: TaskRunStatus): string {
194237
return "Delayed";
195238
case "PENDING":
196239
return "Queued";
240+
case "PENDING_VERSION":
197241
case "WAITING_FOR_DEPLOY":
198-
return "Waiting for deploy";
242+
return "Pending version";
199243
case "EXECUTING":
200244
return "Executing";
201245
case "WAITING_TO_RESUME":

apps/webapp/app/components/runs/v3/TaskRunsTable.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,9 @@ export function TaskRunsTable({
330330
<TableCell to={path} className="w-[1%]" actionClassName="pr-0 tabular-nums">
331331
<div className="flex items-center gap-1">
332332
<RectangleStackIcon className="size-4 text-text-dimmed" />
333-
{run.startedAt ? (
333+
{run.isPending ? (
334+
"–"
335+
) : run.startedAt ? (
334336
formatDuration(new Date(run.createdAt), new Date(run.startedAt), {
335337
style: "short",
336338
})

apps/webapp/app/database-types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ export const TaskRunAttemptStatus = {
2929

3030
export const TaskRunStatus = {
3131
PENDING: "PENDING",
32+
PENDING_VERSION: "PENDING_VERSION",
3233
WAITING_FOR_DEPLOY: "WAITING_FOR_DEPLOY",
3334
EXECUTING: "EXECUTING",
3435
WAITING_TO_RESUME: "WAITING_TO_RESUME",

apps/webapp/app/hooks/useFilterTasks.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ type Task = {
44
id: string;
55
friendlyId: string;
66
taskIdentifier: string;
7-
exportName: string;
87
filePath: string;
98
triggerSource: string;
109
};
@@ -17,10 +16,6 @@ export function useFilterTasks<T extends Task>({ tasks }: { tasks: T[] }) {
1716
return true;
1817
}
1918

20-
if (task.exportName.toLowerCase().includes(text.toLowerCase())) {
21-
return true;
22-
}
23-
2419
if (task.filePath.toLowerCase().includes(text.toLowerCase())) {
2520
return true;
2621
}

apps/webapp/app/models/runtimeEnvironment.server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { AuthenticatedEnvironment } from "@internal/testcontainers";
1+
import type { AuthenticatedEnvironment } from "@internal/run-engine";
22
import type { Prisma, PrismaClientOrTransaction, RuntimeEnvironment } from "@trigger.dev/database";
33
import { prisma } from "~/db.server";
44
import { getUsername } from "~/utils/username";

0 commit comments

Comments
 (0)