deepline 0.3.571 → 0.3.573
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundling-sources/sdk/src/release.ts +1 -1
- package/dist/bundling-sources/shared_libs/play-runtime/experiment-switches.ts +11 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-payload-transport.ts +28 -17
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/modal.ts +360 -3
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/early-sandbox.ts +274 -3
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-scheduler-topology.ts +35 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-speed-profile.ts +32 -3
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-pool.ts +2 -2
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts +11 -1
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/early-sandbox-claim-affinity.ts +67 -43
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/early-sandbox-lane.ts +23 -6
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/early-sandbox-listener-hint.ts +62 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +11 -2
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-worker-wake.ts +54 -5
- package/dist/cli/auth-DGR7ZQJL.js +44 -0
- package/dist/cli/{auth-ARGNQK7A.mjs → auth-XX3HLRQ2.mjs} +5 -5
- package/dist/cli/{billing-KAKODYTN.js → billing-6TY2HMC6.js} +99 -99
- package/dist/cli/{billing-QRZTHCBX.mjs → billing-QASEPOBL.mjs} +8 -8
- package/dist/cli/{chunk-C27FK36H.js → chunk-2USXCXPZ.js} +5 -5
- package/dist/cli/{chunk-GRD3DLH7.mjs → chunk-4K6UVILG.mjs} +2 -2
- package/dist/cli/{chunk-7HAYEKC4.mjs → chunk-4LWBURSS.mjs} +1 -1
- package/dist/cli/{chunk-J5KW2ZDB.mjs → chunk-5MCC4D25.mjs} +1 -1
- package/dist/cli/{chunk-UTGHPC5D.mjs → chunk-5NEJOCOK.mjs} +1 -1
- package/dist/cli/{chunk-YDM5WSXO.mjs → chunk-6JTJP3WO.mjs} +5 -5
- package/dist/cli/{chunk-C6XV2DPY.mjs → chunk-ANSHNREL.mjs} +3 -3
- package/dist/cli/{chunk-PO3NOBHU.mjs → chunk-C52RRBYB.mjs} +1 -1
- package/dist/cli/{chunk-IXFFOZZQ.js → chunk-CY3BUFMG.js} +2 -2
- package/dist/cli/{chunk-YQ36Z23U.js → chunk-DIZI5YGW.js} +2 -2
- package/dist/cli/{chunk-7JGHNZTD.js → chunk-DLWVJ66I.js} +4 -4
- package/dist/cli/{chunk-QRMTITKL.mjs → chunk-DSE45YP4.mjs} +2 -2
- package/dist/cli/{chunk-A3IVPA6Q.mjs → chunk-ENLJ67CZ.mjs} +1 -1
- package/dist/cli/{chunk-Z3DSCE5F.mjs → chunk-ESKNCTFI.mjs} +1 -1
- package/dist/cli/{chunk-WOU2WS6S.js → chunk-FUVVTHXE.js} +23 -23
- package/dist/cli/{chunk-RBPR5ZNN.js → chunk-FXLVMWWA.js} +100 -100
- package/dist/cli/{chunk-A5HDA22N.js → chunk-GWPXWKQR.js} +3 -3
- package/dist/cli/{chunk-Z6OUUAIV.mjs → chunk-IXCGWJJZ.mjs} +2 -2
- package/dist/cli/{chunk-6N3NTEJ6.js → chunk-IZK2BLBW.js} +20 -20
- package/dist/cli/{chunk-YGGHPEWP.js → chunk-JAW75RAO.js} +15 -15
- package/dist/cli/{chunk-GCE5KOJJ.mjs → chunk-JCVAVHDP.mjs} +11 -11
- package/dist/cli/{chunk-C3FHMJ4A.js → chunk-KART6FR6.js} +2 -2
- package/dist/cli/{chunk-VLQB65HI.js → chunk-KQLIG4YR.js} +9 -9
- package/dist/cli/{chunk-IFKZQCPX.js → chunk-KQZBN7TB.js} +1 -1
- package/dist/cli/{chunk-336AHC7H.mjs → chunk-LPYUGPTF.mjs} +4 -4
- package/dist/cli/{chunk-A3B54QEW.mjs → chunk-M2UJWUWX.mjs} +3 -3
- package/dist/cli/{chunk-CR6IPQBB.mjs → chunk-MQOJ7SP4.mjs} +1 -1
- package/dist/cli/{chunk-XD4MT4BH.js → chunk-N3VZTISZ.js} +8 -8
- package/dist/cli/{chunk-H6QMUX7Y.mjs → chunk-N5VL6BHF.mjs} +2 -2
- package/dist/cli/{chunk-YDULFKDL.mjs → chunk-NJTTRJ32.mjs} +2 -2
- package/dist/cli/{chunk-ETGM6PIR.mjs → chunk-NUH56LTU.mjs} +5 -5
- package/dist/cli/{chunk-SJYLLHHZ.js → chunk-OG3YWDYA.js} +13 -13
- package/dist/cli/{chunk-HGER4CJA.js → chunk-OPD6XUIG.js} +5 -5
- package/dist/cli/{chunk-WZOUXILM.mjs → chunk-PW3PADXI.mjs} +1 -1
- package/dist/cli/{chunk-UBNRPJKO.mjs → chunk-QDQOXHXQ.mjs} +5 -5
- package/dist/cli/{chunk-CFMIWRGD.mjs → chunk-QFDT35HF.mjs} +2 -2
- package/dist/cli/{chunk-VULSFPD4.mjs → chunk-ROSPYLDN.mjs} +5 -5
- package/dist/cli/{chunk-FQP5VSVF.mjs → chunk-T2QI52F2.mjs} +1 -1
- package/dist/cli/{chunk-NAGGCF6Y.js → chunk-TJSKDOXN.js} +5 -5
- package/dist/cli/{chunk-CITDBSXI.js → chunk-TNCJ2J76.js} +26 -26
- package/dist/cli/{chunk-73P76DCN.js → chunk-UBTEDSIK.js} +20 -20
- package/dist/cli/{chunk-PTM5V5FV.js → chunk-UNTBQY64.js} +7 -7
- package/dist/cli/{chunk-GACQOGRS.js → chunk-UZLTBBAG.js} +15 -15
- package/dist/cli/{chunk-6OP5UW7C.js → chunk-WQEGXOUT.js} +48 -48
- package/dist/cli/{chunk-TJU2BECV.mjs → chunk-WSXRJ2RZ.mjs} +3 -3
- package/dist/cli/{chunk-AOMVAXGX.js → chunk-X3BGF6UU.js} +10 -10
- package/dist/cli/{chunk-CF6CSAMJ.mjs → chunk-XAIXTB74.mjs} +4 -4
- package/dist/cli/{chunk-AD7BGMTL.mjs → chunk-XLN4Z654.mjs} +2 -2
- package/dist/cli/{chunk-2IZOCGOA.js → chunk-XVFRNNL2.js} +53 -53
- package/dist/cli/{chunk-MFBFQUQK.js → chunk-XWO4J34B.js} +6 -6
- package/dist/cli/{chunk-GOUKX6XD.js → chunk-YKHXWO7N.js} +3 -3
- package/dist/cli/{chunk-ILKUKEWX.js → chunk-Z6KWSBOX.js} +41 -41
- package/dist/cli/concurrent-runs-help-HEIDXAM2.js +22 -0
- package/dist/cli/{concurrent-runs-help-VPYB4ODC.mjs → concurrent-runs-help-IILHMHBX.mjs} +6 -6
- package/dist/cli/{csv-GHGDSFNV.js → csv-OSJQVDAS.js} +13 -13
- package/dist/cli/{csv-RALLG3MG.mjs → csv-VGYW2PQZ.mjs} +4 -4
- package/dist/cli/{db-722SKSIB.js → db-2IMS6K2F.js} +27 -27
- package/dist/cli/{db-HB65VYRR.mjs → db-3IQYT3WD.mjs} +6 -6
- package/dist/cli/{describe-Q6M7PUBU.mjs → describe-IGJ4CHUC.mjs} +18 -18
- package/dist/cli/describe-LBU4I6SU.js +50 -0
- package/dist/cli/{executions-G3M75HW2.mjs → executions-6F3PLVCR.mjs} +6 -6
- package/dist/cli/{executions-GQNV3LNU.js → executions-VOJN4NPF.js} +8 -8
- package/dist/cli/{feedback-B43F2FBL.js → feedback-5N7GKSMC.js} +14 -14
- package/dist/cli/{feedback-CSDBYSRS.mjs → feedback-BP5G27DT.mjs} +6 -6
- package/dist/cli/{git-IZ4Y3RAW.mjs → git-FHNCP7QA.mjs} +5 -5
- package/dist/cli/git-JUSPUUOH.js +26 -0
- package/dist/cli/index.js +143 -143
- package/dist/cli/index.mjs +45 -45
- package/dist/cli/{integrations-OLCUWZ6Z.js → integrations-JZV55BZT.js} +29 -29
- package/dist/cli/{integrations-DT7EGM2Y.mjs → integrations-KKCEEWDU.mjs} +7 -7
- package/dist/cli/{legacy-noops-FTGNTO3U.js → legacy-noops-OVOHF47E.js} +9 -9
- package/dist/cli/{legacy-noops-4TPT534L.mjs → legacy-noops-YOPWDLRG.mjs} +6 -6
- package/dist/cli/{mcp-3IDWLBKK.js → mcp-F2XGBA6W.js} +24 -24
- package/dist/cli/{mcp-5KDJJT7M.mjs → mcp-SJAXFYTI.mjs} +4 -4
- package/dist/cli/{monitors-EOAA5RQO.mjs → monitors-PFH3FQLD.mjs} +7 -7
- package/dist/cli/{monitors-7GOZBKJR.js → monitors-RQRNQRYB.js} +100 -100
- package/dist/cli/{org-H5I56A4F.mjs → org-PZC6SUZD.mjs} +6 -6
- package/dist/cli/{org-UJ5SWQJ5.js → org-WPOEKMTG.js} +121 -121
- package/dist/cli/{outcomes-24KFY2X5.js → outcomes-EXOCNHOC.js} +14 -14
- package/dist/cli/{outcomes-MG57YXJX.mjs → outcomes-ZS7XD3KQ.mjs} +6 -6
- package/dist/cli/{play-PPPACSQE.js → play-JS2TEEE7.js} +324 -324
- package/dist/cli/{play-MXPXRAUM.mjs → play-UKSRFVIU.mjs} +19 -19
- package/dist/cli/{providers-LTYNEXLB.js → providers-3U4MWBLU.js} +9 -9
- package/dist/cli/{providers-5ZN3MO6E.mjs → providers-U6IODPMJ.mjs} +6 -6
- package/dist/cli/{quickstart-ENDTTNLE.mjs → quickstart-G5QN5CUE.mjs} +4 -4
- package/dist/cli/{quickstart-UBDHX7PT.js → quickstart-SHBAEDX6.js} +6 -6
- package/dist/cli/{run-QJJSP35C.mjs → run-3ZOJ6V7C.mjs} +23 -23
- package/dist/cli/{run-6O6LQVWD.js → run-SZRKNLUT.js} +44 -44
- package/dist/cli/{search-PXZPVXDK.mjs → search-2VX5WNMJ.mjs} +7 -7
- package/dist/cli/search-TAFMLK4K.js +32 -0
- package/dist/cli/{search-output-KRR4YOJX.mjs → search-output-U5N2O6IA.mjs} +4 -4
- package/dist/cli/{search-output-H3ZQLJUF.js → search-output-WGDHYYHX.js} +6 -6
- package/dist/cli/{secrets-HIGERL4N.mjs → secrets-SQKP5ILO.mjs} +6 -6
- package/dist/cli/{secrets-QZMXBI64.js → secrets-UITJOGVQ.js} +15 -15
- package/dist/cli/{sessions-4SGQAX3F.mjs → sessions-LSXO2OKX.mjs} +6 -6
- package/dist/cli/sessions-RA6FBIHJ.js +23 -0
- package/dist/cli/{settings-FFTTVDRV.js → settings-VZI675JG.js} +85 -85
- package/dist/cli/{settings-UQLHVBOP.mjs → settings-YGYRDPOK.mjs} +12 -12
- package/dist/cli/{setup-R5MBUG5M.mjs → setup-GXGXRWKN.mjs} +9 -9
- package/dist/cli/{setup-SS3MABJP.js → setup-OJ33NOWK.js} +49 -49
- package/dist/cli/{skills-X6PNEVWX.mjs → skills-3VDYIFAX.mjs} +7 -7
- package/dist/cli/skills-J5QVWKLQ.js +37 -0
- package/dist/cli/tools-3PQXQGXL.js +57 -0
- package/dist/cli/{tools-YFW3FXAB.mjs → tools-3TKEGDBP.mjs} +17 -17
- package/dist/cli/update-CA3DZ75E.js +37 -0
- package/dist/cli/{update-HX5BNFLQ.mjs → update-K6A4QXTC.mjs} +9 -9
- package/dist/cli/{views-FH5XL2PU.mjs → views-2PPIVWDK.mjs} +6 -6
- package/dist/cli/{views-BGCRC22G.js → views-SGGO77XS.js} +21 -21
- package/dist/cli/{workflow-VLNDGNJI.mjs → workflow-JTG6QEFO.mjs} +7 -7
- package/dist/cli/{workflow-UY5PZBIK.js → workflow-YSFOOTPB.js} +17 -17
- package/dist/index.js +9 -9
- package/dist/index.mjs +6 -6
- package/dist/install-integrity.json +112 -112
- package/dist/release.d.mts +1 -1
- package/dist/release.d.ts +1 -1
- package/dist/release.js +2 -2
- package/dist/release.mjs +1 -1
- package/dist/server.js +5 -5
- package/dist/server.mjs +3 -3
- package/package.json +1 -1
- package/dist/cli/auth-FKYYYCME.js +0 -44
- package/dist/cli/concurrent-runs-help-VUMIMYO7.js +0 -22
- package/dist/cli/describe-SG2N62VE.js +0 -50
- package/dist/cli/git-IJHKRWTR.js +0 -26
- package/dist/cli/search-TYPJWK4I.js +0 -32
- package/dist/cli/sessions-OS4ZBU4K.js +0 -23
- package/dist/cli/skills-FVDSEEUL.js +0 -37
- package/dist/cli/tools-ORTGWD63.js +0 -57
- package/dist/cli/update-RWVNNNHN.js +0 -37
package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/early-sandbox-lane.ts
CHANGED
|
@@ -424,12 +424,29 @@ export function startWorkerLaneEarlySandbox(
|
|
|
424
424
|
workflowId: input.workflowId,
|
|
425
425
|
...adapter.scope(request),
|
|
426
426
|
});
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
427
|
+
// CA spread: the gateway chose this worker for its free capacity and named
|
|
428
|
+
// no generation; the run's claim follows its recorded owner (this worker),
|
|
429
|
+
// so the desk binds the hint to the queue and one free slot only. Without
|
|
430
|
+
// CA a hint must still name this worker's current listener generation.
|
|
431
|
+
const claimOwnerHint =
|
|
432
|
+
!input.listenerHint?.listenerGeneration &&
|
|
433
|
+
resolveExperimentSwitch(
|
|
434
|
+
'CA',
|
|
435
|
+
input.experimentSwitchOverrides,
|
|
436
|
+
CLAIM_AFFINITY_FOR_EARLY_SANDBOX,
|
|
437
|
+
);
|
|
438
|
+
const refusal = claimOwnerHint
|
|
439
|
+
? desk.admitClaimOwner({
|
|
440
|
+
key,
|
|
441
|
+
workflowId: input.workflowId,
|
|
442
|
+
queue: input.listenerHint?.queue ?? '',
|
|
443
|
+
})
|
|
444
|
+
: desk.admit({
|
|
445
|
+
key,
|
|
446
|
+
workflowId: input.workflowId,
|
|
447
|
+
queue: input.listenerHint?.queue ?? '',
|
|
448
|
+
listenerGeneration: input.listenerHint?.listenerGeneration ?? '',
|
|
449
|
+
});
|
|
433
450
|
if (refusal) {
|
|
434
451
|
return refuseEarlySandboxHint({ ...hint, reason: `listener_${refusal}` });
|
|
435
452
|
}
|
|
@@ -48,6 +48,9 @@ export const EARLY_SANDBOX_LISTENER_HINT = false;
|
|
|
48
48
|
*/
|
|
49
49
|
export const EARLY_SANDBOX_LISTENER_RESERVATION_MS = 10_000;
|
|
50
50
|
|
|
51
|
+
/** The generation recorded on a CA spread reservation (never a real one). */
|
|
52
|
+
const CLAIM_OWNER_RESERVATION = 'claim-owner';
|
|
53
|
+
|
|
51
54
|
/** A worker's hold on its queue's listener election. */
|
|
52
55
|
export type EarlySandboxListenerLeadership = {
|
|
53
56
|
/** The release queue this worker claims from. */
|
|
@@ -131,6 +134,17 @@ export type EarlySandboxListenerHintDesk = {
|
|
|
131
134
|
queue: string;
|
|
132
135
|
listenerGeneration: string;
|
|
133
136
|
}): EarlySandboxListenerHintRefusal | null;
|
|
137
|
+
/**
|
|
138
|
+
* CA spread: a hint the gateway sent to this worker for its free capacity,
|
|
139
|
+
* not its leadership. Bound to the queue and one free slot only; the run's
|
|
140
|
+
* claim reaches this worker through its recorded claim owner (CA), so a
|
|
141
|
+
* reservation is not tied to a listener generation and survives handover.
|
|
142
|
+
*/
|
|
143
|
+
admitClaimOwner(hint: {
|
|
144
|
+
key: string;
|
|
145
|
+
workflowId: string;
|
|
146
|
+
queue: string;
|
|
147
|
+
}): EarlySandboxListenerHintRefusal | null;
|
|
134
148
|
/** The launch took the run's sandbox here: release, keep the sandbox. */
|
|
135
149
|
adopted(key: string): void;
|
|
136
150
|
/**
|
|
@@ -231,6 +245,26 @@ export function createEarlySandboxListenerHintDesk(input: {
|
|
|
231
245
|
held.set(hint.key, { reservation, timer });
|
|
232
246
|
return null;
|
|
233
247
|
},
|
|
248
|
+
admitClaimOwner: (hint) => {
|
|
249
|
+
if (hint.queue !== input.leadership.queue) return 'foreign_queue';
|
|
250
|
+
if (input.capacity.draining) return 'worker_draining';
|
|
251
|
+
if (held.has(hint.key)) return 'duplicate_hint';
|
|
252
|
+
if (unreservedSlots() < 1) return 'no_idle_slot';
|
|
253
|
+
// No generation: a leadership loss never drops this reservation.
|
|
254
|
+
const reservation = {
|
|
255
|
+
key: hint.key,
|
|
256
|
+
workflowId: hint.workflowId,
|
|
257
|
+
generation: CLAIM_OWNER_RESERVATION,
|
|
258
|
+
acceptedAtMs: now(),
|
|
259
|
+
};
|
|
260
|
+
const timer = setTimer(() => {
|
|
261
|
+
if (held.get(hint.key)?.reservation !== reservation) return;
|
|
262
|
+
drop(hint.key);
|
|
263
|
+
input.onUnadopted?.(reservation, 'expired');
|
|
264
|
+
}, reservationMs);
|
|
265
|
+
held.set(hint.key, { reservation, timer });
|
|
266
|
+
return null;
|
|
267
|
+
},
|
|
234
268
|
adopted: (key) => {
|
|
235
269
|
drop(key);
|
|
236
270
|
},
|
|
@@ -253,6 +287,34 @@ export function createEarlySandboxListenerHintDesk(input: {
|
|
|
253
287
|
};
|
|
254
288
|
}
|
|
255
289
|
|
|
290
|
+
/**
|
|
291
|
+
* CA spread: the gateway's choice by free capacity. Among the workers for the
|
|
292
|
+
* run's queue that are not draining and have an unreserved slot, the one with
|
|
293
|
+
* the most unreserved slots (ties broken by `pick`). None: null, and the
|
|
294
|
+
* caller falls back to the listener choice.
|
|
295
|
+
*/
|
|
296
|
+
export function selectEarlySandboxClaimOwnerTarget(input: {
|
|
297
|
+
queue: string;
|
|
298
|
+
statuses: readonly (EarlySandboxListenerStatus | null)[];
|
|
299
|
+
/** Chooses among equally free candidates; random by default. */
|
|
300
|
+
pick?: (count: number) => number;
|
|
301
|
+
}): number | null {
|
|
302
|
+
const candidates = input.statuses.flatMap((status, index) =>
|
|
303
|
+
status &&
|
|
304
|
+
status.queue === input.queue &&
|
|
305
|
+
!status.draining &&
|
|
306
|
+
status.unreservedSlots >= 1
|
|
307
|
+
? [{ index, slots: status.unreservedSlots }]
|
|
308
|
+
: [],
|
|
309
|
+
);
|
|
310
|
+
if (candidates.length === 0) return null;
|
|
311
|
+
const most = Math.max(...candidates.map((candidate) => candidate.slots));
|
|
312
|
+
const top = candidates.filter((candidate) => candidate.slots === most);
|
|
313
|
+
const pick = input.pick ?? ((count) => Math.floor(Math.random() * count));
|
|
314
|
+
const chosen = top[Math.min(top.length - 1, Math.max(0, pick(top.length)))];
|
|
315
|
+
return chosen!.index;
|
|
316
|
+
}
|
|
317
|
+
|
|
256
318
|
export type EarlySandboxListenerSelection =
|
|
257
319
|
| { target: number; generation: string }
|
|
258
320
|
| { refused: 'no_listener' | 'ambiguous_listeners' | 'listener_busy' };
|
|
@@ -12924,7 +12924,11 @@ export async function recordPostgresSchedulerManagedSandboxOperationLive(
|
|
|
12924
12924
|
input.resource.daytonaEnvironment ??
|
|
12925
12925
|
'production';
|
|
12926
12926
|
const operationStates = runtimeSandboxOperationFromStatesCast(options);
|
|
12927
|
-
|
|
12927
|
+
// Another operation already bound this sandbox (UNIQUE provider,
|
|
12928
|
+
// sandbox_id, routing domain): this attempt lost the sandbox to it. That is
|
|
12929
|
+
// a fence loss, never success (PX: two launches adopted one early sandbox).
|
|
12930
|
+
const recorded = await client
|
|
12931
|
+
.query<{ operation_key: string }>(
|
|
12928
12932
|
`
|
|
12929
12933
|
WITH ${runtimeSandboxCustodyLocksSql('run.run_id = $1', options)}, eligible_attempt AS (
|
|
12930
12934
|
SELECT run_id
|
|
@@ -13005,7 +13009,12 @@ export async function recordPostgresSchedulerManagedSandboxOperationLive(
|
|
|
13005
13009
|
provider,
|
|
13006
13010
|
runtimeSandboxOperationFromStates('bind_live'),
|
|
13007
13011
|
],
|
|
13008
|
-
)
|
|
13012
|
+
)
|
|
13013
|
+
.catch((error: unknown) => {
|
|
13014
|
+
if ((error as { code?: unknown } | null)?.code === '23505')
|
|
13015
|
+
return { rows: [] as { operation_key: string }[] };
|
|
13016
|
+
throw error;
|
|
13017
|
+
});
|
|
13009
13018
|
if (recorded.rows.length === 1) return true;
|
|
13010
13019
|
// Daytona reports the end of a retired sandbox's billing interval before
|
|
13011
13020
|
// retrying acquisition. That is an update to the same live resource, not a
|
package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-worker-wake.ts
CHANGED
|
@@ -6,12 +6,16 @@ import {
|
|
|
6
6
|
resolveExperimentSwitch,
|
|
7
7
|
type ExperimentSwitchOverrides,
|
|
8
8
|
} from '../experiment-switches';
|
|
9
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
CLAIM_AFFINITY_FOR_EARLY_SANDBOX,
|
|
11
|
+
parseEarlySandboxClaimOwner,
|
|
12
|
+
} from './early-sandbox-claim-affinity';
|
|
10
13
|
import {
|
|
11
14
|
EARLY_SANDBOX_LISTENER_HINT,
|
|
12
15
|
parseEarlySandboxListenerGeneration,
|
|
13
16
|
parseEarlySandboxListenerQueue,
|
|
14
17
|
parseEarlySandboxListenerStatus,
|
|
18
|
+
selectEarlySandboxClaimOwnerTarget,
|
|
15
19
|
selectEarlySandboxListener,
|
|
16
20
|
type EarlySandboxListenerStatus,
|
|
17
21
|
} from './early-sandbox-listener-hint';
|
|
@@ -550,10 +554,20 @@ export async function findEarlySandboxListener(input: {
|
|
|
550
554
|
signal?: AbortSignal;
|
|
551
555
|
/** Close each connection after its read (the path warmer: no pooled socket). */
|
|
552
556
|
closeConnections?: boolean;
|
|
557
|
+
/**
|
|
558
|
+
* CA spread: choose the worker with the most free capacity for the queue
|
|
559
|
+
* (its claim follows through the recorded claim owner); with none, fall
|
|
560
|
+
* back to the listener choice.
|
|
561
|
+
*/
|
|
562
|
+
claimOwner?: boolean;
|
|
563
|
+
/** Test seam for the spread tie-break. */
|
|
564
|
+
pick?: (count: number) => number;
|
|
553
565
|
}): Promise<
|
|
554
566
|
| {
|
|
555
567
|
target: URL;
|
|
556
|
-
generation
|
|
568
|
+
/** The listener's generation, or null for a CA spread target. */
|
|
569
|
+
generation: string | null;
|
|
570
|
+
mode: 'listener' | 'claim_owner';
|
|
557
571
|
asked: number;
|
|
558
572
|
outcomes: EarlySandboxListenerStatusOutcomes;
|
|
559
573
|
}
|
|
@@ -666,6 +680,24 @@ export async function findEarlySandboxListener(input: {
|
|
|
666
680
|
}
|
|
667
681
|
}),
|
|
668
682
|
);
|
|
683
|
+
if (input.claimOwner) {
|
|
684
|
+
const spread = selectEarlySandboxClaimOwnerTarget({
|
|
685
|
+
queue: input.queue,
|
|
686
|
+
statuses,
|
|
687
|
+
...(input.pick ? { pick: input.pick } : {}),
|
|
688
|
+
});
|
|
689
|
+
if (spread !== null) {
|
|
690
|
+
const target = new URL(targets[spread]!);
|
|
691
|
+
target.pathname = RUNTIME_WORKER_EARLY_SANDBOX_PATH;
|
|
692
|
+
return {
|
|
693
|
+
target,
|
|
694
|
+
generation: null,
|
|
695
|
+
mode: 'claim_owner',
|
|
696
|
+
asked: targets.length,
|
|
697
|
+
outcomes,
|
|
698
|
+
};
|
|
699
|
+
}
|
|
700
|
+
}
|
|
669
701
|
const selection = selectEarlySandboxListener({
|
|
670
702
|
queue: input.queue,
|
|
671
703
|
statuses,
|
|
@@ -677,6 +709,7 @@ export async function findEarlySandboxListener(input: {
|
|
|
677
709
|
return {
|
|
678
710
|
target,
|
|
679
711
|
generation: selection.generation,
|
|
712
|
+
mode: 'listener',
|
|
680
713
|
asked: targets.length,
|
|
681
714
|
outcomes,
|
|
682
715
|
};
|
|
@@ -778,10 +811,19 @@ export async function handleRuntimeGatewayEarlySandbox(
|
|
|
778
811
|
return respond(503, '{"ok":false,"refused":"no_queue"}');
|
|
779
812
|
}
|
|
780
813
|
const lhStartedAt = performance.now();
|
|
814
|
+
// CA spread: with CA the run's claim follows its recorded owner, so the
|
|
815
|
+
// hint goes to the worker with the most free capacity, not only the
|
|
816
|
+
// listener; Production keeps CA off until a profile turns it on.
|
|
817
|
+
const claimOwner = resolveExperimentSwitch(
|
|
818
|
+
'CA',
|
|
819
|
+
hint.experimentSwitchOverrides,
|
|
820
|
+
CLAIM_AFFINITY_FOR_EARLY_SANDBOX,
|
|
821
|
+
);
|
|
781
822
|
const found = await (input.findListener ?? findEarlySandboxListener)({
|
|
782
823
|
url: workerUrl.toString(),
|
|
783
824
|
token: input.target.token,
|
|
784
825
|
queue: hint.queue,
|
|
826
|
+
...(claimOwner ? { claimOwner: true } : {}),
|
|
785
827
|
});
|
|
786
828
|
if ('refused' in found) {
|
|
787
829
|
decided({
|
|
@@ -807,10 +849,12 @@ export async function handleRuntimeGatewayEarlySandbox(
|
|
|
807
849
|
(performance.now() - lhStartedAt),
|
|
808
850
|
),
|
|
809
851
|
);
|
|
810
|
-
const { status } = await requestRuntimeWorkerEarlySandboxWithOwner(
|
|
852
|
+
const { status, owner } = await requestRuntimeWorkerEarlySandboxWithOwner(
|
|
811
853
|
found.target.toString(),
|
|
812
854
|
input.target.token,
|
|
813
|
-
|
|
855
|
+
found.generation === null
|
|
856
|
+
? hint
|
|
857
|
+
: { ...hint, listenerGeneration: found.generation },
|
|
814
858
|
relayBudgetMs,
|
|
815
859
|
);
|
|
816
860
|
// A refusing worker (handover since the status read, slot taken) means
|
|
@@ -819,7 +863,9 @@ export async function handleRuntimeGatewayEarlySandbox(
|
|
|
819
863
|
status === 202
|
|
820
864
|
? {
|
|
821
865
|
event: 'accepted',
|
|
866
|
+
mode: found.mode,
|
|
822
867
|
generation: found.generation,
|
|
868
|
+
...(owner ? { owner } : {}),
|
|
823
869
|
asked: found.asked,
|
|
824
870
|
lookupMs: found.outcomes.lookupMs,
|
|
825
871
|
slowestReadMs: found.outcomes.slowestReadMs,
|
|
@@ -831,10 +877,13 @@ export async function handleRuntimeGatewayEarlySandbox(
|
|
|
831
877
|
asked: found.asked,
|
|
832
878
|
},
|
|
833
879
|
);
|
|
880
|
+
// CA needs the owner in the reply to record it on the run's task.
|
|
834
881
|
return respond(
|
|
835
882
|
status ?? 503,
|
|
836
883
|
status === 202
|
|
837
|
-
?
|
|
884
|
+
? owner
|
|
885
|
+
? JSON.stringify({ ok: true, owner })
|
|
886
|
+
: '{"ok":true}'
|
|
838
887
|
: JSON.stringify({ ok: false, refused: 'listener_refused' }),
|
|
839
888
|
);
|
|
840
889
|
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
var _chunkXVFRNNL2js = require('./chunk-XVFRNNL2.js');
|
|
18
|
+
require('./chunk-IZK2BLBW.js');
|
|
19
|
+
require('./chunk-GWPXWKQR.js');
|
|
20
|
+
require('./chunk-DLWVJ66I.js');
|
|
21
|
+
require('./chunk-6VLFQZK6.js');
|
|
22
|
+
require('./chunk-XNYIZMNQ.js');
|
|
23
|
+
require('./chunk-LFQJW4S2.js');
|
|
24
|
+
require('./chunk-CFJFUVX2.js');
|
|
25
|
+
require('./chunk-KQZBN7TB.js');
|
|
26
|
+
require('./chunk-OG64RBAC.js');
|
|
27
|
+
require('./chunk-COGTRVWW.js');
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
exports.EXIT_WORKSPACE_MISMATCH = _chunkXVFRNNL2js.EXIT_WORKSPACE_MISMATCH; exports.authStatusLine = _chunkXVFRNNL2js.authStatusLine; exports.clearPendingClaim = _chunkXVFRNNL2js.clearPendingClaim; exports.clearSatisfiedPendingClaim = _chunkXVFRNNL2js.clearSatisfiedPendingClaim; exports.handleRegister = _chunkXVFRNNL2js.handleRegister; exports.handleStatus = _chunkXVFRNNL2js.handleStatus; exports.handleWait = _chunkXVFRNNL2js.handleWait; exports.httpJson = _chunkXVFRNNL2js.httpJson; exports.readPendingAuthClaim = _chunkXVFRNNL2js.readPendingAuthClaim; exports.readStatusBanner = _chunkXVFRNNL2js.readStatusBanner; exports.registerAuthCommands = _chunkXVFRNNL2js.registerAuthCommands; exports.reportApprovalLinkShown = _chunkXVFRNNL2js.reportApprovalLinkShown; exports.reportSetupCompleted = _chunkXVFRNNL2js.reportSetupCompleted; exports.resolvePendingAuthClaimForResume = _chunkXVFRNNL2js.resolvePendingAuthClaimForResume; exports.statusBannerLine = _chunkXVFRNNL2js.statusBannerLine;
|
|
@@ -14,15 +14,15 @@ import {
|
|
|
14
14
|
reportSetupCompleted,
|
|
15
15
|
resolvePendingAuthClaimForResume,
|
|
16
16
|
statusBannerLine
|
|
17
|
-
} from "./chunk-
|
|
18
|
-
import "./chunk-
|
|
19
|
-
import "./chunk-
|
|
20
|
-
import "./chunk-
|
|
17
|
+
} from "./chunk-ANSHNREL.mjs";
|
|
18
|
+
import "./chunk-DSE45YP4.mjs";
|
|
19
|
+
import "./chunk-MQOJ7SP4.mjs";
|
|
20
|
+
import "./chunk-ENLJ67CZ.mjs";
|
|
21
21
|
import "./chunk-ASB47RXJ.mjs";
|
|
22
22
|
import "./chunk-DLIRSHV6.mjs";
|
|
23
23
|
import "./chunk-Z3A2S3QM.mjs";
|
|
24
24
|
import "./chunk-2MGZAI54.mjs";
|
|
25
|
-
import "./chunk-
|
|
25
|
+
import "./chunk-ESKNCTFI.mjs";
|
|
26
26
|
import "./chunk-WZYKRD7T.mjs";
|
|
27
27
|
import "./chunk-KRD6H754.mjs";
|
|
28
28
|
export {
|