Skip to content

Commit af34ddc

Browse files
committed
WIP
1 parent 1ff7b86 commit af34ddc

File tree

43 files changed

+474
-79
lines changed

Some content is hidden

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

43 files changed

+474
-79
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,12 @@ export function RunInspector({
324324
</Property.Value>
325325
</Property.Item>
326326
)}
327+
<Property.Item>
328+
<Property.Label>Max duration</Property.Label>
329+
<Property.Value>
330+
{run.maxDurationInSeconds ? `${run.maxDurationInSeconds}s` : "–"}
331+
</Property.Value>
332+
</Property.Item>
327333
<Property.Item>
328334
<Property.Label>Run invocation cost</Property.Label>
329335
<Property.Value>

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
NoSymbolIcon,
99
PauseCircleIcon,
1010
RectangleStackIcon,
11+
StopIcon,
1112
TrashIcon,
1213
XCircleIcon,
1314
} from "@heroicons/react/20/solid";
@@ -65,6 +66,7 @@ const taskRunStatusDescriptions: Record<TaskRunStatus, string> = {
6566
PAUSED: "Task has been paused by the user",
6667
CRASHED: "Task has crashed and won't be retried",
6768
EXPIRED: "Task has surpassed its ttl and won't be executed",
69+
TIMED_OUT: "Task has reached it's maxDuration and has been stopped",
6870
};
6971

7072
export const QUEUED_STATUSES = [
@@ -140,6 +142,8 @@ export function TaskRunStatusIcon({
140142
return <FireIcon className={cn(runStatusClassNameColor(status), className)} />;
141143
case "EXPIRED":
142144
return <TrashIcon className={cn(runStatusClassNameColor(status), className)} />;
145+
case "TIMED_OUT":
146+
return <StopIcon className={cn(runStatusClassNameColor(status), className)} />;
143147

144148
default: {
145149
assertNever(status);
@@ -174,6 +178,8 @@ export function runStatusClassNameColor(status: TaskRunStatus): string {
174178
return "text-error";
175179
case "CRASHED":
176180
return "text-error";
181+
case "TIMED_OUT":
182+
return "text-error";
177183
default: {
178184
assertNever(status);
179185
}
@@ -210,6 +216,8 @@ export function runStatusTitle(status: TaskRunStatus): string {
210216
return "Crashed";
211217
case "EXPIRED":
212218
return "Expired";
219+
case "TIMED_OUT":
220+
return "Timed out";
213221
default: {
214222
assertNever(status);
215223
}

apps/webapp/app/database-types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ export const TaskRunStatus = {
4242
CRASHED: "CRASHED",
4343
DELAYED: "DELAYED",
4444
EXPIRED: "EXPIRED",
45+
TIMED_OUT: "TIMED_OUT",
4546
} as const satisfies Record<TaskRunStatusType, TaskRunStatusType>;
4647

4748
export const JobRunStatus = {

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ export function batchTaskRunItemStatusForRunStatus(
119119
case TaskRunStatus.SYSTEM_FAILURE:
120120
case TaskRunStatus.CRASHED:
121121
case TaskRunStatus.EXPIRED:
122+
case TaskRunStatus.TIMED_OUT:
122123
return BatchTaskRunItemStatus.FAILED;
123124
case TaskRunStatus.PENDING:
124125
case TaskRunStatus.WAITING_FOR_DEPLOY:

apps/webapp/app/presenters/v3/ApiRetrieveRunPresenter.server.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,9 @@ export class ApiRetrieveRunPresenter extends BasePresenter {
270270
case "EXPIRED": {
271271
return "EXPIRED";
272272
}
273+
case "TIMED_OUT": {
274+
return "TIMED_OUT";
275+
}
273276
default: {
274277
assertNever(status);
275278
}

apps/webapp/app/presenters/v3/ApiRunListPresenter.server.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,9 @@ export class ApiRunListPresenter extends BasePresenter {
310310
case "EXPIRED": {
311311
return "EXPIRED";
312312
}
313+
case "TIMED_OUT": {
314+
return "TIMED_OUT";
315+
}
313316
default: {
314317
assertNever(status);
315318
}

apps/webapp/app/presenters/v3/SpanPresenter.server.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ export class SpanPresenter extends BasePresenter {
6969
taskIdentifier: true,
7070
friendlyId: true,
7171
isTest: true,
72+
maxDurationInSeconds: true,
7273
tags: {
7374
select: {
7475
name: true,
@@ -229,6 +230,7 @@ export class SpanPresenter extends BasePresenter {
229230
baseCostInCents: run.baseCostInCents,
230231
maxAttempts: run.maxAttempts ?? undefined,
231232
version: run.lockedToVersion?.version,
233+
maxDuration: run.maxDurationInSeconds ?? undefined,
232234
},
233235
queue: {
234236
name: run.queue,
@@ -307,6 +309,7 @@ export class SpanPresenter extends BasePresenter {
307309
},
308310
context: JSON.stringify(context, null, 2),
309311
metadata,
312+
maxDurationInSeconds: run.maxDurationInSeconds,
310313
};
311314
}
312315

apps/webapp/app/routes/resources.orgs.$organizationSlug.projects.v3.$projectParam.runs.$runParam.spans.$spanParam/route.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -677,7 +677,12 @@ function RunBody({
677677
)}
678678
</Property.Value>
679679
</Property.Item>
680-
680+
<Property.Item>
681+
<Property.Label>Max duration</Property.Label>
682+
<Property.Value>
683+
{run.maxDurationInSeconds ? `${run.maxDurationInSeconds}s` : "–"}
684+
</Property.Value>
685+
</Property.Item>
681686
<Property.Item>
682687
<Property.Label>Run invocation cost</Property.Label>
683688
<Property.Value>

apps/webapp/app/v3/marqs/devQueueConsumer.server.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,8 @@ export class DevQueueConsumer {
378378
status: "EXECUTING",
379379
lockedToVersionId: backgroundWorker.id,
380380
startedAt: existingTaskRun.startedAt ?? new Date(),
381+
maxDurationInSeconds:
382+
existingTaskRun.maxDurationInSeconds ?? backgroundTask.maxDurationInSeconds,
381383
},
382384
include: {
383385
attempts: {

apps/webapp/app/v3/requeueTaskRun.server.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ export class RequeueTaskRunService extends BaseService {
7070
case "COMPLETED_WITH_ERRORS":
7171
case "COMPLETED_SUCCESSFULLY":
7272
case "EXPIRED":
73+
case "TIMED_OUT":
7374
case "CANCELED": {
7475
logger.debug("[RequeueTaskRunService] Task run is completed", { taskRun });
7576

0 commit comments

Comments
 (0)