Skip to content

Commit 4afc6b3

Browse files
committed
Actually set the timed out runs to status = TIMED_OUT
1 parent 06c3c10 commit 4afc6b3

File tree

6 files changed

+52
-7
lines changed

6 files changed

+52
-7
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,7 @@ export function SelectPopover({
613613
"z-50 flex flex-col overflow-clip rounded border border-charcoal-700 bg-background-bright shadow-md outline-none animate-in fade-in-40",
614614
"min-w-[max(180px,calc(var(--popover-anchor-width)+0.5rem))]",
615615
"max-w-[min(480px,var(--popover-available-width))]",
616-
"max-h-[min(480px,var(--popover-available-height))]",
616+
"max-h-[min(520px,var(--popover-available-height))]",
617617
"origin-[var(--popover-transform-origin)]",
618618
className
619619
)}

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export const allTaskRunStatuses = [
2828
"COMPLETED_SUCCESSFULLY",
2929
"CANCELED",
3030
"COMPLETED_WITH_ERRORS",
31+
"TIMED_OUT",
3132
"CRASHED",
3233
"PAUSED",
3334
"INTERRUPTED",
@@ -45,6 +46,7 @@ export const filterableTaskRunStatuses = [
4546
"COMPLETED_SUCCESSFULLY",
4647
"CANCELED",
4748
"COMPLETED_WITH_ERRORS",
49+
"TIMED_OUT",
4850
"CRASHED",
4951
"INTERRUPTED",
5052
"SYSTEM_FAILURE",

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

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,16 @@ import {
3939
import { CancelRunDialog } from "./CancelRunDialog";
4040
import { LiveTimer } from "./LiveTimer";
4141
import { ReplayRunDialog } from "./ReplayRunDialog";
42-
import { TaskRunStatusCombo } from "./TaskRunStatus";
42+
import {
43+
descriptionForTaskRunStatus,
44+
filterableTaskRunStatuses,
45+
runStatusTitle,
46+
TaskRunStatusCombo,
47+
TaskRunStatusIcon,
48+
} from "./TaskRunStatus";
4349
import { RunTag } from "./RunTag";
4450
import { Badge } from "~/components/primitives/Badge";
51+
import { SimpleTooltip } from "~/components/primitives/Tooltip";
4552

4653
type RunsTableProps = {
4754
total: number;
@@ -126,7 +133,24 @@ export function TaskRunsTable({
126133
<TableHeaderCell>Env</TableHeaderCell>
127134
<TableHeaderCell>Task</TableHeaderCell>
128135
<TableHeaderCell>Version</TableHeaderCell>
129-
<TableHeaderCell>Status</TableHeaderCell>
136+
<TableHeaderCell
137+
tooltip={
138+
<div className="flex max-w-xs flex-col gap-3 p-1">
139+
{filterableTaskRunStatuses.map((status) => (
140+
<div>
141+
<div className="mb-0.5 flex items-center gap-1.5">
142+
<TaskRunStatusCombo status={status} />
143+
</div>
144+
<Paragraph variant="extra-small" className="!text-wrap text-text-dimmed">
145+
{descriptionForTaskRunStatus(status)}
146+
</Paragraph>
147+
</div>
148+
))}
149+
</div>
150+
}
151+
>
152+
Status
153+
</TableHeaderCell>
130154
<TableHeaderCell>Started</TableHeaderCell>
131155
<TableHeaderCell
132156
colSpan={3}
@@ -287,7 +311,10 @@ export function TaskRunsTable({
287311
</TableCell>
288312
<TableCell to={path}>{run.version ?? "–"}</TableCell>
289313
<TableCell to={path}>
290-
<TaskRunStatusCombo status={run.status} />
314+
<SimpleTooltip
315+
content={descriptionForTaskRunStatus(run.status)}
316+
button={<TaskRunStatusCombo status={run.status} />}
317+
/>
291318
</TableCell>
292319
<TableCell to={path}>
293320
{run.startedAt ? <DateTime date={run.startedAt} /> : "–"}

apps/webapp/app/v3/services/completeAttempt.server.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,10 +363,16 @@ export class CompleteAttemptService extends BaseService {
363363
},
364364
});
365365

366+
const status =
367+
sanitizedError.type === "INTERNAL_ERROR" &&
368+
sanitizedError.code === "MAX_DURATION_EXCEEDED"
369+
? "TIMED_OUT"
370+
: "COMPLETED_WITH_ERRORS";
371+
366372
const finalizeService = new FinalizeTaskRunService();
367373
await finalizeService.call({
368374
id: taskRunAttempt.taskRunId,
369-
status: "COMPLETED_WITH_ERRORS",
375+
status,
370376
completedAt: new Date(),
371377
});
372378
}

apps/webapp/app/v3/taskStatus.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ export const FINAL_RUN_STATUSES = [
4141
"SYSTEM_FAILURE",
4242
"EXPIRED",
4343
"CRASHED",
44+
"TIMED_OUT",
4445
] satisfies TaskRunStatus[];
4546

4647
export type FINAL_RUN_STATUSES = (typeof FINAL_RUN_STATUSES)[number];
@@ -96,6 +97,7 @@ export const FAILED_RUN_STATUSES = [
9697
"COMPLETED_WITH_ERRORS",
9798
"SYSTEM_FAILURE",
9899
"CRASHED",
100+
"TIMED_OUT",
99101
] satisfies TaskRunStatus[];
100102

101103
export function isFailedRunStatus(status: TaskRunStatus): boolean {

references/hello-world/src/trigger/example.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,18 @@ export const childTask = task({
4545

4646
export const maxDurationTask = task({
4747
id: "max-duration",
48-
run: async (payload: { sleepFor: number }, { signal }) => {
48+
retry: {
49+
maxAttempts: 5,
50+
minTimeoutInMs: 1_000,
51+
maxTimeoutInMs: 2_000,
52+
factor: 1.4,
53+
},
54+
run: async (payload: { sleepFor: number }, { signal, ctx }) => {
4955
await setTimeout(payload.sleepFor * 1000, { signal });
5056

51-
return usage.getCurrent();
57+
if (ctx.attempt.number < 5) {
58+
throw new Error("Example error");
59+
}
5260
},
5361
});
5462

0 commit comments

Comments
 (0)