@foldrun/core 14.4.0 → 14.5.0
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/src/run-container.d.ts +4 -19
- package/dist/src/run-container.js +4 -20
- package/dist/src/startup.d.ts +61 -0
- package/dist/src/startup.js +86 -0
- package/package.json +1 -1
- package/src/run-container.ts +4 -22
- package/src/startup.ts +106 -0
|
@@ -10,6 +10,7 @@ import { type RuntimeSpec } from "./runtime.ts";
|
|
|
10
10
|
import { type NetworkLevel } from "./network.ts";
|
|
11
11
|
import { type ResourceOverride } from "./resources.ts";
|
|
12
12
|
import type { ScriptSpec } from "./script-tools.ts";
|
|
13
|
+
import { STARTUP_PHASES, type StartupPhase, type StartupPhases } from "./startup.ts";
|
|
13
14
|
import type { ConsultSpec } from "./agent-tools.ts";
|
|
14
15
|
import type { DelegateSpec, SubagentSpec } from "./subagents.ts";
|
|
15
16
|
import { type OperatorEvent } from "./operator.ts";
|
|
@@ -131,25 +132,9 @@ export interface StepTiming {
|
|
|
131
132
|
* first driver's phases are on the record already). */
|
|
132
133
|
phases?: StartupPhases;
|
|
133
134
|
}
|
|
134
|
-
/**
|
|
135
|
-
*
|
|
136
|
-
|
|
137
|
-
* two neighbours is what the later one cost (FOL-29: "pod ready" was the
|
|
138
|
-
* only number, and the six seconds after it had no names).
|
|
139
|
-
*
|
|
140
|
-
* The executor marks its own: `services` (the account's search/browser pods
|
|
141
|
-
* up), `room` (room on the cluster to start — platform pod-room.ts),
|
|
142
|
-
* `applied` (pod created), `ready`, `files` (the workspace copied in),
|
|
143
|
-
* `go` (the step released). The sandbox marks the rest as `{"e":"mark"}`
|
|
144
|
-
* lines: `shim` (the shim saw go), `system` (system packages restored),
|
|
145
|
-
* `driver` (node up), `imports` (core loaded), `tools` (runtime and tools
|
|
146
|
-
* built, the SDK about to start) and `model` (the model's first text or tool
|
|
147
|
-
* call). A worker that predates a mark ignores the line — parseDriverLine
|
|
148
|
-
* answers null for an `e` it does not know.
|
|
149
|
-
*/
|
|
150
|
-
export declare const STARTUP_PHASES: readonly ["services", "room", "applied", "ready", "files", "go", "shim", "system", "driver", "imports", "tools", "model"];
|
|
151
|
-
export type StartupPhase = (typeof STARTUP_PHASES)[number];
|
|
152
|
-
export type StartupPhases = Partial<Record<StartupPhase, number>>;
|
|
135
|
+
/** The start-up phases and what each marks — startup.ts, where every
|
|
136
|
+
* surface that shows them reads them from (FOL-74). */
|
|
137
|
+
export { STARTUP_PHASES, type StartupPhase, type StartupPhases };
|
|
153
138
|
/** A sandbox-side mark: which phase ended, and when (epoch ms, the
|
|
154
139
|
* sandbox's clock — the same machine's as the worker's on one node). */
|
|
155
140
|
export declare function parseDriverMark(line: string): {
|
|
@@ -31,28 +31,12 @@ import { isFileValue, fileContent } from "./secrets.js";
|
|
|
31
31
|
import { safeTenantSegment, systemInstallSh, SYSTEM_FROM_INPUT_SH, INSTALL_SOCKET } from "./runtime.js";
|
|
32
32
|
import { egressCaSh } from "./network.js";
|
|
33
33
|
import { anyMemoryMi, quantityMi } from "./resources.js";
|
|
34
|
+
import { STARTUP_PHASES } from "./startup.js";
|
|
34
35
|
import { isOperatorEvent } from "./operator.js";
|
|
35
36
|
import { parseBrowserPod } from "./browser-pod.js";
|
|
36
|
-
/**
|
|
37
|
-
*
|
|
38
|
-
|
|
39
|
-
* two neighbours is what the later one cost (FOL-29: "pod ready" was the
|
|
40
|
-
* only number, and the six seconds after it had no names).
|
|
41
|
-
*
|
|
42
|
-
* The executor marks its own: `services` (the account's search/browser pods
|
|
43
|
-
* up), `room` (room on the cluster to start — platform pod-room.ts),
|
|
44
|
-
* `applied` (pod created), `ready`, `files` (the workspace copied in),
|
|
45
|
-
* `go` (the step released). The sandbox marks the rest as `{"e":"mark"}`
|
|
46
|
-
* lines: `shim` (the shim saw go), `system` (system packages restored),
|
|
47
|
-
* `driver` (node up), `imports` (core loaded), `tools` (runtime and tools
|
|
48
|
-
* built, the SDK about to start) and `model` (the model's first text or tool
|
|
49
|
-
* call). A worker that predates a mark ignores the line — parseDriverLine
|
|
50
|
-
* answers null for an `e` it does not know.
|
|
51
|
-
*/
|
|
52
|
-
export const STARTUP_PHASES = [
|
|
53
|
-
"services", "room", "applied", "ready", "files", "go",
|
|
54
|
-
"shim", "system", "driver", "imports", "tools", "model",
|
|
55
|
-
];
|
|
37
|
+
/** The start-up phases and what each marks — startup.ts, where every
|
|
38
|
+
* surface that shows them reads them from (FOL-74). */
|
|
39
|
+
export { STARTUP_PHASES };
|
|
56
40
|
/** A sandbox-side mark: which phase ended, and when (epoch ms, the
|
|
57
41
|
* sandbox's clock — the same machine's as the worker's on one node). */
|
|
58
42
|
export function parseDriverMark(line) {
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The start-up of one step, in the order it happens. Each is the moment the
|
|
3
|
+
* phase ENDED, in ms since the executor began the step (seconds on the step
|
|
4
|
+
* record), so the gap between two neighbours is what the later one cost
|
|
5
|
+
* (FOL-29: "pod ready" was the only number, and the six seconds after it had
|
|
6
|
+
* no names).
|
|
7
|
+
*
|
|
8
|
+
* The executor marks its own: `services` (the account's search/browser pods
|
|
9
|
+
* up), `room` (room on the cluster to start — platform pod-room.ts),
|
|
10
|
+
* `applied` (pod created), `ready`, `files` (the workspace copied in),
|
|
11
|
+
* `go` (the step released). The sandbox marks the rest as `{"e":"mark"}`
|
|
12
|
+
* lines: `shim` (the shim saw go), `system` (system packages restored),
|
|
13
|
+
* `driver` (node up), `imports` (core loaded), `tools` (runtime and tools
|
|
14
|
+
* built, the SDK about to start) and `model` (the model's first text or tool
|
|
15
|
+
* call). A worker that predates a mark ignores the line — parseDriverLine
|
|
16
|
+
* answers null for an `e` it does not know.
|
|
17
|
+
*
|
|
18
|
+
* `services` is the one phase that may not be in line: since FOL-46 the
|
|
19
|
+
* account's search and browser pods boot ALONGSIDE the step pod, and `go`
|
|
20
|
+
* waits for both. See startupBreakdown.
|
|
21
|
+
*/
|
|
22
|
+
export declare const STARTUP_PHASES: readonly ["services", "room", "applied", "ready", "files", "go", "shim", "system", "driver", "imports", "tools", "model"];
|
|
23
|
+
export type StartupPhase = (typeof STARTUP_PHASES)[number];
|
|
24
|
+
export type StartupPhases = Partial<Record<StartupPhase, number>>;
|
|
25
|
+
/** One phase of one step's start-up, placed on its lane. */
|
|
26
|
+
export interface StartupSpan {
|
|
27
|
+
phase: StartupPhase;
|
|
28
|
+
/** When the phase could begin, counted from the step's start. */
|
|
29
|
+
from: number;
|
|
30
|
+
/** When it ended — the mark itself. */
|
|
31
|
+
at: number;
|
|
32
|
+
/** Its own share: `at − from`, never negative. */
|
|
33
|
+
took: number;
|
|
34
|
+
/** It ran alongside the step pod's own phases rather than before them —
|
|
35
|
+
* `services` on a run whose search or browser pod was still booting
|
|
36
|
+
* when the step pod was up (FOL-46). */
|
|
37
|
+
parallel: boolean;
|
|
38
|
+
/** How long this phase sat ready to start but held back by a parallel
|
|
39
|
+
* lane — `go` behind a `services` that was still booting. 0 otherwise. */
|
|
40
|
+
waited: number;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* A step's start-up marks as spans, overlap-aware (FOL-74).
|
|
44
|
+
*
|
|
45
|
+
* Every phase but `services` runs in line: each starts when the one marked
|
|
46
|
+
* before it ended. `services` either comes first — no services, or ones
|
|
47
|
+
* awaited before the step pod was asked for, and its mark lands before the
|
|
48
|
+
* pod's first — or, when it was marked after the pod's first phase, it ran in
|
|
49
|
+
* parallel from the step's start: its span is 0 → its mark, the pod's lane
|
|
50
|
+
* starts at 0 as well, and `go` (which the gate holds until every service is
|
|
51
|
+
* up) starts at the later of the two lanes, the difference being `waited`.
|
|
52
|
+
* (The executor re-marks `services` at the gate and keeps no earlier mark,
|
|
53
|
+
* so on such a run the staging before the pod is asked for falls in the
|
|
54
|
+
* pod lane's first phase, usually `room`, rather than in `services`.)
|
|
55
|
+
*
|
|
56
|
+
* Subtracting neighbours in STARTUP_PHASES order instead gave the overlapped
|
|
57
|
+
* run's `services` the pod's boot as well, and every phase it overlapped
|
|
58
|
+
* +0.00s. Missing and non-finite marks are skipped; a later mark that reads
|
|
59
|
+
* earlier than the one before it (two clocks) takes 0, never a negative.
|
|
60
|
+
*/
|
|
61
|
+
export declare function startupBreakdown(marks: Record<string, unknown> | null | undefined): StartupSpan[];
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
// Where a step's start-up went, phase by phase (FOL-29), read the same way
|
|
2
|
+
// by every surface that shows it: the platform's Observe report (and through
|
|
3
|
+
// its API the CLI's `foldrun observe`) and the run page's start-up chip.
|
|
4
|
+
//
|
|
5
|
+
// Pure and import-free, so the dashboard can load it in the browser.
|
|
6
|
+
/**
|
|
7
|
+
* The start-up of one step, in the order it happens. Each is the moment the
|
|
8
|
+
* phase ENDED, in ms since the executor began the step (seconds on the step
|
|
9
|
+
* record), so the gap between two neighbours is what the later one cost
|
|
10
|
+
* (FOL-29: "pod ready" was the only number, and the six seconds after it had
|
|
11
|
+
* no names).
|
|
12
|
+
*
|
|
13
|
+
* The executor marks its own: `services` (the account's search/browser pods
|
|
14
|
+
* up), `room` (room on the cluster to start — platform pod-room.ts),
|
|
15
|
+
* `applied` (pod created), `ready`, `files` (the workspace copied in),
|
|
16
|
+
* `go` (the step released). The sandbox marks the rest as `{"e":"mark"}`
|
|
17
|
+
* lines: `shim` (the shim saw go), `system` (system packages restored),
|
|
18
|
+
* `driver` (node up), `imports` (core loaded), `tools` (runtime and tools
|
|
19
|
+
* built, the SDK about to start) and `model` (the model's first text or tool
|
|
20
|
+
* call). A worker that predates a mark ignores the line — parseDriverLine
|
|
21
|
+
* answers null for an `e` it does not know.
|
|
22
|
+
*
|
|
23
|
+
* `services` is the one phase that may not be in line: since FOL-46 the
|
|
24
|
+
* account's search and browser pods boot ALONGSIDE the step pod, and `go`
|
|
25
|
+
* waits for both. See startupBreakdown.
|
|
26
|
+
*/
|
|
27
|
+
export const STARTUP_PHASES = [
|
|
28
|
+
"services", "room", "applied", "ready", "files", "go",
|
|
29
|
+
"shim", "system", "driver", "imports", "tools", "model",
|
|
30
|
+
];
|
|
31
|
+
/**
|
|
32
|
+
* A step's start-up marks as spans, overlap-aware (FOL-74).
|
|
33
|
+
*
|
|
34
|
+
* Every phase but `services` runs in line: each starts when the one marked
|
|
35
|
+
* before it ended. `services` either comes first — no services, or ones
|
|
36
|
+
* awaited before the step pod was asked for, and its mark lands before the
|
|
37
|
+
* pod's first — or, when it was marked after the pod's first phase, it ran in
|
|
38
|
+
* parallel from the step's start: its span is 0 → its mark, the pod's lane
|
|
39
|
+
* starts at 0 as well, and `go` (which the gate holds until every service is
|
|
40
|
+
* up) starts at the later of the two lanes, the difference being `waited`.
|
|
41
|
+
* (The executor re-marks `services` at the gate and keeps no earlier mark,
|
|
42
|
+
* so on such a run the staging before the pod is asked for falls in the
|
|
43
|
+
* pod lane's first phase, usually `room`, rather than in `services`.)
|
|
44
|
+
*
|
|
45
|
+
* Subtracting neighbours in STARTUP_PHASES order instead gave the overlapped
|
|
46
|
+
* run's `services` the pod's boot as well, and every phase it overlapped
|
|
47
|
+
* +0.00s. Missing and non-finite marks are skipped; a later mark that reads
|
|
48
|
+
* earlier than the one before it (two clocks) takes 0, never a negative.
|
|
49
|
+
*/
|
|
50
|
+
export function startupBreakdown(marks) {
|
|
51
|
+
if (!marks || typeof marks !== "object")
|
|
52
|
+
return [];
|
|
53
|
+
const at = (p) => {
|
|
54
|
+
const v = marks[p];
|
|
55
|
+
return typeof v === "number" && Number.isFinite(v) ? v : null;
|
|
56
|
+
};
|
|
57
|
+
const services = at("services");
|
|
58
|
+
const firstInLine = STARTUP_PHASES.find((p) => p !== "services" && at(p) !== null);
|
|
59
|
+
const parallel = services !== null && firstInLine !== undefined && services > at(firstInLine);
|
|
60
|
+
const spans = [];
|
|
61
|
+
// Where the step pod's lane has got to. A services phase in line is the
|
|
62
|
+
// first thing on it; one in parallel leaves it at the step's start.
|
|
63
|
+
let lane = 0;
|
|
64
|
+
for (const phase of STARTUP_PHASES) {
|
|
65
|
+
const end = at(phase);
|
|
66
|
+
if (end === null)
|
|
67
|
+
continue;
|
|
68
|
+
if (phase === "services") {
|
|
69
|
+
spans.push({ phase, from: 0, at: end, took: Math.max(0, end), parallel, waited: 0 });
|
|
70
|
+
if (!parallel)
|
|
71
|
+
lane = Math.max(lane, end);
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
let from = lane;
|
|
75
|
+
let waited = 0;
|
|
76
|
+
// `go` is released only once every service is up: on an overlapped run
|
|
77
|
+
// it starts when the later of the two lanes did.
|
|
78
|
+
if (phase === "go" && parallel && services > lane) {
|
|
79
|
+
waited = services - lane;
|
|
80
|
+
from = services;
|
|
81
|
+
}
|
|
82
|
+
spans.push({ phase, from, at: end, took: Math.max(0, end - from), parallel: false, waited });
|
|
83
|
+
lane = Math.max(from, end);
|
|
84
|
+
}
|
|
85
|
+
return spans;
|
|
86
|
+
}
|
package/package.json
CHANGED
package/src/run-container.ts
CHANGED
|
@@ -38,6 +38,7 @@ import { safeTenantSegment, systemInstallSh, SYSTEM_FROM_INPUT_SH, INSTALL_SOCKE
|
|
|
38
38
|
import { egressCaSh, type NetworkLevel } from "./network.ts";
|
|
39
39
|
import { anyMemoryMi, quantityMi, type ResourceOverride } from "./resources.ts";
|
|
40
40
|
import type { ScriptSpec } from "./script-tools.ts";
|
|
41
|
+
import { STARTUP_PHASES, type StartupPhase, type StartupPhases } from "./startup.ts";
|
|
41
42
|
import type { ConsultSpec } from "./agent-tools.ts";
|
|
42
43
|
import type { DelegateSpec, SubagentSpec } from "./subagents.ts";
|
|
43
44
|
import { isOperatorEvent, type OperatorEvent } from "./operator.ts";
|
|
@@ -153,28 +154,9 @@ export interface StepTiming {
|
|
|
153
154
|
phases?: StartupPhases;
|
|
154
155
|
}
|
|
155
156
|
|
|
156
|
-
/**
|
|
157
|
-
*
|
|
158
|
-
|
|
159
|
-
* two neighbours is what the later one cost (FOL-29: "pod ready" was the
|
|
160
|
-
* only number, and the six seconds after it had no names).
|
|
161
|
-
*
|
|
162
|
-
* The executor marks its own: `services` (the account's search/browser pods
|
|
163
|
-
* up), `room` (room on the cluster to start — platform pod-room.ts),
|
|
164
|
-
* `applied` (pod created), `ready`, `files` (the workspace copied in),
|
|
165
|
-
* `go` (the step released). The sandbox marks the rest as `{"e":"mark"}`
|
|
166
|
-
* lines: `shim` (the shim saw go), `system` (system packages restored),
|
|
167
|
-
* `driver` (node up), `imports` (core loaded), `tools` (runtime and tools
|
|
168
|
-
* built, the SDK about to start) and `model` (the model's first text or tool
|
|
169
|
-
* call). A worker that predates a mark ignores the line — parseDriverLine
|
|
170
|
-
* answers null for an `e` it does not know.
|
|
171
|
-
*/
|
|
172
|
-
export const STARTUP_PHASES = [
|
|
173
|
-
"services", "room", "applied", "ready", "files", "go",
|
|
174
|
-
"shim", "system", "driver", "imports", "tools", "model",
|
|
175
|
-
] as const;
|
|
176
|
-
export type StartupPhase = (typeof STARTUP_PHASES)[number];
|
|
177
|
-
export type StartupPhases = Partial<Record<StartupPhase, number>>;
|
|
157
|
+
/** The start-up phases and what each marks — startup.ts, where every
|
|
158
|
+
* surface that shows them reads them from (FOL-74). */
|
|
159
|
+
export { STARTUP_PHASES, type StartupPhase, type StartupPhases };
|
|
178
160
|
|
|
179
161
|
/** A sandbox-side mark: which phase ended, and when (epoch ms, the
|
|
180
162
|
* sandbox's clock — the same machine's as the worker's on one node). */
|
package/src/startup.ts
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
// Where a step's start-up went, phase by phase (FOL-29), read the same way
|
|
2
|
+
// by every surface that shows it: the platform's Observe report (and through
|
|
3
|
+
// its API the CLI's `foldrun observe`) and the run page's start-up chip.
|
|
4
|
+
//
|
|
5
|
+
// Pure and import-free, so the dashboard can load it in the browser.
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The start-up of one step, in the order it happens. Each is the moment the
|
|
9
|
+
* phase ENDED, in ms since the executor began the step (seconds on the step
|
|
10
|
+
* record), so the gap between two neighbours is what the later one cost
|
|
11
|
+
* (FOL-29: "pod ready" was the only number, and the six seconds after it had
|
|
12
|
+
* no names).
|
|
13
|
+
*
|
|
14
|
+
* The executor marks its own: `services` (the account's search/browser pods
|
|
15
|
+
* up), `room` (room on the cluster to start — platform pod-room.ts),
|
|
16
|
+
* `applied` (pod created), `ready`, `files` (the workspace copied in),
|
|
17
|
+
* `go` (the step released). The sandbox marks the rest as `{"e":"mark"}`
|
|
18
|
+
* lines: `shim` (the shim saw go), `system` (system packages restored),
|
|
19
|
+
* `driver` (node up), `imports` (core loaded), `tools` (runtime and tools
|
|
20
|
+
* built, the SDK about to start) and `model` (the model's first text or tool
|
|
21
|
+
* call). A worker that predates a mark ignores the line — parseDriverLine
|
|
22
|
+
* answers null for an `e` it does not know.
|
|
23
|
+
*
|
|
24
|
+
* `services` is the one phase that may not be in line: since FOL-46 the
|
|
25
|
+
* account's search and browser pods boot ALONGSIDE the step pod, and `go`
|
|
26
|
+
* waits for both. See startupBreakdown.
|
|
27
|
+
*/
|
|
28
|
+
export const STARTUP_PHASES = [
|
|
29
|
+
"services", "room", "applied", "ready", "files", "go",
|
|
30
|
+
"shim", "system", "driver", "imports", "tools", "model",
|
|
31
|
+
] as const;
|
|
32
|
+
export type StartupPhase = (typeof STARTUP_PHASES)[number];
|
|
33
|
+
export type StartupPhases = Partial<Record<StartupPhase, number>>;
|
|
34
|
+
|
|
35
|
+
/** One phase of one step's start-up, placed on its lane. */
|
|
36
|
+
export interface StartupSpan {
|
|
37
|
+
phase: StartupPhase;
|
|
38
|
+
/** When the phase could begin, counted from the step's start. */
|
|
39
|
+
from: number;
|
|
40
|
+
/** When it ended — the mark itself. */
|
|
41
|
+
at: number;
|
|
42
|
+
/** Its own share: `at − from`, never negative. */
|
|
43
|
+
took: number;
|
|
44
|
+
/** It ran alongside the step pod's own phases rather than before them —
|
|
45
|
+
* `services` on a run whose search or browser pod was still booting
|
|
46
|
+
* when the step pod was up (FOL-46). */
|
|
47
|
+
parallel: boolean;
|
|
48
|
+
/** How long this phase sat ready to start but held back by a parallel
|
|
49
|
+
* lane — `go` behind a `services` that was still booting. 0 otherwise. */
|
|
50
|
+
waited: number;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* A step's start-up marks as spans, overlap-aware (FOL-74).
|
|
55
|
+
*
|
|
56
|
+
* Every phase but `services` runs in line: each starts when the one marked
|
|
57
|
+
* before it ended. `services` either comes first — no services, or ones
|
|
58
|
+
* awaited before the step pod was asked for, and its mark lands before the
|
|
59
|
+
* pod's first — or, when it was marked after the pod's first phase, it ran in
|
|
60
|
+
* parallel from the step's start: its span is 0 → its mark, the pod's lane
|
|
61
|
+
* starts at 0 as well, and `go` (which the gate holds until every service is
|
|
62
|
+
* up) starts at the later of the two lanes, the difference being `waited`.
|
|
63
|
+
* (The executor re-marks `services` at the gate and keeps no earlier mark,
|
|
64
|
+
* so on such a run the staging before the pod is asked for falls in the
|
|
65
|
+
* pod lane's first phase, usually `room`, rather than in `services`.)
|
|
66
|
+
*
|
|
67
|
+
* Subtracting neighbours in STARTUP_PHASES order instead gave the overlapped
|
|
68
|
+
* run's `services` the pod's boot as well, and every phase it overlapped
|
|
69
|
+
* +0.00s. Missing and non-finite marks are skipped; a later mark that reads
|
|
70
|
+
* earlier than the one before it (two clocks) takes 0, never a negative.
|
|
71
|
+
*/
|
|
72
|
+
export function startupBreakdown(marks: Record<string, unknown> | null | undefined): StartupSpan[] {
|
|
73
|
+
if (!marks || typeof marks !== "object") return [];
|
|
74
|
+
const at = (p: StartupPhase): number | null => {
|
|
75
|
+
const v = marks[p];
|
|
76
|
+
return typeof v === "number" && Number.isFinite(v) ? v : null;
|
|
77
|
+
};
|
|
78
|
+
const services = at("services");
|
|
79
|
+
const firstInLine = STARTUP_PHASES.find((p) => p !== "services" && at(p) !== null);
|
|
80
|
+
const parallel = services !== null && firstInLine !== undefined && services > at(firstInLine)!;
|
|
81
|
+
|
|
82
|
+
const spans: StartupSpan[] = [];
|
|
83
|
+
// Where the step pod's lane has got to. A services phase in line is the
|
|
84
|
+
// first thing on it; one in parallel leaves it at the step's start.
|
|
85
|
+
let lane = 0;
|
|
86
|
+
for (const phase of STARTUP_PHASES) {
|
|
87
|
+
const end = at(phase);
|
|
88
|
+
if (end === null) continue;
|
|
89
|
+
if (phase === "services") {
|
|
90
|
+
spans.push({ phase, from: 0, at: end, took: Math.max(0, end), parallel, waited: 0 });
|
|
91
|
+
if (!parallel) lane = Math.max(lane, end);
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
let from = lane;
|
|
95
|
+
let waited = 0;
|
|
96
|
+
// `go` is released only once every service is up: on an overlapped run
|
|
97
|
+
// it starts when the later of the two lanes did.
|
|
98
|
+
if (phase === "go" && parallel && services! > lane) {
|
|
99
|
+
waited = services! - lane;
|
|
100
|
+
from = services!;
|
|
101
|
+
}
|
|
102
|
+
spans.push({ phase, from, at: end, took: Math.max(0, end - from), parallel: false, waited });
|
|
103
|
+
lane = Math.max(from, end);
|
|
104
|
+
}
|
|
105
|
+
return spans;
|
|
106
|
+
}
|