@mark1russell7/harness 0.16.17 → 0.16.19
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/README.md +25 -1
- package/build/{cell-CeLvi_tR.d.ts → cell-CgjwfQQ-.d.ts} +253 -4
- package/build/{image-BE9H5gIv.js → image-S18_TQfQ.js} +693 -4
- package/build/image-S18_TQfQ.js.map +1 -0
- package/build/index.d.ts +11 -205
- package/build/index.js +25 -642
- package/build/index.js.map +1 -1
- package/build/layers.d.ts +1 -1
- package/build/schema.d.ts +1 -1
- package/build/schema.js +1 -1
- package/image/native/src/bin/load.rs +617 -81
- package/package.json +1 -1
- package/build/image-BE9H5gIv.js.map +0 -1
package/build/index.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { A as targetSourceOf, B as versionsOf, C as programOf, D as subjectClient, E as sources, F as goVersions, G as requestFirst, H as environmentProblems, I as jarVersions, L as locksOf, M as unpinnedBases, N as LOCK_NAMES, O as subjectProblems, P as cargoVersions, R as npmDrift, S as planOf, T as shippedSource, U as isHopPlace, V as CLIENT_CAPABILITIES, W as latestEndOf, _ as kafkaClientImage, a as SHIPPED_NAMES, b as nodeHttpImage, c as buildRecordOf, d as harnessImage, f as harnessVersion, g as inContext, h as imageProblems, i as SHIPPED_CLIENTS, j as unlockedManifests, k as targetImageOf, l as goHttpImage, m as imageOf, n as PINNED, o as amqpClientImage, p as hikariClientImage, r as REPOSITORY, s as basesOf, t as CLIENT_NAMES, u as grpcClientImage, v as mongoClientImage, w as routerImage, x as pgClientImage, y as nodeClientImage, z as npmVersions } from "./image-
|
|
1
|
+
import { $ as hostLimitsOf, A as targetSourceOf, B as versionsOf, C as programOf, D as subjectClient, E as sources, F as goVersions, G as requestFirst, H as environmentProblems, I as jarVersions, J as cgroupKeyed, K as RESOURCES_EVENT, L as locksOf, M as unpinnedBases, N as LOCK_NAMES, O as subjectProblems, P as cargoVersions, Q as cpuStatOf, R as npmDrift, S as planOf, T as shippedSource, U as isHopPlace, V as CLIENT_CAPABILITIES, W as latestEndOf, X as cgroupNumber, Y as cgroupLimit, Z as cpuMaxOf, _ as kafkaClientImage, _t as loadPlanOf, a as SHIPPED_NAMES, at as resourceReadingIn, b as nodeHttpImage, bt as streamsLoadOf, c as buildRecordOf, ct as LOAD_FORMAT, d as harnessImage, dt as SCHEDULE_PATH, et as limitsProblems, f as harnessVersion, ft as connectionsProblems, g as inContext, gt as loadOf, h as imageProblems, ht as loadEnds, i as SHIPPED_CLIENTS, it as resourceChange, j as unlockedManifests, k as targetImageOf, l as goHttpImage, lt as LOAD_PATH, m as imageOf, mt as estimateVerdict, n as PINNED, nt as networkOf, o as amqpClientImage, ot as resourceReadingOf, p as hikariClientImage, pt as estimateOf, q as RESOURCES_PROGRAM, r as REPOSITORY, rt as resourceArgs, s as basesOf, st as CLOSED_TOLERANCE, t as CLIENT_NAMES, tt as memoryStatOf, u as grpcClientImage, ut as LOAD_POOL_LIMIT, v as mongoClientImage, vt as loadVerdict, w as routerImage, x as pgClientImage, y as nodeClientImage, yt as poolOf, z as npmVersions } from "./image-S18_TQfQ.js";
|
|
2
2
|
import { LAYERS, LAYER_FACTS, LIMITS, layerOf, limitsOf } from "./layers.js";
|
|
3
3
|
import { quantity, valueIn } from "@mark1russell7/quantity";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { checkDiskFault, closedLoopPlan, measureLoad, schedule, scheduleHeld, stopTriggerOf } from "@mark1russell7/rigor-chaos";
|
|
4
|
+
import { checkDiskFault, schedule, stopTriggerOf } from "@mark1russell7/rigor-chaos";
|
|
5
|
+
import { median, medianInterval as medianInterval$1, quantileSorted } from "@mark1russell7/rigor-statistics";
|
|
7
6
|
import { setTimeout as setTimeout$1 } from "node:timers/promises";
|
|
8
7
|
import { createHash, randomBytes } from "node:crypto";
|
|
9
8
|
import { execFile } from "node:child_process";
|
|
@@ -12,300 +11,6 @@ import { release, tmpdir } from "node:os";
|
|
|
12
11
|
import { join, relative, resolve } from "node:path";
|
|
13
12
|
import { existsSync, readFileSync, statSync } from "node:fs";
|
|
14
13
|
import { STOP_ENV, parseProgress, stopOrderOf } from "@mark1russell7/rigor-testkit/stop";
|
|
15
|
-
// src/load.ts
|
|
16
|
-
/**
|
|
17
|
-
* The measure and the verdict of an open-loop cell (SYS-68). A client on a schedule sends each
|
|
18
|
-
* arrival at its time, thus a stall counts in each arrival that it delayed. The package rigor-chaos
|
|
19
|
-
* counts each latency from the planned time. The package rigor-bench judges a quantile by a
|
|
20
|
-
* distribution-free interval.
|
|
21
|
-
*/
|
|
22
|
-
/** This path is where the client of an open-loop cell finds its schedule. */
|
|
23
|
-
const SCHEDULE_PATH = "/tmp/schedule.json";
|
|
24
|
-
/** This function gives the time of a line of the client, in ms from the start of the schedule. */
|
|
25
|
-
const fromStart = (start, t) => (t - start) / 1e6;
|
|
26
|
-
/**
|
|
27
|
-
* This function gives the measure of one run of a schedule from the lines of its client. It gives
|
|
28
|
-
* null when the client did not start the schedule. The first `sent` line of a client is its request
|
|
29
|
-
* before `ready`, and it names no arrival. The end of the run is its last line.
|
|
30
|
-
*/
|
|
31
|
-
const loadOf = (events, plan) => {
|
|
32
|
-
const start = events.find((event) => event.ev === "scheduled")?.t;
|
|
33
|
-
if (start === void 0) return null;
|
|
34
|
-
return measureOf(events, start, plan, void 0);
|
|
35
|
-
};
|
|
36
|
-
/** This function tells if a status of a reply is a failure: a number outside 200 to 299. */
|
|
37
|
-
const failedStatus = (status) => typeof status === "number" && (status < 200 || status > 299);
|
|
38
|
-
/** This function gives the measure of the arrivals of one stream: the lines with the key `key`, or each line for no key. */
|
|
39
|
-
const measureOf = (events, start, plan, key) => {
|
|
40
|
-
const sent = /* @__PURE__ */ new Map();
|
|
41
|
-
const done = /* @__PURE__ */ new Map();
|
|
42
|
-
let failed = 0;
|
|
43
|
-
for (const event of events) {
|
|
44
|
-
const index = event["i"];
|
|
45
|
-
if (typeof index !== "number" || key !== void 0 && event["k"] !== key) continue;
|
|
46
|
-
if (event.ev === "sent") sent.set(index, fromStart(start, event.t));
|
|
47
|
-
if (event.ev === "replied") {
|
|
48
|
-
done.set(index, fromStart(start, event.t));
|
|
49
|
-
if (failedStatus(event["status"])) failed += 1;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
const completions = [...sent].map(([index, at]) => ({
|
|
53
|
-
index,
|
|
54
|
-
sent: at,
|
|
55
|
-
done: done.get(index) ?? null
|
|
56
|
-
}));
|
|
57
|
-
const end = events.reduce((latest, event) => Math.max(latest, fromStart(start, event.t)), 0);
|
|
58
|
-
return {
|
|
59
|
-
...measureLoad(plan, completions, end),
|
|
60
|
-
failed
|
|
61
|
-
};
|
|
62
|
-
};
|
|
63
|
-
/** This path is where the client `load` finds its plan. */
|
|
64
|
-
const LOAD_PATH = "/tmp/load.json";
|
|
65
|
-
/** This text is the format of the plan of the client `load`. */
|
|
66
|
-
const LOAD_FORMAT = "systems-load/1";
|
|
67
|
-
/**
|
|
68
|
-
* This function gives the schedule of each stream of a cell, and the text of the plan of the client
|
|
69
|
-
* `load`. It throws for no stream, for two streams with one key and for a stream with no request.
|
|
70
|
-
*/
|
|
71
|
-
const loadPlanOf = (streams) => {
|
|
72
|
-
if (streams.length === 0) throw new RangeError("a plan of the client load has no stream");
|
|
73
|
-
const keys = /* @__PURE__ */ new Set();
|
|
74
|
-
for (const stream of streams) {
|
|
75
|
-
if (keys.has(stream.key)) throw new RangeError(`two streams have the key ${stream.key}`);
|
|
76
|
-
if (stream.requests.length === 0) throw new RangeError(`the stream ${stream.key} has no request`);
|
|
77
|
-
keys.add(stream.key);
|
|
78
|
-
}
|
|
79
|
-
const scheduled = streams.map((stream) => ({
|
|
80
|
-
key: stream.key,
|
|
81
|
-
schedule: schedule(stream.plan.profile, stream.plan.options),
|
|
82
|
-
requests: stream.requests
|
|
83
|
-
}));
|
|
84
|
-
return {
|
|
85
|
-
streams: scheduled.map(({ key, schedule: each }) => ({
|
|
86
|
-
key,
|
|
87
|
-
schedule: each
|
|
88
|
-
})),
|
|
89
|
-
content: JSON.stringify({
|
|
90
|
-
format: LOAD_FORMAT,
|
|
91
|
-
streams: scheduled
|
|
92
|
-
})
|
|
93
|
-
};
|
|
94
|
-
};
|
|
95
|
-
/**
|
|
96
|
-
* This function gives the measure of each stream of a run of the client `load`, and their pool. Each
|
|
97
|
-
* stream counts its arrivals from 0, thus the lines of a stream are the lines with its key. The pool
|
|
98
|
-
* sums the counts and joins the times, in the order of the streams. It gives null when the client did
|
|
99
|
-
* not start its schedule.
|
|
100
|
-
*/
|
|
101
|
-
const streamsLoadOf = (events, streams) => {
|
|
102
|
-
const start = events.find((event) => event.ev === "scheduled")?.t;
|
|
103
|
-
if (start === void 0) return null;
|
|
104
|
-
const each = streams.map((stream) => [stream.key, measureOf(events, start, stream.schedule, stream.key)]);
|
|
105
|
-
return {
|
|
106
|
-
pool: poolOf(each.map(([, measure]) => measure)),
|
|
107
|
-
streams: Object.fromEntries(each)
|
|
108
|
-
};
|
|
109
|
-
};
|
|
110
|
-
/** This function gives the pool of some measures: it sums the counts and joins the times, in the order of the measures. */
|
|
111
|
-
const poolOf = (measures) => {
|
|
112
|
-
const sum = (count) => measures.reduce((total, measure) => total + count(measure), 0);
|
|
113
|
-
const join = (times) => measures.flatMap(times);
|
|
114
|
-
return {
|
|
115
|
-
planned: sum((measure) => measure.planned),
|
|
116
|
-
unsent: sum((measure) => measure.unsent),
|
|
117
|
-
unfinished: sum((measure) => measure.unfinished),
|
|
118
|
-
failed: sum((measure) => measure.failed ?? 0),
|
|
119
|
-
latency: join((measure) => measure.latency),
|
|
120
|
-
service: join((measure) => measure.service),
|
|
121
|
-
lag: join((measure) => measure.lag),
|
|
122
|
-
censored: join((measure) => measure.censored)
|
|
123
|
-
};
|
|
124
|
-
};
|
|
125
|
-
/**
|
|
126
|
-
* This time is the tolerance of a closed-loop estimate, in ms. A send later than its expected time
|
|
127
|
-
* by more than this tolerance is a pause of the client: a driver gap.
|
|
128
|
-
*/
|
|
129
|
-
const CLOSED_TOLERANCE = 5;
|
|
130
|
-
/**
|
|
131
|
-
* This function gives the estimate of one closed-loop stream from its requests, in the order of their
|
|
132
|
-
* sends. Each time is a time of a line of the client. The client waits `interval` ms after each reply,
|
|
133
|
-
* thus the interval is also the pause of the driver. The function gives undefined for no request, and
|
|
134
|
-
* for a request with no reply before the last request.
|
|
135
|
-
*/
|
|
136
|
-
const estimateOf = (requests, end, interval) => {
|
|
137
|
-
const start = requests[0]?.sent;
|
|
138
|
-
if (start === void 0 || requests.slice(0, -1).some((request) => request.done === null)) return void 0;
|
|
139
|
-
const loop = requests.map((request) => ({
|
|
140
|
-
sent: fromStart(start, request.sent),
|
|
141
|
-
done: request.done === null ? null : fromStart(start, request.done)
|
|
142
|
-
}));
|
|
143
|
-
const stop = Math.max(fromStart(start, end), ...loop.map((request) => request.done ?? request.sent), interval);
|
|
144
|
-
const run = closedLoopPlan(loop, {
|
|
145
|
-
interval,
|
|
146
|
-
end: stop,
|
|
147
|
-
tolerance: 5,
|
|
148
|
-
pause: interval
|
|
149
|
-
});
|
|
150
|
-
return {
|
|
151
|
-
...measureLoad(run.plan, run.completions, stop),
|
|
152
|
-
hidden: run.hidden,
|
|
153
|
-
driverGaps: run.driverGaps,
|
|
154
|
-
driverGapTotal: run.driverGapTotal
|
|
155
|
-
};
|
|
156
|
-
};
|
|
157
|
-
/** This function gives the spread of a list of times in ms, or null for no time. */
|
|
158
|
-
const spreadOf$1 = (values) => values.length === 0 ? null : {
|
|
159
|
-
p50: quantity(quantile(values, .5, "nearest-rank"), "ms"),
|
|
160
|
-
p99: quantity(quantile(values, .99, "nearest-rank"), "ms"),
|
|
161
|
-
max: quantity(values.reduce((most, value) => Math.max(most, value), 0), "ms")
|
|
162
|
-
};
|
|
163
|
-
/** This time is the date of the record of a band and the date of its verdict. The record has no age, because it comes from this run. */
|
|
164
|
-
const NOW = "2026-01-01T00:00:00.000Z";
|
|
165
|
-
/**
|
|
166
|
-
* This function judges one band of the latency over the pooled arrivals of the counted runs. The
|
|
167
|
-
* top of the band reads the interval of rigor-bench: the band holds only if the interval is under its top.
|
|
168
|
-
* The latencies of one run can follow each other, thus the width of the interval is an estimate.
|
|
169
|
-
* The bottom of the band reads the quantile itself. It gives the text of the verdict, and if it holds.
|
|
170
|
-
*/
|
|
171
|
-
const bandVerdict = (band, values, censored) => {
|
|
172
|
-
const high = valueIn(band.high, "ms");
|
|
173
|
-
const rung = {
|
|
174
|
-
name: "band",
|
|
175
|
-
at: {},
|
|
176
|
-
budgets: [{
|
|
177
|
-
kind: "quantile",
|
|
178
|
-
measure: "latency",
|
|
179
|
-
unit: "ms",
|
|
180
|
-
quantile: band.quantile,
|
|
181
|
-
limit: high
|
|
182
|
-
}],
|
|
183
|
-
test: "the cell"
|
|
184
|
-
};
|
|
185
|
-
const top = rungVerdict(rung, {
|
|
186
|
-
rung: "band",
|
|
187
|
-
commit: "the cell",
|
|
188
|
-
at: NOW,
|
|
189
|
-
real: ["the counted runs"],
|
|
190
|
-
synthetic: [],
|
|
191
|
-
evidence: [{
|
|
192
|
-
kind: "quantile",
|
|
193
|
-
measure: "latency",
|
|
194
|
-
values,
|
|
195
|
-
censored
|
|
196
|
-
}]
|
|
197
|
-
}, { now: NOW });
|
|
198
|
-
const read = values.length + censored.length === 0 ? null : quantile([...values, ...censored], band.quantile, "nearest-rank");
|
|
199
|
-
const low = band.low === void 0 ? null : valueIn(band.low, "ms");
|
|
200
|
-
const above = low === null || read !== null && read >= low;
|
|
201
|
-
const place = low === null ? `under ${high} ms` : `in [${low}, ${high}] ms`;
|
|
202
|
-
const outcome = top.outcome === "within" && !above ? "under the bottom of the band" : top.outcome;
|
|
203
|
-
return {
|
|
204
|
-
holds: top.outcome === "within" && above,
|
|
205
|
-
words: `p${band.quantile * 100} of the latency ${read === null ? "has no value" : `is ${read} ms`}, wanted ${place}: ${outcome}. ${top.reason}`
|
|
206
|
-
};
|
|
207
|
-
};
|
|
208
|
-
/**
|
|
209
|
-
* This function judges the share of failed arrivals over the counted runs against a limit. Each
|
|
210
|
-
* planned arrival is a trial. An arrival fails if the client did not send it. It also fails with no
|
|
211
|
-
* reply at the end of its run, or with the status of a failure. The rate budget of rigor-bench
|
|
212
|
-
* reads the upper end of the Wilson interval at 0.95. Thus 381 arrivals with no failure hold a limit
|
|
213
|
-
* of 1 %, and fewer arrivals cannot decide.
|
|
214
|
-
*/
|
|
215
|
-
const failuresVerdict = (limit, failures, trials) => {
|
|
216
|
-
const verdict = rungVerdict({
|
|
217
|
-
name: "failures",
|
|
218
|
-
at: {},
|
|
219
|
-
budgets: [{
|
|
220
|
-
kind: "rate",
|
|
221
|
-
measure: "failures",
|
|
222
|
-
limit
|
|
223
|
-
}],
|
|
224
|
-
test: "the cell"
|
|
225
|
-
}, {
|
|
226
|
-
rung: "failures",
|
|
227
|
-
commit: "the cell",
|
|
228
|
-
at: NOW,
|
|
229
|
-
real: ["the counted runs"],
|
|
230
|
-
synthetic: [],
|
|
231
|
-
evidence: [{
|
|
232
|
-
kind: "rate",
|
|
233
|
-
measure: "failures",
|
|
234
|
-
failures,
|
|
235
|
-
trials
|
|
236
|
-
}]
|
|
237
|
-
}, { now: NOW });
|
|
238
|
-
return {
|
|
239
|
-
holds: verdict.outcome === "within",
|
|
240
|
-
words: `${failures} of ${trials} arrivals failed, wanted a share under ${limit * 100} %: ${verdict.outcome}. ${verdict.reason}`
|
|
241
|
-
};
|
|
242
|
-
};
|
|
243
|
-
/**
|
|
244
|
-
* This function judges the load of an open-loop cell over its counted runs. A run that did not keep
|
|
245
|
-
* its schedule measures its driver, not the target, thus it is a finding of that run. Each
|
|
246
|
-
* band reads all the arrivals of the counted runs.
|
|
247
|
-
*/
|
|
248
|
-
const loadVerdict = (prediction, runs) => {
|
|
249
|
-
const limit = valueIn(prediction.lag, "ms");
|
|
250
|
-
const outside = runs.flatMap((run) => {
|
|
251
|
-
if (run.load === void 0) return [{
|
|
252
|
-
run: run.name,
|
|
253
|
-
why: "the client never started its schedule"
|
|
254
|
-
}];
|
|
255
|
-
const check = scheduleHeld(run.load, limit);
|
|
256
|
-
return check.held ? [] : [{
|
|
257
|
-
run: run.name,
|
|
258
|
-
why: check.reason
|
|
259
|
-
}];
|
|
260
|
-
});
|
|
261
|
-
const measures = runs.flatMap((run) => run.load === void 0 ? [] : [run.load]);
|
|
262
|
-
const latency = measures.flatMap((measure) => measure.latency);
|
|
263
|
-
const censored = measures.flatMap((measure) => measure.censored);
|
|
264
|
-
const bands = prediction.bands.map((band) => bandVerdict(band, latency, censored));
|
|
265
|
-
const total = (count) => measures.reduce((sum, measure) => sum + count(measure), 0);
|
|
266
|
-
const planned = total((measure) => measure.planned);
|
|
267
|
-
const unsent = total((measure) => measure.unsent);
|
|
268
|
-
const unfinished = total((measure) => measure.unfinished);
|
|
269
|
-
const failed = total((measure) => measure.failed ?? 0);
|
|
270
|
-
const failures = prediction.failures === void 0 ? void 0 : failuresVerdict(prediction.failures, unsent + unfinished + failed, planned);
|
|
271
|
-
return {
|
|
272
|
-
holds: runs.length > 0 && outside.length === 0 && bands.every((band) => band.holds) && (failures?.holds ?? true),
|
|
273
|
-
outside,
|
|
274
|
-
load: {
|
|
275
|
-
planned,
|
|
276
|
-
unsent,
|
|
277
|
-
unfinished,
|
|
278
|
-
failed,
|
|
279
|
-
latency: spreadOf$1([...latency, ...censored]),
|
|
280
|
-
service: spreadOf$1(measures.flatMap((measure) => measure.service)),
|
|
281
|
-
lag: spreadOf$1(measures.flatMap((measure) => measure.lag.map((lag) => Math.abs(lag)))),
|
|
282
|
-
bands: bands.map((band) => band.words),
|
|
283
|
-
...failures === void 0 ? {} : { failures: failures.words }
|
|
284
|
-
}
|
|
285
|
-
};
|
|
286
|
-
};
|
|
287
|
-
/** This function gives the estimate verdict of the counted runs, or undefined when no run has an estimate. */
|
|
288
|
-
const estimateVerdict = (estimates) => {
|
|
289
|
-
const runs = estimates.filter((estimate) => estimate !== void 0);
|
|
290
|
-
if (runs.length === 0) return void 0;
|
|
291
|
-
const pool = poolOf(runs);
|
|
292
|
-
const total = (count) => runs.reduce((sum, estimate) => sum + count(estimate), 0);
|
|
293
|
-
const hidden = total((estimate) => estimate.hidden);
|
|
294
|
-
const driverGaps = total((estimate) => estimate.driverGaps);
|
|
295
|
-
const driverGapTotal = total((estimate) => estimate.driverGapTotal);
|
|
296
|
-
const latency = spreadOf$1([...pool.latency, ...pool.censored]);
|
|
297
|
-
const seconds = (time) => (valueIn(time, "ms") / 1e3).toFixed(3);
|
|
298
|
-
const spread = latency === null ? "no latency" : `median ${seconds(latency.p50)} s, p99 ${seconds(latency.p99)} s, slowest ${seconds(latency.max)} s`;
|
|
299
|
-
const gaps = driverGaps === 0 ? "no pause of the client" : `${driverGaps} pauses of the client, ${Math.round(driverGapTotal)} ms in all`;
|
|
300
|
-
return {
|
|
301
|
-
planned: pool.planned,
|
|
302
|
-
hidden,
|
|
303
|
-
driverGaps,
|
|
304
|
-
driverGapTotal: quantity(driverGapTotal, "ms"),
|
|
305
|
-
latency,
|
|
306
|
-
words: `The estimate of the open loop puts back ${hidden} hidden sends, with ${gaps}: ${spread}.`
|
|
307
|
-
};
|
|
308
|
-
};
|
|
309
14
|
// src/verdict.ts
|
|
310
15
|
/** This function gives the words of the outcome of a second request: its connection, a retry, and its end. */
|
|
311
16
|
const requestWords = (outcome) => `${outcome.connection}${outcome.retried ? ", a retry" : ""}, ${outcome.pending === true ? "pending" : outcome.error ?? "a reply"}`;
|
|
@@ -1155,11 +860,11 @@ const fieldOf = (line, path) => path.split(".").reduce((value, key) => value !==
|
|
|
1155
860
|
/** This function tells if a line of the client matches a line match: its `ev`, and each field that the match names. */
|
|
1156
861
|
const matches = (line, match) => line.ev === match.ev && Object.entries(match.where ?? {}).every(([path, value]) => fieldOf(line, path) === value);
|
|
1157
862
|
/** This function gives the count of the lines that match. */
|
|
1158
|
-
const countOf$
|
|
863
|
+
const countOf$1 = (lines, match) => lines.filter((line) => matches(line, match)).length;
|
|
1159
864
|
/** This function gives the finding of the line counts of a run, or null when each count is the exact one. */
|
|
1160
865
|
const countFinding = (counts, lines) => {
|
|
1161
866
|
const off = counts.flatMap((each) => {
|
|
1162
|
-
const seen = countOf$
|
|
867
|
+
const seen = countOf$1(lines, each.match);
|
|
1163
868
|
return seen === each.count ? [] : [`${each.what}: ${seen} lines, and the law gives ${each.count}`];
|
|
1164
869
|
});
|
|
1165
870
|
return off.length === 0 ? null : off.join("; ");
|
|
@@ -2066,7 +1771,7 @@ const numberOr = (line, field) => {
|
|
|
2066
1771
|
};
|
|
2067
1772
|
/** This function gives one field of an object of a line, or undefined. */
|
|
2068
1773
|
const fieldOf$1 = (value, field) => typeof value === "object" && value !== null ? value[field] : void 0;
|
|
2069
|
-
const countOf
|
|
1774
|
+
const countOf = (value, field) => {
|
|
2070
1775
|
const count = fieldOf$1(value, field);
|
|
2071
1776
|
return typeof count === "number" ? count : null;
|
|
2072
1777
|
};
|
|
@@ -2147,7 +1852,7 @@ const measureEgress = (run, expected) => {
|
|
|
2147
1852
|
};
|
|
2148
1853
|
});
|
|
2149
1854
|
const stats = events.find((event) => event.ev === "stats");
|
|
2150
|
-
const rise = (field) => (countOf
|
|
1855
|
+
const rise = (field) => (countOf(stats?.["after"], field) ?? 0) - (countOf(stats?.["before"], field) ?? 0);
|
|
2151
1856
|
const egress = {
|
|
2152
1857
|
kind,
|
|
2153
1858
|
packets,
|
|
@@ -3819,337 +3524,6 @@ const measureSocket = (cell, run) => {
|
|
|
3819
3524
|
finding
|
|
3820
3525
|
};
|
|
3821
3526
|
};
|
|
3822
|
-
// src/resources.ts
|
|
3823
|
-
/**
|
|
3824
|
-
* The resources that one container of a lab used. A reader in a sidecar reads the files of the
|
|
3825
|
-
* cgroup of the container and the devices of its network namespace (`RESOURCES_PROGRAM`). It
|
|
3826
|
-
* writes the text of each file in one JSON line, with a stamp on CLOCK_MONOTONIC. This module reads
|
|
3827
|
-
* each file from that line, and it gives the change between two readings.
|
|
3828
|
-
*
|
|
3829
|
-
* A file that the reader cannot read gives null: no read. It does not give a zero.
|
|
3830
|
-
*/
|
|
3831
|
-
/** This name is the event of a line of the reader. */
|
|
3832
|
-
const RESOURCES_EVENT = "resources";
|
|
3833
|
-
/** This path is the reader of the resources, in the image of the harness. */
|
|
3834
|
-
const RESOURCES_PROGRAM = "/opt/harness/resources";
|
|
3835
|
-
/** This count is the smallest CPU limit that Docker takes, in CPUs. */
|
|
3836
|
-
const LEAST_CPUS = .01;
|
|
3837
|
-
/** This amount is the smallest memory limit that Docker takes, in bytes: 6 MiB. */
|
|
3838
|
-
const LEAST_MEMORY = 6291456;
|
|
3839
|
-
/** This function gives the bytes of a memory limit, or null for an amount that is not a count of bytes. */
|
|
3840
|
-
const bytesOf = (memory) => {
|
|
3841
|
-
try {
|
|
3842
|
-
const bytes = Math.round(valueIn(memory, "B"));
|
|
3843
|
-
return Number.isSafeInteger(bytes) ? bytes : null;
|
|
3844
|
-
} catch {
|
|
3845
|
-
return null;
|
|
3846
|
-
}
|
|
3847
|
-
};
|
|
3848
|
-
/** This function tells that a text is a list of CPUs, as `cpuset.cpus` takes it: `0`, `2-3` or `0,2`. */
|
|
3849
|
-
const isCpuList = (text) => /^\d+(-\d+)?(,\d+(-\d+)?)*$/.test(text) && text.split(",").every((range) => {
|
|
3850
|
-
const [first, last] = range.split("-").map(Number);
|
|
3851
|
-
return last === void 0 || first <= last;
|
|
3852
|
-
});
|
|
3853
|
-
/** This function gives the problems of the limits of a container, each as a sentence. Limits with no problem give an empty list. */
|
|
3854
|
-
const limitsProblems = (limits) => {
|
|
3855
|
-
const problems = [];
|
|
3856
|
-
const { cpus, cpuset, memory } = limits;
|
|
3857
|
-
if (cpus !== void 0 && !(Number.isFinite(cpus) && cpus >= LEAST_CPUS)) problems.push(`cpus is ${cpus}: Docker takes ${LEAST_CPUS} CPUs or more`);
|
|
3858
|
-
if (cpuset !== void 0 && !isCpuList(cpuset)) problems.push(`cpuset is "${cpuset}": write a list of CPUs, for example 0, 2-3 or 0,2`);
|
|
3859
|
-
if (memory !== void 0) {
|
|
3860
|
-
const bytes = bytesOf(memory);
|
|
3861
|
-
if (bytes === null) problems.push(`memory is ${memory.value} ${memory.unit}: write an amount of data, for example 512 MiB`);
|
|
3862
|
-
else if (bytes < LEAST_MEMORY) problems.push(`memory is ${bytes} B: Docker takes 6 MiB or more`);
|
|
3863
|
-
}
|
|
3864
|
-
return problems;
|
|
3865
|
-
};
|
|
3866
|
-
/**
|
|
3867
|
-
* This function gives the limits of a container as Docker takes them: the CPU quota, the CPUs and
|
|
3868
|
-
* the memory, with no swap. It throws for limits that have a problem (`limitsProblems`).
|
|
3869
|
-
*/
|
|
3870
|
-
const hostLimitsOf = (limits) => {
|
|
3871
|
-
const problems = limitsProblems(limits);
|
|
3872
|
-
if (problems.length > 0) throw new RangeError(`the limits of a container: ${problems.join("; ")}`);
|
|
3873
|
-
const bytes = limits.memory === void 0 ? null : bytesOf(limits.memory);
|
|
3874
|
-
return {
|
|
3875
|
-
...limits.cpus === void 0 ? {} : { NanoCpus: Math.round(limits.cpus * 1e9) },
|
|
3876
|
-
...limits.cpuset === void 0 ? {} : { CpusetCpus: limits.cpuset },
|
|
3877
|
-
...bytes === null ? {} : {
|
|
3878
|
-
Memory: bytes,
|
|
3879
|
-
MemorySwap: bytes
|
|
3880
|
-
}
|
|
3881
|
-
};
|
|
3882
|
-
};
|
|
3883
|
-
/**
|
|
3884
|
-
* This function gives the argv of the reader: one reading, or a series with a period. Each folder
|
|
3885
|
-
* is a place where the cgroup of the container can be. The reader takes the first one that is there.
|
|
3886
|
-
*/
|
|
3887
|
-
const resourceArgs = (dirs, period) => {
|
|
3888
|
-
if (period === void 0) return [
|
|
3889
|
-
RESOURCES_PROGRAM,
|
|
3890
|
-
"read",
|
|
3891
|
-
...dirs
|
|
3892
|
-
];
|
|
3893
|
-
const ms = Math.round(valueIn(period, "ms"));
|
|
3894
|
-
if (!(ms >= 1)) throw new RangeError(`resourceArgs: the period of a series is ${ms} ms, and the reader takes 1 ms or more`);
|
|
3895
|
-
return [
|
|
3896
|
-
RESOURCES_PROGRAM,
|
|
3897
|
-
"watch",
|
|
3898
|
-
"--period-ms",
|
|
3899
|
-
String(ms),
|
|
3900
|
-
...dirs
|
|
3901
|
-
];
|
|
3902
|
-
};
|
|
3903
|
-
/** This function gives a count from its digits, or null for another text and for a count that a number cannot hold. */
|
|
3904
|
-
const countOf = (text) => {
|
|
3905
|
-
if (text === void 0 || !/^\d+$/.test(text)) return null;
|
|
3906
|
-
const count = Number(text);
|
|
3907
|
-
return Number.isSafeInteger(count) ? count : null;
|
|
3908
|
-
};
|
|
3909
|
-
/** This function gives the count of a file of a cgroup that holds one count, as `memory.current` does. Another text gives null. */
|
|
3910
|
-
const cgroupNumber = (text) => countOf(text.trim());
|
|
3911
|
-
/** This function gives a limit of a cgroup, as `memory.max` prints it: its count, or `max` for no limit. Another text gives null. */
|
|
3912
|
-
const cgroupLimit = (text) => text.trim() === "max" ? "max" : cgroupNumber(text);
|
|
3913
|
-
/**
|
|
3914
|
-
* This function gives the counts of a flat keyed file of a cgroup: one key and one count on each
|
|
3915
|
-
* line. `cpu.stat` and `memory.stat` are such files. It skips each other line.
|
|
3916
|
-
*/
|
|
3917
|
-
const cgroupKeyed = (text) => Object.fromEntries(text.split("\n").flatMap((line) => {
|
|
3918
|
-
const parts = line.trim().split(/\s+/);
|
|
3919
|
-
const count = parts.length === 2 ? countOf(parts[1]) : null;
|
|
3920
|
-
return count === null ? [] : [[parts[0], count]];
|
|
3921
|
-
}));
|
|
3922
|
-
/** This function gives one count of a flat keyed file, or null for a key that the file does not have. */
|
|
3923
|
-
const keyOf = (counts, key) => Object.hasOwn(counts, key) ? counts[key] : null;
|
|
3924
|
-
/** This function reads `cpu.stat`. It gives null for a text with no usage. */
|
|
3925
|
-
const cpuStatOf = (text) => {
|
|
3926
|
-
const counts = cgroupKeyed(text);
|
|
3927
|
-
const [usage, user, system] = [
|
|
3928
|
-
keyOf(counts, "usage_usec"),
|
|
3929
|
-
keyOf(counts, "user_usec"),
|
|
3930
|
-
keyOf(counts, "system_usec")
|
|
3931
|
-
];
|
|
3932
|
-
if (usage === null || user === null || system === null) return null;
|
|
3933
|
-
return {
|
|
3934
|
-
usage,
|
|
3935
|
-
user,
|
|
3936
|
-
system,
|
|
3937
|
-
periods: keyOf(counts, "nr_periods"),
|
|
3938
|
-
throttled: keyOf(counts, "nr_throttled"),
|
|
3939
|
-
throttledTime: keyOf(counts, "throttled_usec")
|
|
3940
|
-
};
|
|
3941
|
-
};
|
|
3942
|
-
/** This function reads `memory.stat`: the amounts of `anon`, `file`, `kernel` and `sock`, each null without its key. */
|
|
3943
|
-
const memoryStatOf = (text) => {
|
|
3944
|
-
const counts = cgroupKeyed(text);
|
|
3945
|
-
const [stack, slab] = [keyOf(counts, "kernel_stack"), keyOf(counts, "slab")];
|
|
3946
|
-
return {
|
|
3947
|
-
anon: keyOf(counts, "anon"),
|
|
3948
|
-
file: keyOf(counts, "file"),
|
|
3949
|
-
kernel: keyOf(counts, "kernel") ?? (stack === null || slab === null ? null : stack + slab),
|
|
3950
|
-
sock: keyOf(counts, "sock")
|
|
3951
|
-
};
|
|
3952
|
-
};
|
|
3953
|
-
/** This function reads `cpu.max`: the quota and the period, as `50000 100000` or `max 100000`. Another text gives null. */
|
|
3954
|
-
const cpuMaxOf = (text) => {
|
|
3955
|
-
const parts = text.trim().split(/\s+/);
|
|
3956
|
-
const quota = parts[0] === "max" ? "max" : countOf(parts[0]);
|
|
3957
|
-
const period = countOf(parts[1]);
|
|
3958
|
-
return parts.length !== 2 || quota === null || period === null ? null : {
|
|
3959
|
-
quota,
|
|
3960
|
-
period
|
|
3961
|
-
};
|
|
3962
|
-
};
|
|
3963
|
-
const NO_TRAFFIC = {
|
|
3964
|
-
bytes: 0,
|
|
3965
|
-
packets: 0
|
|
3966
|
-
};
|
|
3967
|
-
const sumOf = (devices, side) => devices.reduce((sum, device) => ({
|
|
3968
|
-
bytes: sum.bytes + device[side].bytes,
|
|
3969
|
-
packets: sum.packets + device[side].packets
|
|
3970
|
-
}), NO_TRAFFIC);
|
|
3971
|
-
/** This function gives the network of some devices: the devices in the order of their names, and their sums. */
|
|
3972
|
-
const networkWith = (devices) => {
|
|
3973
|
-
const sorted = [...devices].sort((one, other) => one.name < other.name ? -1 : one.name > other.name ? 1 : 0);
|
|
3974
|
-
return {
|
|
3975
|
-
devices: sorted,
|
|
3976
|
-
rx: sumOf(sorted, "rx"),
|
|
3977
|
-
tx: sumOf(sorted, "tx")
|
|
3978
|
-
};
|
|
3979
|
-
};
|
|
3980
|
-
/**
|
|
3981
|
-
* This function reads `/proc/net/dev`: the bytes and the packets of each device, without `lo`. It
|
|
3982
|
-
* gives null for a text that is not that file, and for a line of a device that it cannot read.
|
|
3983
|
-
*/
|
|
3984
|
-
const networkOf = (text) => {
|
|
3985
|
-
if (!text.includes("|bytes")) return null;
|
|
3986
|
-
const devices = [];
|
|
3987
|
-
for (const line of text.split("\n")) {
|
|
3988
|
-
const colon = line.lastIndexOf(":");
|
|
3989
|
-
if (colon < 0) continue;
|
|
3990
|
-
const name = line.slice(0, colon).trim();
|
|
3991
|
-
const counts = line.slice(colon + 1).trim().split(/\s+/).map(countOf);
|
|
3992
|
-
if (name === "" || counts.length < 16 || counts.includes(null)) return null;
|
|
3993
|
-
if (name === "lo") continue;
|
|
3994
|
-
devices.push({
|
|
3995
|
-
name,
|
|
3996
|
-
rx: {
|
|
3997
|
-
bytes: counts[0],
|
|
3998
|
-
packets: counts[1]
|
|
3999
|
-
},
|
|
4000
|
-
tx: {
|
|
4001
|
-
bytes: counts[8],
|
|
4002
|
-
packets: counts[9]
|
|
4003
|
-
}
|
|
4004
|
-
});
|
|
4005
|
-
}
|
|
4006
|
-
return networkWith(devices);
|
|
4007
|
-
};
|
|
4008
|
-
/** This function gives the text of one file of a line of the reader, or null for no read. */
|
|
4009
|
-
const textOf$1 = (files, name) => {
|
|
4010
|
-
if (typeof files !== "object" || files === null || !Object.hasOwn(files, name)) return null;
|
|
4011
|
-
const text = files[name];
|
|
4012
|
-
return typeof text === "string" ? text : null;
|
|
4013
|
-
};
|
|
4014
|
-
/** This function reads a text with `read`, and gives null for no text. */
|
|
4015
|
-
const readWith = (text, read) => text === null ? null : read(text);
|
|
4016
|
-
/**
|
|
4017
|
-
* This function gives the reading of one line of the reader (`RESOURCES_EVENT`). It gives null for
|
|
4018
|
-
* another line, and for a line with no stamps.
|
|
4019
|
-
*/
|
|
4020
|
-
const resourceReadingOf = (line) => {
|
|
4021
|
-
const { t, t1, cgroup, files, net } = line;
|
|
4022
|
-
if (line.ev !== "resources" || typeof t !== "number" || typeof t1 !== "number" || typeof cgroup !== "string") return null;
|
|
4023
|
-
const file = (name) => textOf$1(files, name);
|
|
4024
|
-
const stat = readWith(file("memory.stat"), memoryStatOf) ?? {
|
|
4025
|
-
anon: null,
|
|
4026
|
-
file: null,
|
|
4027
|
-
kernel: null,
|
|
4028
|
-
sock: null
|
|
4029
|
-
};
|
|
4030
|
-
const cpuset = file("cpuset.cpus.effective")?.trim();
|
|
4031
|
-
return {
|
|
4032
|
-
t0: t,
|
|
4033
|
-
t1,
|
|
4034
|
-
cgroup,
|
|
4035
|
-
cpu: readWith(file("cpu.stat"), cpuStatOf),
|
|
4036
|
-
memory: {
|
|
4037
|
-
current: readWith(file("memory.current"), cgroupNumber),
|
|
4038
|
-
peak: readWith(file("memory.peak"), cgroupNumber),
|
|
4039
|
-
...stat,
|
|
4040
|
-
events: readWith(file("memory.events"), cgroupKeyed)
|
|
4041
|
-
},
|
|
4042
|
-
pids: readWith(file("pids.current"), cgroupNumber),
|
|
4043
|
-
network: typeof net === "string" ? networkOf(net) : null,
|
|
4044
|
-
limits: {
|
|
4045
|
-
cpu: readWith(file("cpu.max"), cpuMaxOf),
|
|
4046
|
-
memory: readWith(file("memory.max"), cgroupLimit),
|
|
4047
|
-
cpuset: cpuset === void 0 || cpuset === "" ? null : cpuset
|
|
4048
|
-
}
|
|
4049
|
-
};
|
|
4050
|
-
};
|
|
4051
|
-
/**
|
|
4052
|
-
* This function gives the reading of the output of one read of the reader. It throws for a text
|
|
4053
|
-
* that is not a line of a reading.
|
|
4054
|
-
*/
|
|
4055
|
-
const resourceReadingIn = (output) => {
|
|
4056
|
-
let line = null;
|
|
4057
|
-
try {
|
|
4058
|
-
line = JSON.parse(output);
|
|
4059
|
-
} catch {}
|
|
4060
|
-
const reading = typeof line === "object" && line !== null && typeof line.ev === "string" ? resourceReadingOf(line) : null;
|
|
4061
|
-
if (reading === null) throw new Error(`the reader of the resources gave no reading: ${output.slice(0, 200)}`);
|
|
4062
|
-
return reading;
|
|
4063
|
-
};
|
|
4064
|
-
/** This function gives a time from its microseconds. */
|
|
4065
|
-
const fromMicroseconds = (time) => quantity(time / 1e6, "s");
|
|
4066
|
-
/**
|
|
4067
|
-
* This function gives what a container used between two readings. It gives its CPU time, the time
|
|
4068
|
-
* that its CPU limit stopped it, the traffic of each device, and its last memory. A counter that
|
|
4069
|
-
* went down is in `resets`, and its part is null. It throws when the second reading is the earlier one.
|
|
4070
|
-
*/
|
|
4071
|
-
const resourceChange = (before, after) => {
|
|
4072
|
-
if (after.t0 < before.t0) throw new RangeError(`resourceChange: the second reading is ${before.t0 - after.t0} ns before the first`);
|
|
4073
|
-
const resets = [];
|
|
4074
|
-
/** This function gives the rise of a counter. It gives null for a counter that went down, and names it. */
|
|
4075
|
-
const rise = (name, from, to) => {
|
|
4076
|
-
if (to >= from) return to - from;
|
|
4077
|
-
resets.push(name);
|
|
4078
|
-
return null;
|
|
4079
|
-
};
|
|
4080
|
-
/** This function gives the rise of a counter that can have no read. */
|
|
4081
|
-
const riseOf = (name, from, to) => from === null || to === null ? null : rise(name, from, to);
|
|
4082
|
-
const same = before.cgroup === after.cgroup;
|
|
4083
|
-
if (!same) resets.push("cgroup");
|
|
4084
|
-
const cpu = (() => {
|
|
4085
|
-
if (!same || before.cpu === null || after.cpu === null) return null;
|
|
4086
|
-
const [total, user, system] = [
|
|
4087
|
-
rise("cpu.usage", before.cpu.usage, after.cpu.usage),
|
|
4088
|
-
rise("cpu.user", before.cpu.user, after.cpu.user),
|
|
4089
|
-
rise("cpu.system", before.cpu.system, after.cpu.system)
|
|
4090
|
-
];
|
|
4091
|
-
const periods = riseOf("cpu.periods", before.cpu.periods, after.cpu.periods);
|
|
4092
|
-
const throttledPeriods = riseOf("cpu.throttled", before.cpu.throttled, after.cpu.throttled);
|
|
4093
|
-
const throttled = riseOf("cpu.throttledTime", before.cpu.throttledTime, after.cpu.throttledTime);
|
|
4094
|
-
if (total === null || user === null || system === null) return null;
|
|
4095
|
-
return {
|
|
4096
|
-
total: fromMicroseconds(total),
|
|
4097
|
-
user: fromMicroseconds(user),
|
|
4098
|
-
system: fromMicroseconds(system),
|
|
4099
|
-
throttled: throttled === null ? null : fromMicroseconds(throttled),
|
|
4100
|
-
periods,
|
|
4101
|
-
throttledPeriods
|
|
4102
|
-
};
|
|
4103
|
-
})();
|
|
4104
|
-
const network = (() => {
|
|
4105
|
-
if (before.network === null || after.network === null) return null;
|
|
4106
|
-
const earlier = new Map(before.network.devices.map((device) => [device.name, device]));
|
|
4107
|
-
const devices = [];
|
|
4108
|
-
let whole = true;
|
|
4109
|
-
for (const device of after.network.devices) {
|
|
4110
|
-
const from = earlier.get(device.name) ?? {
|
|
4111
|
-
name: device.name,
|
|
4112
|
-
rx: NO_TRAFFIC,
|
|
4113
|
-
tx: NO_TRAFFIC
|
|
4114
|
-
};
|
|
4115
|
-
earlier.delete(device.name);
|
|
4116
|
-
const each = ["rx", "tx"].map((side) => ({
|
|
4117
|
-
bytes: rise(`network.${device.name}.${side}.bytes`, from[side].bytes, device[side].bytes),
|
|
4118
|
-
packets: rise(`network.${device.name}.${side}.packets`, from[side].packets, device[side].packets)
|
|
4119
|
-
}));
|
|
4120
|
-
const [rx, tx] = [each[0], each[1]];
|
|
4121
|
-
if (rx.bytes === null || rx.packets === null || tx.bytes === null || tx.packets === null) whole = false;
|
|
4122
|
-
else devices.push({
|
|
4123
|
-
name: device.name,
|
|
4124
|
-
rx: {
|
|
4125
|
-
bytes: rx.bytes,
|
|
4126
|
-
packets: rx.packets
|
|
4127
|
-
},
|
|
4128
|
-
tx: {
|
|
4129
|
-
bytes: tx.bytes,
|
|
4130
|
-
packets: tx.packets
|
|
4131
|
-
}
|
|
4132
|
-
});
|
|
4133
|
-
}
|
|
4134
|
-
for (const name of earlier.keys()) {
|
|
4135
|
-
resets.push(`network.${name}`);
|
|
4136
|
-
whole = false;
|
|
4137
|
-
}
|
|
4138
|
-
return whole ? networkWith(devices) : null;
|
|
4139
|
-
})();
|
|
4140
|
-
const [peakBefore, peakAfter] = [before.memory.peak, after.memory.peak];
|
|
4141
|
-
return {
|
|
4142
|
-
elapsed: quantity((after.t0 - before.t0) / 1e9, "s"),
|
|
4143
|
-
cpu,
|
|
4144
|
-
memory: {
|
|
4145
|
-
last: after.memory.current,
|
|
4146
|
-
peak: peakAfter,
|
|
4147
|
-
peakBetween: !same || peakBefore === null || peakAfter === null ? null : peakAfter > peakBefore
|
|
4148
|
-
},
|
|
4149
|
-
network,
|
|
4150
|
-
resets
|
|
4151
|
-
};
|
|
4152
|
-
};
|
|
4153
3527
|
// src/fabric.ts
|
|
4154
3528
|
/**
|
|
4155
3529
|
* A fabric is a routed network between the client and the target, on layer E3 (docs/S7.md). Four
|
|
@@ -9694,7 +9068,7 @@ const LINES_MS = 5e3;
|
|
|
9694
9068
|
*/
|
|
9695
9069
|
const linesCounted = async (lab, from, counts) => {
|
|
9696
9070
|
const started = Date.now();
|
|
9697
|
-
const short = () => counts.some((each) => countOf$
|
|
9071
|
+
const short = () => counts.some((each) => countOf$1(lab.server.slice(from), each.match) < each.count);
|
|
9698
9072
|
while (short() && Date.now() - started < LINES_MS) await setTimeout$1(20);
|
|
9699
9073
|
await setTimeout$1(250);
|
|
9700
9074
|
};
|
|
@@ -9735,7 +9109,7 @@ const once = async (lab, cell, environment, index, dry = false) => {
|
|
|
9735
9109
|
content: load.content,
|
|
9736
9110
|
target: LOAD_PATH
|
|
9737
9111
|
}]];
|
|
9738
|
-
const probe = await lab.probe(probeArgs(cell, lab), files.length === 0 ? void 0 : files, cell.cgroup);
|
|
9112
|
+
const probe = await lab.probe(probeArgs(cell, lab), files.length === 0 ? void 0 : files, cell.cgroup, cell.clientLimits);
|
|
9739
9113
|
const server = cell.observer === "server";
|
|
9740
9114
|
const peer = server ? {
|
|
9741
9115
|
freeze: () => probe.freeze(),
|
|
@@ -9773,8 +9147,15 @@ const once = async (lab, cell, environment, index, dry = false) => {
|
|
|
9773
9147
|
let heal = null;
|
|
9774
9148
|
const signalled = !server && cell.target.program !== void 0;
|
|
9775
9149
|
let thawing = null;
|
|
9150
|
+
let reader;
|
|
9151
|
+
let start;
|
|
9152
|
+
let end;
|
|
9776
9153
|
try {
|
|
9777
9154
|
await probe.until(["ready"], 15e3);
|
|
9155
|
+
if (cell.resources !== void 0) {
|
|
9156
|
+
reader = await lab.resources(cell.resources);
|
|
9157
|
+
start = await reader.read();
|
|
9158
|
+
}
|
|
9778
9159
|
if (dry) {
|
|
9779
9160
|
if (cell.probe.mode !== "idle") await go();
|
|
9780
9161
|
await setTimeout$1(500);
|
|
@@ -9942,12 +9323,7 @@ const once = async (lab, cell, environment, index, dry = false) => {
|
|
|
9942
9323
|
};
|
|
9943
9324
|
} else if (prediction.detects === null) {
|
|
9944
9325
|
const window = valueIn(prediction.window, "s") * 1e3;
|
|
9945
|
-
await probe.until(
|
|
9946
|
-
"done",
|
|
9947
|
-
"error",
|
|
9948
|
-
"eof",
|
|
9949
|
-
"deadline"
|
|
9950
|
-
], window).catch(() => void 0);
|
|
9326
|
+
await probe.until(loadEnds(cell.probe.streams), window).catch(() => void 0);
|
|
9951
9327
|
} else if (prediction.detects) {
|
|
9952
9328
|
const within = latestEndOf(prediction) * 2e3 + 1e4;
|
|
9953
9329
|
if (cell.observer !== void 0 && cell.observer !== "client") await observerError(cell, partial, within, () => lab.server.slice(serverFrom).some((line) => line.ev === "drop"));
|
|
@@ -9983,8 +9359,10 @@ const once = async (lab, cell, environment, index, dry = false) => {
|
|
|
9983
9359
|
await setTimeout$1(TAIL_MS);
|
|
9984
9360
|
}
|
|
9985
9361
|
}
|
|
9362
|
+
if (reader !== void 0) end = await reader.read();
|
|
9986
9363
|
} finally {
|
|
9987
9364
|
await probe.stop();
|
|
9365
|
+
await reader?.stop();
|
|
9988
9366
|
}
|
|
9989
9367
|
const settled = await lab.settle();
|
|
9990
9368
|
const lost = settled === null ? null : settled - lostBefore;
|
|
@@ -10007,6 +9385,11 @@ const once = async (lab, cell, environment, index, dry = false) => {
|
|
|
10007
9385
|
before: sessions,
|
|
10008
9386
|
after: await lab.fabric.sessions()
|
|
10009
9387
|
}
|
|
9388
|
+
} },
|
|
9389
|
+
...reader === void 0 || start === void 0 || end === void 0 ? {} : { resources: {
|
|
9390
|
+
start,
|
|
9391
|
+
end,
|
|
9392
|
+
series: [...reader.series]
|
|
10010
9393
|
} }
|
|
10011
9394
|
};
|
|
10012
9395
|
};
|
|
@@ -10292,6 +9675,6 @@ const runCell = async (cell, say = () => {}) => {
|
|
|
10292
9675
|
target = larger;
|
|
10293
9676
|
}
|
|
10294
9677
|
};
|
|
10295
|
-
export { AWS_FROM, CLIENT_CAPABILITIES, CLIENT_NAMES, CLOSED_TOLERANCE, CLOUDS, CLUSTER_STAGES, CONVERGE_MS, DAEMONS, DEBUG, DIRTY, DISK_MOUNT, DISK_RECORD_FORMAT, DISK_ROOT, DISK_SUBJECT, DROP_HANDLING, FABRIC_CLIENT, FABRIC_DEVICE, FABRIC_TARGET, FRR_IMAGE, GIVES_AWAY, HASH_SCRIPT, INJECT, INSERT, KAFKA_TAIL_MS, KEPT, LAYERS, LAYER_FACTS, LIMITS, LINGER_MS, LISTING, LOAD_FORMAT, LOAD_PATH, LOCK_NAMES, LOSS_MARGIN, MEMBER_MARKS, MONITOR_DOWN, NODE_MARKS, NOISE, PINNED, PUMP, PUMP_SLACK, QUIET_MS, RELATIVE, REPLICA_SET_STAGES, REPOSITORY, RESOURCES_EVENT, RESOURCES_PROGRAM, RESTART, ROUTERS, SCHEDULE_PATH, SEED_DOCUMENT, SHIPPED_CLIENTS, SHIPPED_NAMES, STAGES, STANDBY_READY, STATUS_SCRIPT, STEPS, STEP_DOWN, amqpClientImage, basesOf, bootstrapOf, brokerEnv, buildOf, buildRecordOf, callOf, cancelsOf, cargoVersions, cgroupKeyed, cgroupLimit, cgroupNumber, clockOffsetOf, closeOrExit, cloudOf, clusterArgs, clusterConf, clusterCutOf, clusterHostsOf, clusterOnce, clusterStagesOf, clusterViewOf, commitProblems, commitVoid, comparable, controllerEnv, cpuMaxOf, cpuStatOf, crossingsOf, cutOf, deadlineOf, delayVoids, deliveryFinding, deliveryOf, deviceOf, diskRecordProblems, diskSubjectProblems, drillOnce, drillSpan, dropFinding, dropOf, endpointAfter, envOf, environmentCounts, environmentProblems, errorsOf, estimateOf, estimateVerdict, exitOf, fieldOf, fieldsOf, firstUnanswered, folderDigest, frrConf, goHttpImage, goVersions, groupOnce, groupVerdictOf, grpcClientImage, harnessImage, harnessRecord, harnessVersion, hashOf, highestHeld, hikariClientImage, hostLimitsOf, hzOf, imageOf, imagePinProblems, imageProblems, inContext, infoOf, initiateScript, isFenceLine, isHopPlace, jarVersions, jitterOf, jitterOfLines, judge, kafkaArgs, kafkaClientImage, kafkaCutOf, kafkaOnce, kafkaPauseOnce, kafkaViewOf, lagsOf, laterMove, latestEndOf, layerOf, leafLacks, leftAfter, limitsOf, limitsProblems, loadOf, loadPlanOf, loadVerdict, locksOf, logNameOf, logTimeOf, manifestProblems, matches, measure, measureConntrack, measureDriver, measureEgress, measureGroup, measureMemory, measurePause, measurePorts, measureQueue, medianInterval, memAvailableOf, memberCommand, memberConfig, memberLineOf, memoryStatOf, mongoClientImage, monotonicAt, monotonicOf, namesGroup, networkOf, nodeClientImage, nodeCommand, nodeHttpImage, nodeIdOf, nodeLineOf, nodeNameOf, nodesOnMonotonic, noiseOf, npmDrift, npmVersions, numbersOf, onMonotonic, openClusterLab, openDiskLab, openFabric, openGroupLab, openKafkaLab, openLab, openReplicaSetLab, openStandby, pairArgs, pairOnce, pairingOf, pairingsOf, pauseReady, peersOf, pgClientImage, pingsOf, plainOf, planOf, pongsOf, poolOf, programLines, programOf, quantileOf, readCpu, readHost, readOplog, reconnectFinding, reconnectOf, recordProblems, recoveryFindings, recoveryOf, referenceOf, reorderingOf, replicaSetArgs, replicaSetOnce, replicaSetStagesOf, requestOf, requestWords, resourceArgs, resourceChange, resourceReader, resourceReadingIn, resourceReadingOf, restamped, roomNeeded, roomVoidOf, routeLine, routerImage, routesOf, runCell, runDiskFault, seedScript, sentinelConfig, sessionsOf, shippedClientRecord, shippedSource, sliceQuery, socketAt, socketOf, socketsOf, spread, spreadOf, stagesOf, standaloneCommand, standbyCommand, statusViewOf, stealShare, stepBand, stopScript, streamEnded, streamOf, streamsLoadOf, subjectClient, subjectProblems, subscriptionsOf, substrateHere, substrateKey, substrateOf, substrateOn, targetImageOf, targetSourceOf, templated, toolJsonOf, topicOf, topologyOf, toxicBody, unlockedManifests, unpinnedBases, unpoolable, verdictOf, versionsOf, viewOf, writesOf };
|
|
9678
|
+
export { AWS_FROM, CLIENT_CAPABILITIES, CLIENT_NAMES, CLOSED_TOLERANCE, CLOUDS, CLUSTER_STAGES, CONVERGE_MS, DAEMONS, DEBUG, DIRTY, DISK_MOUNT, DISK_RECORD_FORMAT, DISK_ROOT, DISK_SUBJECT, DROP_HANDLING, FABRIC_CLIENT, FABRIC_DEVICE, FABRIC_TARGET, FRR_IMAGE, GIVES_AWAY, HASH_SCRIPT, INJECT, INSERT, KAFKA_TAIL_MS, KEPT, LAYERS, LAYER_FACTS, LIMITS, LINGER_MS, LISTING, LOAD_FORMAT, LOAD_PATH, LOAD_POOL_LIMIT, LOCK_NAMES, LOSS_MARGIN, MEMBER_MARKS, MONITOR_DOWN, NODE_MARKS, NOISE, PINNED, PUMP, PUMP_SLACK, QUIET_MS, RELATIVE, REPLICA_SET_STAGES, REPOSITORY, RESOURCES_EVENT, RESOURCES_PROGRAM, RESTART, ROUTERS, SCHEDULE_PATH, SEED_DOCUMENT, SHIPPED_CLIENTS, SHIPPED_NAMES, STAGES, STANDBY_READY, STATUS_SCRIPT, STEPS, STEP_DOWN, amqpClientImage, basesOf, bootstrapOf, brokerEnv, buildOf, buildRecordOf, callOf, cancelsOf, cargoVersions, cgroupKeyed, cgroupLimit, cgroupNumber, clockOffsetOf, closeOrExit, cloudOf, clusterArgs, clusterConf, clusterCutOf, clusterHostsOf, clusterOnce, clusterStagesOf, clusterViewOf, commitProblems, commitVoid, comparable, connectionsProblems, controllerEnv, cpuMaxOf, cpuStatOf, crossingsOf, cutOf, deadlineOf, delayVoids, deliveryFinding, deliveryOf, deviceOf, diskRecordProblems, diskSubjectProblems, drillOnce, drillSpan, dropFinding, dropOf, endpointAfter, envOf, environmentCounts, environmentProblems, errorsOf, estimateOf, estimateVerdict, exitOf, fieldOf, fieldsOf, firstUnanswered, folderDigest, frrConf, goHttpImage, goVersions, groupOnce, groupVerdictOf, grpcClientImage, harnessImage, harnessRecord, harnessVersion, hashOf, highestHeld, hikariClientImage, hostLimitsOf, hzOf, imageOf, imagePinProblems, imageProblems, inContext, infoOf, initiateScript, isFenceLine, isHopPlace, jarVersions, jitterOf, jitterOfLines, judge, kafkaArgs, kafkaClientImage, kafkaCutOf, kafkaOnce, kafkaPauseOnce, kafkaViewOf, lagsOf, laterMove, latestEndOf, layerOf, leafLacks, leftAfter, limitsOf, limitsProblems, loadOf, loadPlanOf, loadVerdict, locksOf, logNameOf, logTimeOf, manifestProblems, matches, measure, measureConntrack, measureDriver, measureEgress, measureGroup, measureMemory, measurePause, measurePorts, measureQueue, medianInterval, memAvailableOf, memberCommand, memberConfig, memberLineOf, memoryStatOf, mongoClientImage, monotonicAt, monotonicOf, namesGroup, networkOf, nodeClientImage, nodeCommand, nodeHttpImage, nodeIdOf, nodeLineOf, nodeNameOf, nodesOnMonotonic, noiseOf, npmDrift, npmVersions, numbersOf, onMonotonic, openClusterLab, openDiskLab, openFabric, openGroupLab, openKafkaLab, openLab, openReplicaSetLab, openStandby, pairArgs, pairOnce, pairingOf, pairingsOf, pauseReady, peersOf, pgClientImage, pingsOf, plainOf, planOf, pongsOf, poolOf, programLines, programOf, quantileOf, readCpu, readHost, readOplog, reconnectFinding, reconnectOf, recordProblems, recoveryFindings, recoveryOf, referenceOf, reorderingOf, replicaSetArgs, replicaSetOnce, replicaSetStagesOf, requestOf, requestWords, resourceArgs, resourceChange, resourceReader, resourceReadingIn, resourceReadingOf, restamped, roomNeeded, roomVoidOf, routeLine, routerImage, routesOf, runCell, runDiskFault, seedScript, sentinelConfig, sessionsOf, shippedClientRecord, shippedSource, sliceQuery, socketAt, socketOf, socketsOf, spread, spreadOf, stagesOf, standaloneCommand, standbyCommand, statusViewOf, stealShare, stepBand, stopScript, streamEnded, streamOf, streamsLoadOf, subjectClient, subjectProblems, subscriptionsOf, substrateHere, substrateKey, substrateOf, substrateOn, targetImageOf, targetSourceOf, templated, toolJsonOf, topicOf, topologyOf, toxicBody, unlockedManifests, unpinnedBases, unpoolable, verdictOf, versionsOf, viewOf, writesOf };
|
|
10296
9679
|
|
|
10297
9680
|
//# sourceMappingURL=index.js.map
|