Skip to content

Commit b9be9ff

Browse files
committed
refactor(webapp): reject retired v3 (engine V1) runs and read queues from the v2 engine
v3 (engine V1) execution is retired. Reject V1 triggers unconditionally with the upgrade message, finalize a cancelled historical V1 run directly in the DB (no coordinator/devPubSub, never throws so the cancel route cannot 500), reject V1 reschedules, and default a fresh dev environment to V2. Move all live queue reads (concurrency limits, env queue length/size guard, project metrics, admin queue debug) off the MarQS singleton onto the v2 run engine so MarQS can be removed.
1 parent 45527e3 commit b9be9ff

12 files changed

Lines changed: 73 additions & 377 deletions

apps/webapp/app/components/admin/debugRun.tsx

Lines changed: 7 additions & 255 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import { useEffect } from "react";
1010
import { Spinner } from "../primitives/Spinner";
1111
import * as Property from "~/components/primitives/PropertyTable";
1212
import { ClipboardField } from "../primitives/ClipboardField";
13-
import { MarQSShortKeyProducer } from "~/v3/marqs/marqsKeyProducer";
1413

1514
export function AdminDebugRun({ friendlyId }: { friendlyId: string }) {
1615
const hasAdminAccess = useHasAdminAccess();
@@ -69,26 +68,17 @@ function DebugRunContent({ friendlyId }: { friendlyId: string }) {
6968

7069
function DebugRunData(props: UseDataFunctionReturn<typeof loader>) {
7170
if (props.engine === "V1") {
72-
return <DebugRunDataEngineV1 {...props} />;
71+
return <DebugRunDataEngineV1 run={props.run} />;
7372
}
7473

7574
return <DebugRunDataEngineV2 {...props} />;
7675
}
7776

7877
function DebugRunDataEngineV1({
7978
run,
80-
environment,
81-
queueConcurrencyLimit,
82-
queueCurrentConcurrency,
83-
envConcurrencyLimit,
84-
envCurrentConcurrency,
85-
queueReserveConcurrency,
86-
envReserveConcurrency,
87-
}: UseDataFunctionReturn<typeof loader>) {
88-
const keys = new MarQSShortKeyProducer("marqs:");
89-
90-
const withPrefix = (key: string) => `marqs:${key}`;
91-
79+
}: {
80+
run: UseDataFunctionReturn<typeof loader>["run"];
81+
}) {
9282
return (
9383
<Property.Table>
9484
<Property.Item>
@@ -98,247 +88,9 @@ function DebugRunDataEngineV1({
9888
</Property.Value>
9989
</Property.Item>
10090
<Property.Item>
101-
<Property.Label>Message key</Property.Label>
102-
<Property.Value className="flex items-center gap-2">
103-
<ClipboardField
104-
value={withPrefix(keys.messageKey(run.id))}
105-
variant="tertiary/small"
106-
iconButton
107-
/>
108-
</Property.Value>
109-
</Property.Item>
110-
<Property.Item>
111-
<Property.Label>GET message</Property.Label>
112-
<Property.Value className="flex items-center gap-2">
113-
<ClipboardField
114-
value={`GET ${withPrefix(keys.messageKey(run.id))}`}
115-
variant="tertiary/small"
116-
iconButton
117-
/>
118-
</Property.Value>
119-
</Property.Item>
120-
<Property.Item>
121-
<Property.Label>Queue key</Property.Label>
122-
<Property.Value className="flex items-center gap-2">
123-
<ClipboardField
124-
value={withPrefix(
125-
keys.queueKey(environment, run.queue, run.concurrencyKey ?? undefined)
126-
)}
127-
variant="tertiary/small"
128-
iconButton
129-
/>
130-
</Property.Value>
131-
</Property.Item>
132-
<Property.Item>
133-
<Property.Label>Get queue set</Property.Label>
134-
<Property.Value className="flex items-center gap-2">
135-
<ClipboardField
136-
value={`ZRANGE ${withPrefix(
137-
keys.queueKey(environment, run.queue, run.concurrencyKey ?? undefined)
138-
)} 0 -1`}
139-
variant="tertiary/small"
140-
iconButton
141-
/>
142-
</Property.Value>
143-
</Property.Item>
144-
<Property.Item>
145-
<Property.Label>Queue current concurrency key</Property.Label>
146-
<Property.Value className="flex items-center gap-2">
147-
<ClipboardField
148-
value={withPrefix(
149-
keys.queueCurrentConcurrencyKey(
150-
environment,
151-
run.queue,
152-
run.concurrencyKey ?? undefined
153-
)
154-
)}
155-
variant="tertiary/small"
156-
iconButton
157-
/>
158-
</Property.Value>
159-
</Property.Item>
160-
161-
<Property.Item>
162-
<Property.Label>Get queue current concurrency</Property.Label>
163-
<Property.Value className="flex items-center gap-2">
164-
<ClipboardField
165-
value={`SMEMBERS ${withPrefix(
166-
keys.queueCurrentConcurrencyKey(
167-
environment,
168-
run.queue,
169-
run.concurrencyKey ?? undefined
170-
)
171-
)}`}
172-
variant="tertiary/small"
173-
iconButton
174-
/>
175-
</Property.Value>
176-
</Property.Item>
177-
<Property.Item>
178-
<Property.Label>Queue current concurrency</Property.Label>
179-
<Property.Value className="flex items-center gap-2">
180-
<span>{queueCurrentConcurrency ?? "0"}</span>
181-
</Property.Value>
182-
</Property.Item>
183-
<Property.Item>
184-
<Property.Label>Queue reserve concurrency key</Property.Label>
185-
<Property.Value className="flex items-center gap-2">
186-
<ClipboardField
187-
value={withPrefix(
188-
keys.queueReserveConcurrencyKeyFromQueue(
189-
keys.queueKey(environment, run.queue, run.concurrencyKey ?? undefined)
190-
)
191-
)}
192-
variant="tertiary/small"
193-
iconButton
194-
/>
195-
</Property.Value>
196-
</Property.Item>
197-
198-
<Property.Item>
199-
<Property.Label>Get queue reserve concurrency</Property.Label>
200-
<Property.Value className="flex items-center gap-2">
201-
<ClipboardField
202-
value={`SMEMBERS ${withPrefix(
203-
keys.queueReserveConcurrencyKeyFromQueue(
204-
keys.queueKey(environment, run.queue, run.concurrencyKey ?? undefined)
205-
)
206-
)}`}
207-
variant="tertiary/small"
208-
iconButton
209-
/>
210-
</Property.Value>
211-
</Property.Item>
212-
<Property.Item>
213-
<Property.Label>Queue reserve concurrency</Property.Label>
214-
<Property.Value className="flex items-center gap-2">
215-
<span>{queueReserveConcurrency ?? "0"}</span>
216-
</Property.Value>
217-
</Property.Item>
218-
<Property.Item>
219-
<Property.Label>Queue concurrency limit key</Property.Label>
220-
<Property.Value className="flex items-center gap-2">
221-
<ClipboardField
222-
value={withPrefix(keys.queueConcurrencyLimitKey(environment, run.queue))}
223-
variant="tertiary/small"
224-
iconButton
225-
/>
226-
</Property.Value>
227-
</Property.Item>
228-
<Property.Item>
229-
<Property.Label>GET queue concurrency limit</Property.Label>
230-
<Property.Value className="flex items-center gap-2">
231-
<ClipboardField
232-
value={`GET ${withPrefix(keys.queueConcurrencyLimitKey(environment, run.queue))}`}
233-
variant="tertiary/small"
234-
iconButton
235-
/>
236-
</Property.Value>
237-
</Property.Item>
238-
<Property.Item>
239-
<Property.Label>Queue concurrency limit</Property.Label>
240-
<Property.Value className="flex items-center gap-2">
241-
<span>{queueConcurrencyLimit ?? "Not set"}</span>
242-
</Property.Value>
243-
</Property.Item>
244-
<Property.Item>
245-
<Property.Label>Env current concurrency key</Property.Label>
246-
<Property.Value className="flex items-center gap-2">
247-
<ClipboardField
248-
value={withPrefix(keys.envCurrentConcurrencyKey(environment))}
249-
variant="tertiary/small"
250-
iconButton
251-
/>
252-
</Property.Value>
253-
</Property.Item>
254-
<Property.Item>
255-
<Property.Label>Get env current concurrency</Property.Label>
256-
<Property.Value className="flex items-center gap-2">
257-
<ClipboardField
258-
value={`SMEMBERS ${withPrefix(keys.envCurrentConcurrencyKey(environment))}`}
259-
variant="tertiary/small"
260-
iconButton
261-
/>
262-
</Property.Value>
263-
</Property.Item>
264-
<Property.Item>
265-
<Property.Label>Env current concurrency</Property.Label>
266-
<Property.Value className="flex items-center gap-2">
267-
<span>{envCurrentConcurrency ?? "0"}</span>
268-
</Property.Value>
269-
</Property.Item>
270-
<Property.Item>
271-
<Property.Label>Env reserve concurrency key</Property.Label>
272-
<Property.Value className="flex items-center gap-2">
273-
<ClipboardField
274-
value={withPrefix(keys.envReserveConcurrencyKey(environment.id))}
275-
variant="tertiary/small"
276-
iconButton
277-
/>
278-
</Property.Value>
279-
</Property.Item>
280-
<Property.Item>
281-
<Property.Label>Get env reserve concurrency</Property.Label>
282-
<Property.Value className="flex items-center gap-2">
283-
<ClipboardField
284-
value={`SMEMBERS ${withPrefix(keys.envReserveConcurrencyKey(environment.id))}`}
285-
variant="tertiary/small"
286-
iconButton
287-
/>
288-
</Property.Value>
289-
</Property.Item>
290-
<Property.Item>
291-
<Property.Label>Env reserve concurrency</Property.Label>
292-
<Property.Value className="flex items-center gap-2">
293-
<span>{envReserveConcurrency ?? "0"}</span>
294-
</Property.Value>
295-
</Property.Item>
296-
<Property.Item>
297-
<Property.Label>Env concurrency limit key</Property.Label>
298-
<Property.Value className="flex items-center gap-2">
299-
<ClipboardField
300-
value={withPrefix(keys.envConcurrencyLimitKey(environment))}
301-
variant="tertiary/small"
302-
iconButton
303-
/>
304-
</Property.Value>
305-
</Property.Item>
306-
<Property.Item>
307-
<Property.Label>GET env concurrency limit</Property.Label>
308-
<Property.Value className="flex items-center gap-2">
309-
<ClipboardField
310-
value={`GET ${withPrefix(keys.envConcurrencyLimitKey(environment))}`}
311-
variant="tertiary/small"
312-
iconButton
313-
/>
314-
</Property.Value>
315-
</Property.Item>
316-
<Property.Item>
317-
<Property.Label>Env concurrency limit</Property.Label>
318-
<Property.Value className="flex items-center gap-2">
319-
<span>{envConcurrencyLimit ?? "Not set"}</span>
320-
</Property.Value>
321-
</Property.Item>
322-
<Property.Item>
323-
<Property.Label>Shared queue key</Property.Label>
324-
<Property.Value className="flex items-center gap-2">
325-
<ClipboardField
326-
value={`GET ${withPrefix(keys.envSharedQueueKey(environment))}`}
327-
variant="tertiary/small"
328-
iconButton
329-
/>
330-
</Property.Value>
331-
</Property.Item>
332-
<Property.Item>
333-
<Property.Label>Get shared queue set</Property.Label>
334-
<Property.Value className="flex items-center gap-2">
335-
<ClipboardField
336-
value={`ZRANGEBYSCORE ${withPrefix(
337-
keys.envSharedQueueKey(environment)
338-
)} -inf ${Date.now()} WITHSCORES`}
339-
variant="tertiary/small"
340-
iconButton
341-
/>
91+
<Property.Label>Engine</Property.Label>
92+
<Property.Value>
93+
Engine V1 (v3) is retired. Queue debug data is no longer available for V1 runs.
34294
</Property.Value>
34395
</Property.Item>
34496
</Property.Table>

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

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { type AuthenticatedEnvironment } from "~/services/apiAuth.server";
2-
import { marqs } from "~/v3/marqs/index.server";
32
import { engine } from "~/v3/runEngine.server";
43
import { getQueueSizeLimit } from "~/v3/utils/queueLimits.server";
54
import { BasePresenter } from "./basePresenter.server";
@@ -15,16 +14,10 @@ export type Environment = {
1514

1615
export class EnvironmentQueuePresenter extends BasePresenter {
1716
async call(environment: AuthenticatedEnvironment): Promise<Environment> {
18-
const [engineV1Executing, engineV2Executing, engineV1Queued, engineV2Queued] =
19-
await Promise.all([
20-
marqs.currentConcurrencyOfEnvironment(environment),
21-
engine.concurrencyOfEnvQueue(environment),
22-
marqs.lengthOfEnvQueue(environment),
23-
engine.lengthOfEnvQueue(environment),
24-
]);
25-
26-
const running = (engineV1Executing ?? 0) + (engineV2Executing ?? 0);
27-
const queued = (engineV1Queued ?? 0) + (engineV2Queued ?? 0);
17+
const [running, queued] = await Promise.all([
18+
engine.concurrencyOfEnvQueue(environment),
19+
engine.lengthOfEnvQueue(environment),
20+
]);
2821

2922
const organization = await this._replica.organization.findFirst({
3023
where: {

0 commit comments

Comments
 (0)